1 | /******************************************************************************
|
---|
2 | * Example code which tests BBox's graphic glitch when window is enlarged bug.
|
---|
3 | * AGMS20170323 Compile with:
|
---|
4 | * g++ -Wall -Wno-multichar -g -lbe BBoxGraphicsGlitch.cpp
|
---|
5 | * And use ProcessController to quit (window close not implemented).
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include <Application.h>
|
---|
9 | #include <Box.h>
|
---|
10 | #include <Window.h>
|
---|
11 |
|
---|
12 | class BBoxWindow : public BWindow
|
---|
13 | {
|
---|
14 | public:
|
---|
15 | BBoxWindow (BRect FrameRect);
|
---|
16 |
|
---|
17 | public:
|
---|
18 | virtual void FrameResized (float newWidth, float newHeight);
|
---|
19 | virtual bool QuitRequested ();
|
---|
20 | };
|
---|
21 |
|
---|
22 | BBoxWindow::BBoxWindow (BRect FrameRect)
|
---|
23 | : BWindow (FrameRect, "BBox Glitch Test - Resize diagonally to see it",
|
---|
24 | B_DOCUMENT_WINDOW, 0)
|
---|
25 | {
|
---|
26 | }
|
---|
27 |
|
---|
28 | void BBoxWindow::FrameResized (float newWidth, float newHeight)
|
---|
29 | {
|
---|
30 | BWindow::FrameResized (newWidth, newHeight);
|
---|
31 | snooze (100000); // Simulate a slow computer.
|
---|
32 | }
|
---|
33 |
|
---|
34 | bool BBoxWindow::QuitRequested ()
|
---|
35 | {
|
---|
36 | be_app->PostMessage (B_QUIT_REQUESTED);
|
---|
37 | return true;
|
---|
38 | }
|
---|
39 |
|
---|
40 |
|
---|
41 | class BBoxGlitchApp : public BApplication
|
---|
42 | {
|
---|
43 | public:
|
---|
44 | BBoxGlitchApp ();
|
---|
45 |
|
---|
46 | virtual void ReadyToRun ();
|
---|
47 | };
|
---|
48 |
|
---|
49 | BBoxGlitchApp::BBoxGlitchApp ()
|
---|
50 | : BApplication ("application/BBoxGlitch")
|
---|
51 | {
|
---|
52 | }
|
---|
53 |
|
---|
54 | void BBoxGlitchApp::ReadyToRun ()
|
---|
55 | {
|
---|
56 | BWindow *WindowPntr = new BBoxWindow (BRect (40, 40, 200, 800));
|
---|
57 | WindowPntr->Show ();
|
---|
58 |
|
---|
59 | BRect BoxRect (WindowPntr->Bounds());
|
---|
60 | BoxRect.InsetBy (15, 15);
|
---|
61 | BBox *BBoxPntr = new BBox (BoxRect, "BBox with a Glitch",
|
---|
62 | B_FOLLOW_LEFT_RIGHT);
|
---|
63 | WindowPntr->AddChild (BBoxPntr);
|
---|
64 |
|
---|
65 | WindowPntr->Lock ();
|
---|
66 | BBoxPntr->SetViewColor (make_color (50, 150, 250, 255));
|
---|
67 | BBoxPntr->Invalidate ();
|
---|
68 | WindowPntr->Unlock ();
|
---|
69 | }
|
---|
70 |
|
---|
71 |
|
---|
72 | int main (int argc, char **argv)
|
---|
73 | {
|
---|
74 | BBoxGlitchApp MyApp;
|
---|
75 |
|
---|
76 | if (MyApp.InitCheck () == B_OK)
|
---|
77 | MyApp.Run ();
|
---|
78 |
|
---|
79 | return 0;
|
---|
80 | }
|
---|