Added a small cursor test application.
Note, it looks like we translate the cursor shape differently than R5 (according to the docs, black is always opaque and ignores the transparency bits). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16958 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
600fbd78e4
commit
da07353dcd
@ -20,8 +20,8 @@ UseFreeTypeHeaders ;
|
||||
local defines = [ FDefines TEST_MODE=1 ] ;
|
||||
# USE_DIRECT_WINDOW_TEST_MODE=1
|
||||
|
||||
SubDirCcFlags $(defines) ; # -fcheck-memory-usage -finstrument-functions -D_NO_INLINE_ASM ;
|
||||
SubDirC++Flags $(defines) ; #-fcheck-memory-usage -finstrument-functions -D_NO_INLINE_ASM ;
|
||||
SubDirCcFlags $(defines) -fcheck-memory-usage -D_NO_INLINE_ASM ;
|
||||
SubDirC++Flags $(defines) -fcheck-memory-usage -D_NO_INLINE_ASM ;
|
||||
|
||||
SEARCH_SOURCE += $(appServerDir) [ FDirName $(appServerDir) drawing ] ;
|
||||
|
||||
@ -144,6 +144,7 @@ SubInclude HAIKU_TOP src tests servers app avoid_focus ;
|
||||
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 cursor_test ;
|
||||
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 look_and_feel ;
|
||||
|
145
src/tests/servers/app/cursor_test/CursorTest.cpp
Normal file
145
src/tests/servers/app/cursor_test/CursorTest.cpp
Normal file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
#include <Application.h>
|
||||
#include <Cursor.h>
|
||||
#include <String.h>
|
||||
#include <View.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
class View : public BView {
|
||||
public:
|
||||
View(BRect rect);
|
||||
virtual ~View();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Pulse();
|
||||
};
|
||||
|
||||
|
||||
const uint8 kCursorData[68] = {
|
||||
16, 1, 8, 8,
|
||||
|
||||
0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
|
||||
0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
|
||||
0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
|
||||
0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
|
||||
|
||||
0xff, 0xff, 0x80, 0x01, 0x80, 0x01, 0x8f, 0xf1,
|
||||
0x88, 0x11, 0x88, 0x11, 0x88, 0x11, 0x89, 0x91,
|
||||
0x89, 0x91, 0x88, 0x11, 0x88, 0x11, 0x88, 0x11,
|
||||
0x8f, 0xf1, 0x80, 0x01, 0x80, 0x01, 0xff, 0xff,
|
||||
};
|
||||
|
||||
bool gHide = false;
|
||||
|
||||
|
||||
View::View(BRect rect)
|
||||
: BView(rect, "desktop view", B_FOLLOW_ALL, B_WILL_DRAW)
|
||||
{
|
||||
SetViewColor(0, 150, 0);
|
||||
}
|
||||
|
||||
|
||||
View::~View()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
View::AttachedToWindow()
|
||||
{
|
||||
BCursor cursor(kCursorData);
|
||||
SetViewCursor(&cursor);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
class Window : public BWindow {
|
||||
public:
|
||||
Window();
|
||||
virtual ~Window();
|
||||
|
||||
virtual bool QuitRequested();
|
||||
};
|
||||
|
||||
|
||||
Window::Window()
|
||||
: BWindow(BRect(100, 100, 400, 400), "Cursor-Test",
|
||||
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
|
||||
{
|
||||
BView *view = new View(Bounds().InsetByCopy(30, 30));
|
||||
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-cursor_test")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Application::ReadyToRun()
|
||||
{
|
||||
Window *window = new Window();
|
||||
window->Show();
|
||||
|
||||
if (gHide)
|
||||
HideCursor();
|
||||
else
|
||||
SetCursor(B_I_BEAM_CURSOR);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
if (argc > 1 && !strcmp(argv[1], "hide"))
|
||||
gHide = true;
|
||||
|
||||
Application app;
|
||||
|
||||
app.Run();
|
||||
return 0;
|
||||
}
|
18
src/tests/servers/app/cursor_test/Jamfile
Normal file
18
src/tests/servers/app/cursor_test/Jamfile
Normal file
@ -0,0 +1,18 @@
|
||||
SubDir HAIKU_TOP src tests servers app cursor_test ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
AddSubDirSupportedPlatforms libbe_test ;
|
||||
|
||||
UseHeaders [ FDirName os app ] ;
|
||||
UseHeaders [ FDirName os interface ] ;
|
||||
|
||||
Application CursorTest :
|
||||
CursorTest.cpp
|
||||
: be
|
||||
;
|
||||
|
||||
if $(TARGET_PLATFORM) = libbe_test {
|
||||
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : CursorTest
|
||||
: tests!apps ;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user