my current playground
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12644 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,6 +5,8 @@ UseHeaders [ FDirName os interface ] ;
|
|||||||
|
|
||||||
SimpleTest Window :
|
SimpleTest Window :
|
||||||
main.cpp
|
main.cpp
|
||||||
|
# for running in the Haiku app_server under R5:
|
||||||
: libopenbeos.so ;
|
: libopenbeos.so ;
|
||||||
|
# for running natively under R5 or Haiku:
|
||||||
# : libbe.so ;
|
# : libbe.so ;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
#include <String.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
@@ -28,6 +29,16 @@ class HelloView : public BView {
|
|||||||
rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR);
|
rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
SetViewColor(bg);
|
SetViewColor(bg);
|
||||||
SetLowColor(bg);
|
SetLowColor(bg);
|
||||||
|
|
||||||
|
BFont font;
|
||||||
|
GetFont(&font);
|
||||||
|
BString string("ß amM öo\t");
|
||||||
|
int32 charCount = string.CountChars();
|
||||||
|
float* escapements = new float[charCount];
|
||||||
|
font.GetEscapements(string.String(), charCount, NULL, escapements);
|
||||||
|
for (int32 i = 0; i < charCount; i++)
|
||||||
|
printf("escapement: %.3f\n", escapements[i]);
|
||||||
|
delete[] escapements;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect)
|
virtual void Draw(BRect updateRect)
|
||||||
@@ -64,8 +75,14 @@ class HelloView : public BView {
|
|||||||
|
|
||||||
DrawString(message, p);
|
DrawString(message, p);
|
||||||
|
|
||||||
SetHighColor(255, 255, 255, 128);
|
// SetDrawingMode(B_OP_OVER);
|
||||||
|
SetDrawingMode(B_OP_ALPHA);
|
||||||
|
SetPenSize(10.0);
|
||||||
|
SetHighColor(0, 80, 255, 100);
|
||||||
StrokeLine(fTrackingStart, fLastMousePos);
|
StrokeLine(fTrackingStart, fLastMousePos);
|
||||||
|
// TODO: this should not be necessary with proper state stack
|
||||||
|
// (a new state is pushed before Draw() is called)
|
||||||
|
SetDrawingMode(B_OP_COPY);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void MouseDown(BPoint where)
|
virtual void MouseDown(BPoint where)
|
||||||
@@ -109,12 +126,16 @@ show_window(BRect frame, const char* name)
|
|||||||
BMenuBar* menuBar = new BMenuBar(b, "menu bar");
|
BMenuBar* menuBar = new BMenuBar(b, "menu bar");
|
||||||
window->AddChild(menuBar);
|
window->AddChild(menuBar);
|
||||||
|
|
||||||
BMenu* menu = new BMenu("File");
|
BMenu* menu = new BMenu("Menus");
|
||||||
menuBar->AddItem(menu);
|
menuBar->AddItem(menu);
|
||||||
|
|
||||||
BMenuItem* menuItem = new BMenuItem("Quit", NULL, 'Q');
|
BMenuItem* menuItem = new BMenuItem("Quit", NULL, 'Q');
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
|
|
||||||
|
menuBar->AddItem(new BMenu("don't"));
|
||||||
|
menuBar->AddItem(new BMenu("work!"));
|
||||||
|
menuBar->AddItem(new BMenu("(yet)"));
|
||||||
|
|
||||||
b = window->Bounds();
|
b = window->Bounds();
|
||||||
b.top = menuBar->Bounds().bottom + 1;
|
b.top = menuBar->Bounds().bottom + 1;
|
||||||
BBox* bg = new BBox(b, "box", B_FOLLOW_ALL, B_WILL_DRAW, B_PLAIN_BORDER);
|
BBox* bg = new BBox(b, "box", B_FOLLOW_ALL, B_WILL_DRAW, B_PLAIN_BORDER);
|
||||||
@@ -123,7 +144,8 @@ show_window(BRect frame, const char* name)
|
|||||||
|
|
||||||
b = bg->Bounds();
|
b = bg->Bounds();
|
||||||
b.InsetBy(5.0, 5.0);
|
b.InsetBy(5.0, 5.0);
|
||||||
BView* view = new HelloView(b, "hello view", B_FOLLOW_ALL, B_WILL_DRAW);
|
BView* view = new HelloView(b, "hello view", B_FOLLOW_ALL,
|
||||||
|
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
|
||||||
|
|
||||||
bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
bg->AddChild(view);
|
bg->AddChild(view);
|
||||||
@@ -140,18 +162,21 @@ show_window(BRect frame, const char* name)
|
|||||||
b.top = button->Frame().bottom + 5.0;
|
b.top = button->Frame().bottom + 5.0;
|
||||||
b.bottom = b.top + 35.0;
|
b.bottom = b.top + 35.0;
|
||||||
b.right += 50.0;
|
b.right += 50.0;
|
||||||
// BTextControl* textControl = new BTextControl(b, "text control", "Text", "<enter text here>", NULL);
|
BTextControl* textControl = new BTextControl(b, "text control", "Text", "<enter text here>", NULL);
|
||||||
BRect textRect(b);
|
textControl->SetDivider(textControl->StringWidth(textControl->Label()) + 10.0);
|
||||||
textRect.OffsetTo(0.0, 0.0);
|
|
||||||
BTextView* textControl = new BTextView(b, "text view", textRect,
|
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW);
|
|
||||||
view->AddChild(textControl);
|
view->AddChild(textControl);
|
||||||
textControl->SetText("This is a BTextView.");
|
|
||||||
textControl->MakeFocus(true);
|
/* BRect textRect(b);
|
||||||
|
textRect.OffsetTo(0.0, 0.0);
|
||||||
|
BTextView* textView = new BTextView(b, "text view", textRect,
|
||||||
|
B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
|
view->AddChild(textView);
|
||||||
|
textView->SetText("This is a BTextView.");
|
||||||
|
textView->MakeFocus(true);*/
|
||||||
|
|
||||||
// check box
|
// check box
|
||||||
// b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 5.0));
|
// b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 5.0));
|
||||||
BCheckBox* checkBox = new BCheckBox(b, "check box", "CheckBox", NULL);
|
BCheckBox* checkBox = new BCheckBox(b, "check box", "CheckBox", NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
view->AddChild(checkBox);
|
view->AddChild(checkBox);
|
||||||
checkBox->MoveTo(5.0, view->Bounds().bottom - (b.Height() + 10.0));
|
checkBox->MoveTo(5.0, view->Bounds().bottom - (b.Height() + 10.0));
|
||||||
|
|
||||||
@@ -168,8 +193,8 @@ main(int argc, char** argv)
|
|||||||
BRect frame(50.0, 50.0, 200.0, 250.0);
|
BRect frame(50.0, 50.0, 200.0, 250.0);
|
||||||
show_window(frame, "Window #1");
|
show_window(frame, "Window #1");
|
||||||
|
|
||||||
frame.Set(80.0, 100.0, 350.0, 300.0);
|
// frame.Set(80.0, 100.0, 350.0, 300.0);
|
||||||
show_window(frame, "Window #2");
|
// show_window(frame, "Window #2");
|
||||||
|
|
||||||
app->Run();
|
app->Run();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
../../../../../distro/x86.R1/beos/system/servers/app_server &
|
../../../../../distro/x86.R1/beos/system/servers/app_server &
|
||||||
sleep 3s
|
sleep 1s
|
||||||
|
../../../../../distro/x86.R1/beos/system/servers/obos_registrar &
|
||||||
|
sleep 1s
|
||||||
../../../../../tests/servers/app/windows/Window
|
../../../../../tests/servers/app/windows/Window
|
||||||
|
|||||||
Reference in New Issue
Block a user