1 /*
2 * Copyright 2007, Haiku Inc.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
8
9
10 #include <Application.h>
11 #include <Menu.h>
12 #include <MenuBar.h>
13 #include <MenuItem.h>
14 #include <Window.h>
15
16 #include <stdio.h>
17
18
19 class Window : public BWindow {
20 public:
21 Window();
22 virtual ~Window();
23
24 virtual bool QuitRequested();
25 };
26
27
Window()28 Window::Window()
29 : BWindow(BRect(100, 100, 400, 400), "Menu Trigger Test",
30 B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
31 {
32 BMenuBar* bar = new BMenuBar(BRect(0, 0, 10, 10), "menuBar");
33 AddChild(bar);
34
35 BMenu* menu = new BMenu("File");
36 menu->AddItem(new BMenuItem("Bart", NULL));
37 menu->AddItem(new BMenuItem("bart", NULL));
38 menu->AddItem(new BMenuItem("bart", NULL));
39 menu->AddItem(new BMenuItem("Bart", NULL));
40 menu->AddItem(new BMenuItem("BART", NULL));
41 menu->AddItem(new BMenuItem("bärt", NULL));
42 menu->AddItem(new BMenuItem("bärst", NULL));
43 menu->AddSeparatorItem();
44 menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED)));
45 bar->AddItem(menu);
46
47 menu = new BMenu("Edit");
48 menu->AddItem(new BMenuItem("1 a", NULL));
49 menu->AddItem(new BMenuItem("2 a", NULL));
50 menu->AddItem(new BMenuItem("3 a", NULL));
51 menu->AddItem(new BMenuItem("3 a", NULL));
52 menu->AddItem(new BMenuItem("3 aöa", NULL));
53 bar->AddItem(menu);
54
55 menu = new BMenu("Extra");
56 BMenuItem* item = new BMenuItem("\xe3\x81\x82 haiku", NULL);
57 item->SetTrigger('h');
58 menu->AddItem(item);
59 bar->AddItem(menu);
60 }
61
~Window()62 Window::~Window()
63 {
64 }
65
66
67 bool
QuitRequested()68 Window::QuitRequested()
69 {
70 be_app->PostMessage(B_QUIT_REQUESTED);
71 return true;
72 }
73
74
75 // #pragma mark -
76
77
78 class Application : public BApplication {
79 public:
80 Application();
81
82 virtual void ReadyToRun(void);
83 };
84
85
Application()86 Application::Application()
87 : BApplication("application/x-vnd.haiku-view_state")
88 {
89 }
90
91
92 void
ReadyToRun(void)93 Application::ReadyToRun(void)
94 {
95 Window *window = new Window();
96 window->Show();
97 }
98
99
100 // #pragma mark -
101
102
103 int
main(int argc,char ** argv)104 main(int argc, char **argv)
105 {
106 Application app;// app;
107
108 app.Run();
109 return 0;
110 }
111