-Add the possibility to post formatted messages to the debug window

-Make the window resizable. BUT as this is a multitab window when I resize, only the view in the active TAB is resized, as soon as I switch to another TAB the view in the new selected tab has its old size, messing all.

* Can any UI guru explain whats the Best/Elegant way fixing this?



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28735 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes 2008-11-26 18:05:27 +00:00
parent b614227bfd
commit 0029cf816e
2 changed files with 25 additions and 4 deletions

View File

@ -4,6 +4,7 @@
#include <Looper.h>
#include <String.h>
#include <stdio.h>
/*
#ifndef _Preferences_h
@ -16,7 +17,7 @@
/****************************************************************/
OutputView::OutputView(BRect frame) :
BView(frame, "OutputView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
BView(frame, "OutputView", B_FOLLOW_ALL, B_WILL_DRAW)
{
SetViewColor(216,216,216);
rgb_color color = {255,255,255};
@ -46,20 +47,20 @@ OutputView::FrameResized(float width, float height)
Output* Output::m_instance = 0;
Output::Output() :
BWindow(BRect(200,200,600,600), "Output", B_TITLED_WINDOW, B_NOT_RESIZABLE)
BWindow(BRect(200,200,600,600), "Output", B_TITLED_WINDOW, B_NOT_ZOOMABLE)
{
BRect b = Bounds();
fTabsList = new BList(20);
fOutputViewsList = new BList(20);
BView* resetView = new BView(BRect(b.left,b.bottom-25,b.right,b.bottom), "resetView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
BView* resetView = new BView(BRect(b.left,b.bottom-25,b.right,b.bottom), "resetView", B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT , B_WILL_DRAW);
resetView->SetViewColor(216,216,216);
resetView->AddChild(m_pReset = new BButton(BRect(1,1,61,20), "reset all", "Clear", new BMessage(MSG_OUTPUT_RESET), B_FOLLOW_BOTTOM));
resetView->AddChild(m_pResetAll = new BButton(BRect(70,1,130,20), "reset", "Clear all", new BMessage(MSG_OUTPUT_RESET_ALL), B_FOLLOW_BOTTOM));
AddChild(resetView);
fTabView = new BTabView(BRect(b.left,b.top,b.right,b.bottom-25), "tab_view", B_WIDTH_FROM_LABEL /*,B_FOLLOW_ALL_SIDES, B_FULL_UPDATE_ON_RESIZE*/);
fTabView = new BTabView(BRect(b.left,b.top,b.right,b.bottom-25), "tab_view", B_WIDTH_FROM_LABEL ,B_FOLLOW_ALL, B_FULL_UPDATE_ON_RESIZE | B_WILL_DRAW | B_NAVIGABLE_JUMP );
fTabView->SetViewColor(216,216,216);
fBounds = fTabView->Bounds();
@ -155,6 +156,24 @@ Output::FrameMoved(BPoint point)
*/
}
int
Output::Postf(uint32 index, const char *format, ...)
{
char string[200];
va_list arg;
int done;
va_start (arg, format);
done = vsprintf (string, format, arg);
va_end (arg);
Post(string, index);
return done;
}
void
Output::Post(const char* text, uint32 index)
{
@ -171,6 +190,7 @@ Output::Post(const char* text, uint32 index)
Unlock();
}
void
Output::Add(const char* text, OutputView* view)
{

View File

@ -38,6 +38,7 @@ public:
void AddTab(const char* text, int32 index);
void Post(const char* text, uint32 index);
int Postf(uint32 index, const char *format, ...);
private: // functions
Output();