Added a test application to investigate how BeOS deals with keyboard input
in menus - the application will crash as soon as you open the "Crash" sub menu. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22148 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -167,6 +167,7 @@ SubInclude HAIKU_TOP src tests servers app desktop_window ;
|
|||||||
SubInclude HAIKU_TOP src tests servers app event_mask ;
|
SubInclude HAIKU_TOP src tests servers app event_mask ;
|
||||||
SubInclude HAIKU_TOP src tests servers app following ;
|
SubInclude HAIKU_TOP src tests servers app following ;
|
||||||
SubInclude HAIKU_TOP src tests servers app look_and_feel ;
|
SubInclude HAIKU_TOP src tests servers app look_and_feel ;
|
||||||
|
SubInclude HAIKU_TOP src tests servers app menu_crash ;
|
||||||
SubInclude HAIKU_TOP src tests servers app no_pointer_history ;
|
SubInclude HAIKU_TOP src tests servers app no_pointer_history ;
|
||||||
SubInclude HAIKU_TOP src tests servers app painter ;
|
SubInclude HAIKU_TOP src tests servers app painter ;
|
||||||
SubInclude HAIKU_TOP src tests servers app playground ;
|
SubInclude HAIKU_TOP src tests servers app playground ;
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
SubDir HAIKU_TOP src tests servers app menu_crash ;
|
||||||
|
|
||||||
|
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||||
|
AddSubDirSupportedPlatforms libbe_test ;
|
||||||
|
|
||||||
|
UseHeaders [ FDirName os app ] ;
|
||||||
|
UseHeaders [ FDirName os interface ] ;
|
||||||
|
|
||||||
|
Application MenuCrash :
|
||||||
|
MenuCrash.cpp
|
||||||
|
: be
|
||||||
|
;
|
||||||
|
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007, Haiku Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Menu.h>
|
||||||
|
#include <MenuBar.h>
|
||||||
|
#include <MenuItem.h>
|
||||||
|
#include <View.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
|
class MenuItem : public BMenuItem {
|
||||||
|
public:
|
||||||
|
MenuItem(const char* name);
|
||||||
|
virtual ~MenuItem();
|
||||||
|
|
||||||
|
virtual void DrawContent();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
MenuItem::MenuItem(const char* name)
|
||||||
|
: BMenuItem(name, NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MenuItem::~MenuItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MenuItem::DrawContent()
|
||||||
|
{
|
||||||
|
*(uint32*)0 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
class Window : public BWindow {
|
||||||
|
public:
|
||||||
|
Window();
|
||||||
|
virtual ~Window();
|
||||||
|
|
||||||
|
virtual bool QuitRequested();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Window::Window()
|
||||||
|
: BWindow(BRect(100, 100, 400, 400), "MenuCrash-Test",
|
||||||
|
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
|
||||||
|
{
|
||||||
|
BMenuBar* menuBar = new BMenuBar(Bounds(), "menu");
|
||||||
|
AddChild(menuBar);
|
||||||
|
|
||||||
|
// add menu
|
||||||
|
|
||||||
|
BMenu* menu = new BMenu("File");
|
||||||
|
BMenu* crashMenu = new BMenu("Crash");
|
||||||
|
crashMenu->AddItem(new MenuItem("Crash"));
|
||||||
|
menu->AddItem(crashMenu);
|
||||||
|
|
||||||
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
|
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
|
||||||
|
'Q', B_COMMAND_KEY));
|
||||||
|
menu->SetTargetForItems(this);
|
||||||
|
menuBar->AddItem(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
Window::~Window()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Window::QuitRequested()
|
||||||
|
{
|
||||||
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
class Application : public BApplication {
|
||||||
|
public:
|
||||||
|
Application();
|
||||||
|
|
||||||
|
virtual void ReadyToRun(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Application::Application()
|
||||||
|
: BApplication("application/x-vnd.haiku-menu_crash")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Application::ReadyToRun(void)
|
||||||
|
{
|
||||||
|
Window *window = new Window();
|
||||||
|
window->Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
Application app;
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user