Added a small test application that opens a desktop window (so that you don't have

to open the whole Tracker everytime for this).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15200 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-28 17:54:34 +00:00
parent 0b64aa6472
commit 94dc3ed625
3 changed files with 140 additions and 0 deletions

View File

@ -140,6 +140,7 @@ HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : haiku_app_server
SubInclude HAIKU_TOP src tests servers app bitmap_drawing ;
SubInclude HAIKU_TOP src tests servers app code_to_name ;
SubInclude HAIKU_TOP src tests servers app copy_bits ;
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 painter ;
SubInclude HAIKU_TOP src tests servers app playground ;

View File

@ -0,0 +1,120 @@
/*
* Copyright 2005, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, axeld@pinc-software.de
*/
#include <Application.h>
#include <Window.h>
#include <View.h>
#include <WindowPrivate.h>
#include <stdio.h>
class View : public BView {
public:
View(BRect rect);
virtual ~View();
virtual void Draw(BRect updateRect);
};
View::View(BRect rect)
: BView(rect, "desktop view", B_FOLLOW_ALL, B_WILL_DRAW)
{
SetViewColor(100, 100, 100);
SetHighColor(0, 0, 0);
SetLowColor(ViewColor());
}
View::~View()
{
}
void
View::Draw(BRect updateRect)
{
MovePenTo(20, 30);
DrawString("Desktop Window");
}
// #pragma mark -
class Window : public BWindow {
public:
Window();
virtual ~Window();
virtual bool QuitRequested();
};
Window::Window()
: BWindow(BRect(100, 100, 400, 400), "DesktopWindow-Test",
(window_look)kDesktopWindowLook, (window_feel)kDesktopWindowFeel,
B_ASYNCHRONOUS_CONTROLS)
{
BView *view = new View(Bounds());
AddChild(view);
}
Window::~Window()
{
}
bool
Window::QuitRequested()
{
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}
// #pragma mark -
class Application : public BApplication {
public:
Application();
virtual void ReadyToRun();
};
Application::Application()
: BApplication("application/x-vnd.haiku-desktop_window")
{
}
void
Application::ReadyToRun()
{
Window *window = new Window();
window->Show();
}
// #pragma mark -
int
main(int argc, char **argv)
{
Application app;// app;
app.Run();
return 0;
}

View File

@ -0,0 +1,19 @@
SubDir HAIKU_TOP src tests servers app desktop_window ;
SetSubDirSupportedPlatformsBeOSCompatible ;
AddSubDirSupportedPlatforms libbe_test ;
UseHeaders [ FDirName os app ] ;
UseHeaders [ FDirName os interface ] ;
UsePrivateHeaders interface ;
Application DesktopWindow :
DesktopWindow.cpp
: be
;
if $(TARGET_PLATFORM) = libbe_test {
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : DesktopWindow
: tests!apps ;
}