3 BMessage
* NewMessage(uint32 what
, uint32 data
)
5 BMessage
* m
= new BMessage(what
);
6 m
->AddInt32("data", (int32
)data
);
11 AppWindow::AppWindow(BRect aRect
)
12 : BWindow(aRect
, APPLICATION
, B_TITLED_WINDOW
, 0) {
14 BRect rect
= BRect(0,0,aRect
.Width(), aRect
.Height());
15 menubar
= new BMenuBar(rect
, "menu_bar");
18 menu
= new BMenu("Test");
19 menu
->AddItem(new BMenuItem("About ...", new BMessage(B_ABOUT_REQUESTED
)));
20 menu
->AddSeparatorItem();
21 menu
->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED
), 'Q'));
22 menubar
->AddItem(menu
);
24 menu
= new BMenu("Line Cap");
25 menu
->AddItem(new BMenuItem("Round", NewMessage(CAP_MSG
, B_ROUND_CAP
)));
26 menu
->AddItem(new BMenuItem("Butt", NewMessage(CAP_MSG
, B_BUTT_CAP
)));
27 menu
->AddItem(new BMenuItem("Square", NewMessage(CAP_MSG
, B_SQUARE_CAP
)));
28 menubar
->AddItem(menu
);
30 menu
= new BMenu("Line Join");
31 menu
->AddItem(new BMenuItem("Round", NewMessage(JOIN_MSG
, B_ROUND_JOIN
)));
32 menu
->AddItem(new BMenuItem("Miter", NewMessage(JOIN_MSG
, B_MITER_JOIN
)));
33 menu
->AddItem(new BMenuItem("Bevel", NewMessage(JOIN_MSG
, B_BEVEL_JOIN
)));
34 menu
->AddItem(new BMenuItem("Butt", NewMessage(JOIN_MSG
, B_BUTT_JOIN
)));
35 menu
->AddItem(new BMenuItem("Square", NewMessage(JOIN_MSG
, B_SQUARE_JOIN
)));
36 menubar
->AddItem(menu
);
38 menu
= new BMenu("Path");
39 menu
->AddItem(new BMenuItem("Open", new BMessage(OPEN_MSG
)));
40 menu
->AddItem(new BMenuItem("Close", new BMessage(CLOSE_MSG
)));
41 menubar
->AddItem(menu
);
45 aRect
.Set(0, menubar
->Bounds().Height()+1, aRect
.Width(), aRect
.Height());
47 AddChild(view
= new BBView(aRect
));
48 // make window visible
52 void AppWindow::MessageReceived(BMessage
*message
) {
54 message
->FindInt32("data", &data
);
56 switch(message
->what
) {
59 case B_ABOUT_REQUESTED
:
63 view
->SetLineMode((cap_mode
)data
, view
->LineJoinMode(), view
->LineMiterLimit());
67 view
->SetLineMode(view
->LineCapMode(), (join_mode
)data
, view
->LineMiterLimit());
72 view
->SetClose(message
->what
== CLOSE_MSG
);
76 BWindow::MessageReceived(message
);
81 bool AppWindow::QuitRequested() {
82 be_app
->PostMessage(B_QUIT_REQUESTED
);
86 void AppWindow::AboutRequested() {
87 BAlert
*about
= new BAlert(APPLICATION
,
88 APPLICATION
" " VERSION
"\nThis program is freeware under BSD/MIT license.\n\n"
90 "By Michael Pfeiffer.\n\n"
91 "EMail: michael.pfeiffer@utanet.at.","Close");
95 App::App() : BApplication("application/x-vnd.obos.BezierBounds") {
97 // set up a rectangle and instantiate a new window
98 aRect
.Set(100, 80, 410, 380);
100 window
= new AppWindow(aRect
);
103 int main(int argc
, char *argv
[]) {