Imported B_NO_POINTER_HISTORY test app from bug #1415, applied our coding
style, cleaned it up, and made it a bit more evident. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22020 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
22f5a4e492
commit
ffdeb47b94
@ -167,11 +167,12 @@ 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 following ;
|
||||
SubInclude HAIKU_TOP src tests servers app look_and_feel ;
|
||||
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 playground ;
|
||||
SubInclude HAIKU_TOP src tests servers app regularapps ;
|
||||
SubInclude HAIKU_TOP src tests servers app resize_limits ;
|
||||
SubInclude HAIKU_TOP src tests servers app scrolling ;
|
||||
SubInclude HAIKU_TOP src tests servers app stress_test ;
|
||||
SubInclude HAIKU_TOP src tests servers app textview ;
|
||||
SubInclude HAIKU_TOP src tests servers app regularapps ;
|
||||
SubInclude HAIKU_TOP src tests servers app view_state ;
|
||||
|
18
src/tests/servers/app/no_pointer_history/Jamfile
Normal file
18
src/tests/servers/app/no_pointer_history/Jamfile
Normal file
@ -0,0 +1,18 @@
|
||||
SubDir HAIKU_TOP src tests servers app no_pointer_history ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
AddSubDirSupportedPlatforms libbe_test ;
|
||||
|
||||
UseHeaders [ FDirName os app ] ;
|
||||
UseHeaders [ FDirName os interface ] ;
|
||||
|
||||
Application NoPointerHistory :
|
||||
NoPointerHistory.cpp
|
||||
: be $(TARGET_LIBSTDC++)
|
||||
;
|
||||
|
||||
if $(TARGET_PLATFORM) = libbe_test {
|
||||
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : NoPointerHistory
|
||||
: tests!apps ;
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
|
||||
#include <Application.h>
|
||||
#include <View.h>
|
||||
#include <Window.h>
|
||||
|
||||
|
||||
class MouseView : public BView {
|
||||
public:
|
||||
MouseView(BRect frame, bool noHistory);
|
||||
~MouseView();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MouseMoved(BPoint point, uint32 transit,
|
||||
const BMessage *message);
|
||||
|
||||
private:
|
||||
bool fNoHistory;
|
||||
};
|
||||
|
||||
|
||||
MouseView::MouseView(BRect frame, bool noHistory)
|
||||
: BView(frame, "MouseView", B_FOLLOW_ALL, B_WILL_DRAW),
|
||||
fNoHistory(noHistory)
|
||||
{
|
||||
SetViewColor(255, 255, 200);
|
||||
if (noHistory)
|
||||
SetHighColor(200, 0, 0);
|
||||
else
|
||||
SetHighColor(0, 200, 0);
|
||||
}
|
||||
|
||||
|
||||
MouseView::~MouseView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MouseView::AttachedToWindow()
|
||||
{
|
||||
if (fNoHistory)
|
||||
SetEventMask(0, B_NO_POINTER_HISTORY);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MouseView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
||||
{
|
||||
FillRect(BRect(point - BPoint(1, 1), point + BPoint(1, 1)));
|
||||
snooze(25000);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
BApplication app("application/x-vnd.Simon-NoPointerHistory");
|
||||
|
||||
BWindow* window = new BWindow(BRect(100, 100, 700, 400), "Window",
|
||||
B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);
|
||||
window->AddChild(new MouseView(BRect(10, 10, 295, 290), true));
|
||||
window->AddChild(new MouseView(BRect(305, 10, 590, 290), false));
|
||||
window->Show();
|
||||
|
||||
app.Run();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user