2 * Copyright 2007, Haiku Inc.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
12 #include <Application.h>
20 class MenuItem
: public BMenuItem
{
22 MenuItem(const char* name
);
25 virtual void DrawContent();
29 MenuItem::MenuItem(const char* name
)
30 : BMenuItem(name
, NULL
)
41 MenuItem::DrawContent()
50 class Window
: public BWindow
{
55 virtual bool QuitRequested();
60 : BWindow(BRect(100, 100, 400, 400), "MenuCrash-Test",
61 B_TITLED_WINDOW
, B_ASYNCHRONOUS_CONTROLS
)
63 BMenuBar
* menuBar
= new BMenuBar(Bounds(), "menu");
68 BMenu
* menu
= new BMenu("File");
69 BMenu
* crashMenu
= new BMenu("Crash");
70 crashMenu
->AddItem(new MenuItem("Crash"));
71 menu
->AddItem(crashMenu
);
73 menu
->AddSeparatorItem();
75 menu
->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED
),
77 menu
->SetTargetForItems(this);
78 menuBar
->AddItem(menu
);
87 Window::QuitRequested()
89 be_app
->PostMessage(B_QUIT_REQUESTED
);
97 class Application
: public BApplication
{
101 virtual void ReadyToRun(void);
105 Application::Application()
106 : BApplication("application/x-vnd.haiku-menu_crash")
112 Application::ReadyToRun(void)
114 Window
*window
= new Window();
123 main(int argc
, char **argv
)