Mercurial > dwindows
annotate dwtestoo.cpp @ 2940:60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 01 Jan 2023 01:14:55 +0000 |
parents | ebbc5b16899e |
children | 63d7baebb0d4 |
rev | line source |
---|---|
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
1 // An example Dynamic Windows application and testing |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
2 // ground for Dynamic Windows features in C++. |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
3 // By: Brian Smith and Mark Hessling |
2871
4b7c4cd7a11d
OS2: Fix building the C++ bindings on OS/2 with GCC.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2869
diff
changeset
|
4 #include "dw.hpp" |
2861
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
6 // Select a fixed width font for our platform |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
7 #ifdef __OS2__ |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
8 #define FIXEDFONT "5.System VIO" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
9 #define PLATFORMFOLDER "os2\\" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
10 #elif defined(__WIN32__) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
11 #define FIXEDFONT "10.Lucida Console" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
12 #define PLATFORMFOLDER "win\\" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
13 #elif defined(__MAC__) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
14 #define FIXEDFONT "9.Monaco" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
15 #define PLATFORMFOLDER "mac/" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
16 #elif defined(__IOS__) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
17 #define FIXEDFONT "9.Monaco" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
18 #elif defined(__ANDROID__) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
19 #define FIXEDFONT "10.Monospace" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
20 #elif GTK_MAJOR_VERSION > 1 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
21 #define FIXEDFONT "10.monospace" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
22 #define PLATFORMFOLDER "gtk/" |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
23 #else |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
24 #define FIXEDFONT "fixed" |
2882
99311a9091af
C++: Add lambda support via Connect functions on C++11, on older compilers
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2873
diff
changeset
|
25 #endif |
99311a9091af
C++: Add lambda support via Connect functions on C++11, on older compilers
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2873
diff
changeset
|
26 |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
27 #define SHAPES_DOUBLE_BUFFERED 0 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
28 #define SHAPES_DIRECT 1 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
29 #define DRAW_FILE 2 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
30 |
2915
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
31 #define APP_TITLE "Dynamic Windows C++" |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
32 #define APP_EXIT "Are you sure you want to exit?" |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
33 |
2932
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
34 #define MAX_WIDGETS 20 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
35 #define BUF_SIZE 1024 |
2932
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
36 |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
37 // Handle the case of very old compilers by using |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
38 // A simple non-lambda example instead. |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
39 #ifndef DW_LAMBDA |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
40 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
41 // Simple C++ Dynamic Windows Example |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
42 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
43 class DWTest : public DW::Window |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
44 { |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
45 public: |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
46 DW::App *app; |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
47 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
48 DWTest() { |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
49 app = DW::App::Init(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
50 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
51 SetText(APP_TITLE); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
52 SetSize(200, 200); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
53 } |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
54 int OnDelete() override { |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
55 if(app->MessageBox(APP_TITLE, DW_MB_YESNO | DW_MB_QUESTION, APP_EXIT) != 0) { |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
56 app->MainQuit(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
57 } |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
58 return FALSE; |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
59 } |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
60 }; |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
61 |
2924
248e32f744f0
C++: Attempt to get dwtestoo working with old pre-lambda compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2923
diff
changeset
|
62 int button_clicked(DW::Clickable *classptr) |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
63 { |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
64 DW::App *app = DW::App::Init(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
65 app->MessageBox("Button", DW_MB_OK | DW_MB_INFORMATION, "Clicked!"); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
66 return TRUE; |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
67 } |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
68 |
2924
248e32f744f0
C++: Attempt to get dwtestoo working with old pre-lambda compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2923
diff
changeset
|
69 int exit_handler(DW::Clickable *classptr) |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
70 { |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
71 DW::App *app = DW::App::Init(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
72 if(app->MessageBox(APP_TITLE, DW_MB_YESNO | DW_MB_QUESTION, APP_EXIT) != 0) { |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
73 app->MainQuit(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
74 } |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
75 return TRUE; |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
76 } |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
77 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
78 int dwmain(int argc, char* argv[]) |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
79 { |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
80 DW::App *app = DW::App::Init(argc, argv, "org.dbsoft.dwindows.dwtestoo"); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
81 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
82 app->MessageBox(APP_TITLE, DW_MB_OK | DW_MB_INFORMATION, |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
83 "Warning: You are viewing the simplified version of this sample program.\n\n" \ |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
84 "This is because your compiler does not have lambda support.\n\n" \ |
2928
102b96d77f89
C++: Visual Studio 2013 lambda support also did not work, bump to 2015.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2927
diff
changeset
|
85 "Please upgrade to Clang, GCC 4.5 or Visual Studio 2015 to see the full sample."); |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
86 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
87 DWTest *window = new DWTest(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
88 DW::Button *button = new DW::Button("Test window"); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
89 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
90 window->PackStart(button, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, TRUE, 0); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
91 button->ConnectClicked(&button_clicked); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
92 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
93 DW::MenuBar *mainmenubar = window->MenuBarNew(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
94 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
95 // add menus to the menubar |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
96 DW::Menu *menu = new DW::Menu(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
97 DW::MenuItem *menuitem = menu->AppendItem("~Quit"); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
98 menuitem->ConnectClicked(&exit_handler); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
99 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
100 // Add the "File" menu to the menubar... |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
101 mainmenubar->AppendItem("~File", menu); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
102 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
103 window->Show(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
104 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
105 app->Main(); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
106 app->Exit(0); |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
107 |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
108 return 0; |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
109 } |
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
110 #else |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
111 class DWTest : public DW::Window |
2861
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
112 { |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
113 private: |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
114 const char *ResolveKeyName(int vk) { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
115 const char *keyname; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
116 switch(vk) { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
117 case VK_LBUTTON : keyname = "VK_LBUTTON"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
118 case VK_RBUTTON : keyname = "VK_RBUTTON"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
119 case VK_CANCEL : keyname = "VK_CANCEL"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
120 case VK_MBUTTON : keyname = "VK_MBUTTON"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
121 case VK_TAB : keyname = "VK_TAB"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
122 case VK_CLEAR : keyname = "VK_CLEAR"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
123 case VK_RETURN : keyname = "VK_RETURN"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
124 case VK_PAUSE : keyname = "VK_PAUSE"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
125 case VK_CAPITAL : keyname = "VK_CAPITAL"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
126 case VK_ESCAPE : keyname = "VK_ESCAPE"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
127 case VK_SPACE : keyname = "VK_SPACE"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
128 case VK_PRIOR : keyname = "VK_PRIOR"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
129 case VK_NEXT : keyname = "VK_NEXT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
130 case VK_END : keyname = "VK_END"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
131 case VK_HOME : keyname = "VK_HOME"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
132 case VK_LEFT : keyname = "VK_LEFT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
133 case VK_UP : keyname = "VK_UP"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
134 case VK_RIGHT : keyname = "VK_RIGHT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
135 case VK_DOWN : keyname = "VK_DOWN"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
136 case VK_SELECT : keyname = "VK_SELECT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
137 case VK_PRINT : keyname = "VK_PRINT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
138 case VK_EXECUTE : keyname = "VK_EXECUTE"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
139 case VK_SNAPSHOT: keyname = "VK_SNAPSHOT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
140 case VK_INSERT : keyname = "VK_INSERT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
141 case VK_DELETE : keyname = "VK_DELETE"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
142 case VK_HELP : keyname = "VK_HELP"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
143 case VK_LWIN : keyname = "VK_LWIN"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
144 case VK_RWIN : keyname = "VK_RWIN"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
145 case VK_NUMPAD0 : keyname = "VK_NUMPAD0"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
146 case VK_NUMPAD1 : keyname = "VK_NUMPAD1"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
147 case VK_NUMPAD2 : keyname = "VK_NUMPAD2"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
148 case VK_NUMPAD3 : keyname = "VK_NUMPAD3"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
149 case VK_NUMPAD4 : keyname = "VK_NUMPAD4"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
150 case VK_NUMPAD5 : keyname = "VK_NUMPAD5"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
151 case VK_NUMPAD6 : keyname = "VK_NUMPAD6"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
152 case VK_NUMPAD7 : keyname = "VK_NUMPAD7"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
153 case VK_NUMPAD8 : keyname = "VK_NUMPAD8"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
154 case VK_NUMPAD9 : keyname = "VK_NUMPAD9"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
155 case VK_MULTIPLY: keyname = "VK_MULTIPLY"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
156 case VK_ADD : keyname = "VK_ADD"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
157 case VK_SEPARATOR: keyname = "VK_SEPARATOR"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
158 case VK_SUBTRACT: keyname = "VK_SUBTRACT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
159 case VK_DECIMAL : keyname = "VK_DECIMAL"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
160 case VK_DIVIDE : keyname = "VK_DIVIDE"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
161 case VK_F1 : keyname = "VK_F1"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
162 case VK_F2 : keyname = "VK_F2"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
163 case VK_F3 : keyname = "VK_F3"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
164 case VK_F4 : keyname = "VK_F4"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
165 case VK_F5 : keyname = "VK_F5"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
166 case VK_F6 : keyname = "VK_F6"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
167 case VK_F7 : keyname = "VK_F7"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
168 case VK_F8 : keyname = "VK_F8"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
169 case VK_F9 : keyname = "VK_F9"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
170 case VK_F10 : keyname = "VK_F10"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
171 case VK_F11 : keyname = "VK_F11"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
172 case VK_F12 : keyname = "VK_F12"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
173 case VK_F13 : keyname = "VK_F13"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
174 case VK_F14 : keyname = "VK_F14"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
175 case VK_F15 : keyname = "VK_F15"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
176 case VK_F16 : keyname = "VK_F16"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
177 case VK_F17 : keyname = "VK_F17"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
178 case VK_F18 : keyname = "VK_F18"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
179 case VK_F19 : keyname = "VK_F19"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
180 case VK_F20 : keyname = "VK_F20"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
181 case VK_F21 : keyname = "VK_F21"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
182 case VK_F22 : keyname = "VK_F22"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
183 case VK_F23 : keyname = "VK_F23"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
184 case VK_F24 : keyname = "VK_F24"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
185 case VK_NUMLOCK : keyname = "VK_NUMLOCK"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
186 case VK_SCROLL : keyname = "VK_SCROLL"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
187 case VK_LSHIFT : keyname = "VK_LSHIFT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
188 case VK_RSHIFT : keyname = "VK_RSHIFT"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
189 case VK_LCONTROL: keyname = "VK_LCONTROL"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
190 case VK_RCONTROL: keyname = "VK_RCONTROL"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
191 default: keyname = "<unknown>"; break; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
192 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
193 return keyname; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
194 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
195 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
196 const char *ResolveKeyModifiers(int mask) { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
197 if((mask & KC_CTRL) && (mask & KC_SHIFT) && (mask & KC_ALT)) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
198 return "KC_CTRL KC_SHIFT KC_ALT"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
199 else if((mask & KC_CTRL) && (mask & KC_SHIFT)) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
200 return "KC_CTRL KC_SHIFT"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
201 else if((mask & KC_CTRL) && (mask & KC_ALT)) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
202 return "KC_CTRL KC_ALT"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
203 else if((mask & KC_SHIFT) && (mask & KC_ALT)) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
204 return "KC_SHIFT KC_ALT"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
205 else if((mask & KC_SHIFT)) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
206 return "KC_SHIFT"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
207 else if((mask & KC_CTRL)) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
208 return "KC_CTRL"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
209 else if((mask & KC_ALT)) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
210 return "KC_ALT"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
211 else return "none"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
212 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
213 |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
214 char *ReadFile(char *filename) { |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
215 char *errors = NULL; |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
216 FILE *fp=NULL; |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
217 #ifdef __ANDROID__ |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
218 int fd = -1; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
219 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
220 // Special way to open for URIs on Android |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
221 if(strstr(filename, "://")) |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
222 { |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
223 fd = dw_file_open(filename, O_RDONLY); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
224 fp = fdopen(fd, "r"); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
225 } |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
226 else |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
227 #endif |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
228 fp = fopen(filename, "r"); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
229 if(!fp) |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
230 errors = strerror(errno); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
231 else |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
232 { |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
233 int i,len; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
234 |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
235 lp = (char **)calloc(1000,sizeof(char *)); |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
236 // should test for out of memory |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
237 max_linewidth=0; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
238 for(i=0; i<1000; i++) |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
239 { |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
240 lp[i] = (char *)calloc(1, 1025); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
241 if (fgets(lp[i], 1024, fp) == NULL) |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
242 break; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
243 len = (int)strlen(lp[i]); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
244 if (len > max_linewidth) |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
245 max_linewidth = len; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
246 if(lp[i][len - 1] == '\n') |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
247 lp[i][len - 1] = '\0'; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
248 } |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
249 num_lines = i; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
250 fclose(fp); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
251 |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
252 hscrollbar->SetRange(max_linewidth, cols); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
253 hscrollbar->SetPos(0); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
254 vscrollbar->SetRange(num_lines, rows); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
255 vscrollbar->SetPos(0); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
256 } |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
257 #ifdef __ANDROID__ |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
258 if(fd != -1) |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
259 close(fd); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
260 #endif |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
261 return errors; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
262 } |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
263 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
264 // When hpm is not NULL we are printing.. so handle things differently |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
265 void DrawFile(int row, int col, int nrows, int fheight, DW::Pixmap *hpm) { |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
266 DW::Pixmap *pixmap = hpm ? hpm : pixmap2; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
267 char buf[16] = {0}; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
268 int i,y,fileline; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
269 char *pLine; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
270 |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
271 if(current_file) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
272 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
273 pixmap->SetForegroundColor(DW_CLR_WHITE); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
274 if(!hpm) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
275 pixmap1->DrawRect(DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)pixmap1->GetWidth(), (int)pixmap1->GetHeight()); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
276 pixmap->DrawRect(DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)pixmap->GetWidth(), (int)pixmap->GetHeight()); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
277 |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
278 for(i = 0;(i < nrows) && (i+row < num_lines); i++) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
279 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
280 fileline = i + row - 1; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
281 y = i*fheight; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
282 pixmap->SetColor(fileline < 0 ? DW_CLR_WHITE : fileline % 16, 1 + (fileline % 15)); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
283 if(!hpm) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
284 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
285 snprintf(buf, 15, "%6.6d", i+row); |
2920
c6b699a441fe
C++: Fix a couple minor errors while attempting to fix Mac crash.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2919
diff
changeset
|
286 pixmap1->DrawText(0, y, buf); |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
287 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
288 pLine = lp[i+row]; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
289 pixmap->DrawText(0, y, pLine+col); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
290 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
291 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
292 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
293 |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
294 // When hpm is not NULL we are printing.. so handle things differently |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
295 void DrawShapes(int direct, DW::Pixmap *hpm) { |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
296 DW::Pixmap *pixmap = hpm ? hpm : pixmap2; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
297 int width = (int)pixmap->GetWidth(), height = (int)pixmap->GetHeight(); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
298 int x[7] = { 20, 180, 180, 230, 180, 180, 20 }; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
299 int y[7] = { 50, 50, 20, 70, 120, 90, 90 }; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
300 DW::Drawable *drawable = direct ? static_cast<DW::Drawable *>(render2) : static_cast<DW::Drawable *>(pixmap); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
301 |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
302 drawable->SetForegroundColor(DW_CLR_WHITE); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
303 drawable->DrawRect(DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, width, height); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
304 drawable->SetForegroundColor(DW_CLR_DARKPINK); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
305 drawable->DrawRect(DW_DRAW_FILL | DW_DRAW_NOAA, 10, 10, width - 20, height - 20); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
306 drawable->SetColor(DW_CLR_GREEN, DW_CLR_DARKRED); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
307 drawable->DrawText(10, 10, "This should be aligned with the edges."); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
308 drawable->SetForegroundColor(DW_CLR_YELLOW); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
309 drawable->DrawLine(width - 10, 10, 10, height - 10); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
310 drawable->SetForegroundColor(DW_CLR_BLUE); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
311 drawable->DrawPolygon(DW_DRAW_FILL, 7, x, y); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
312 drawable->SetForegroundColor(DW_CLR_BLACK); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
313 drawable->DrawRect(DW_DRAW_FILL | DW_DRAW_NOAA, 80, 80, 80, 40); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
314 drawable->SetForegroundColor(DW_CLR_CYAN); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
315 // Bottom right corner |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
316 drawable->DrawArc(0, width - 30, height - 30, width - 10, height - 30, width - 30, height - 10); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
317 // Top right corner |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
318 drawable->DrawArc(0, width - 30, 30, width - 30, 10, width - 10, 30); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
319 // Bottom left corner |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
320 drawable->DrawArc(0, 30, height - 30, 30, height - 10, 10, height - 30); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
321 // Full circle in the left top area |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
322 drawable->DrawArc(DW_DRAW_FULL, 120, 100, 80, 80, 160, 120); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
323 if(image && image->GetHPIXMAP()) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
324 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
325 if(imagestretchcheck->Get()) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
326 drawable->BitBltStretch(0, 10, width - 20, height - 20, image, 0, 0, (int)image->GetWidth(), (int)image->GetHeight()); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
327 else |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
328 drawable->BitBlt(imagexspin->GetPos(), imageyspin->GetPos(), (int)image->GetWidth(), (int)image->GetHeight(), image, 0, 0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
329 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
330 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
331 |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
332 void UpdateRender(void) { |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
333 switch(render_type) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
334 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
335 case SHAPES_DOUBLE_BUFFERED: |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
336 DrawShapes(FALSE, NULL); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
337 break; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
338 case SHAPES_DIRECT: |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
339 DrawShapes(TRUE, NULL); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
340 break; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
341 case DRAW_FILE: |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
342 DrawFile(current_row, current_col, rows, font_height, NULL); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
343 break; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
344 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
345 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
346 |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
347 // Request that the render widgets redraw... |
2938
1184f58135ba
C++: Eliminate remnants of C code I missed while porting to C++.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2935
diff
changeset
|
348 // If not using direct rendering, call UpdateRender() to |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
349 // redraw the in memory pixmaps. Then trigger the expose events. |
2939
ebbc5b16899e
C++: Another couple fixes, context menus and PackAtIndex that got lost during porting.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2938
diff
changeset
|
350 // Expose will call UpdateRender() to draw directly or bitblt the pixmaps. |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
351 void RenderDraw() { |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
352 // If we are double buffered, draw to the pixmaps |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
353 if(render_type != SHAPES_DIRECT) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
354 UpdateRender(); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
355 // Trigger expose event |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
356 render1->Redraw(); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
357 render2->Redraw(); |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
358 } |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
359 |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
360 DW::Menu *ItemContextMenu(DW::StatusText *status_text, const char *text) { |
2929
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
361 DW::Menu *menu = new DW::Menu(); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
362 DW::Menu *submenu = new DW::Menu(); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
363 DW::MenuItem *menuitem = submenu->AppendItem("File", 0L, TRUE); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
364 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
365 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
366 menuitem = submenu->AppendItem("Date", 0L, TRUE); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
367 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
368 menuitem = submenu->AppendItem("Size", 0L, TRUE); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
369 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
370 menuitem = submenu->AppendItem("None", 0L, TRUE); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
371 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
372 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
373 menuitem = submenu->AppendItem("Sort", submenu); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
374 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
375 menuitem = submenu->AppendItem("Make Directory"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
376 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
377 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
378 menuitem = submenu->AppendItem(DW_MENU_SEPARATOR); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
379 menuitem = submenu->AppendItem("Rename Entry"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
380 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
381 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
382 menuitem = submenu->AppendItem("Delete Entry"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
383 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
384 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
385 menuitem = submenu->AppendItem(DW_MENU_SEPARATOR); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
386 menuitem = submenu->AppendItem("View File"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
387 menuitem->ConnectClicked([status_text, text]() -> int { status_text->SetText(text); return TRUE; }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
388 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
389 return menu; |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
390 } |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
391 |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
392 DW::ComboBox *ColorCombobox(void) { |
2930
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
393 DW::ComboBox *combobox = new DW::ComboBox("DW_CLR_DEFAULT"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
394 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
395 combobox->Append("DW_CLR_DEFAULT"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
396 combobox->Append("DW_CLR_BLACK"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
397 combobox->Append("DW_CLR_DARKRED"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
398 combobox->Append("DW_CLR_DARKGREEN"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
399 combobox->Append("DW_CLR_BROWN"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
400 combobox->Append("DW_CLR_DARKBLUE"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
401 combobox->Append("DW_CLR_DARKPINK"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
402 combobox->Append("DW_CLR_DARKCYAN"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
403 combobox->Append("DW_CLR_PALEGRAY"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
404 combobox->Append("DW_CLR_DARKGRAY"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
405 combobox->Append("DW_CLR_RED"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
406 combobox->Append("DW_CLR_GREEN"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
407 combobox->Append("DW_CLR_YELLOW"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
408 combobox->Append("DW_CLR_BLUE"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
409 combobox->Append("DW_CLR_PINK"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
410 combobox->Append("DW_CLR_CYAN"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
411 combobox->Append("DW_CLR_WHITE"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
412 return combobox; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
413 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
414 |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
415 unsigned long ComboboxColor(const char *colortext) { |
2930
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
416 unsigned long color = DW_CLR_DEFAULT; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
417 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
418 if(strcmp(colortext, "DW_CLR_BLACK") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
419 color = DW_CLR_BLACK; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
420 else if(strcmp(colortext, "DW_CLR_DARKRED") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
421 color = DW_CLR_DARKRED; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
422 else if(strcmp(colortext, "DW_CLR_DARKGREEN") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
423 color = DW_CLR_DARKGREEN; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
424 else if(strcmp(colortext, "DW_CLR_BROWN") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
425 color = DW_CLR_BROWN; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
426 else if(strcmp(colortext, "DW_CLR_DARKBLUE") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
427 color = DW_CLR_DARKBLUE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
428 else if(strcmp(colortext, "DW_CLR_DARKPINK") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
429 color = DW_CLR_DARKPINK; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
430 else if(strcmp(colortext, "DW_CLR_DARKCYAN") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
431 color = DW_CLR_DARKCYAN; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
432 else if(strcmp(colortext, "DW_CLR_PALEGRAY") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
433 color = DW_CLR_PALEGRAY; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
434 else if(strcmp(colortext, "DW_CLR_DARKGRAY") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
435 color = DW_CLR_DARKGRAY; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
436 else if(strcmp(colortext, "DW_CLR_RED") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
437 color = DW_CLR_RED; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
438 else if(strcmp(colortext, "DW_CLR_GREEN") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
439 color = DW_CLR_GREEN; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
440 else if(strcmp(colortext, "DW_CLR_YELLOW") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
441 color = DW_CLR_YELLOW; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
442 else if(strcmp(colortext, "DW_CLR_BLUE") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
443 color = DW_CLR_BLUE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
444 else if(strcmp(colortext, "DW_CLR_PINK") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
445 color = DW_CLR_PINK; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
446 else if(strcmp(colortext, "DW_CLR_CYAN") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
447 color = DW_CLR_CYAN; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
448 else if(strcmp(colortext, "DW_CLR_WHITE") == 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
449 color = DW_CLR_WHITE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
450 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
451 return color; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
452 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
453 |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
454 void MLESetFont(DW::MLE *mle, int fontsize, char *fontname) { |
2930
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
455 char font[101] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
456 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
457 if(fontname) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
458 snprintf(font, 100, "%d.%s", fontsize, fontname); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
459 mle->SetFont(fontname ? font : NULL); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
460 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
461 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
462 // Thread and Event functions |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
463 void UpdateMLE(DW::MLE *threadmle, const char *text, DW::Mutex *mutex) { |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
464 static unsigned int pos = 0; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
465 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
466 // Protect pos from being changed by different threads |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
467 if(mutex) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
468 mutex->Lock(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
469 pos = threadmle->Import(text, pos); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
470 threadmle->SetCursor(pos); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
471 if(mutex) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
472 mutex->Unlock(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
473 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
474 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
475 void RunThread(int threadnum, DW::Mutex *mutex, DW::Event *controlevent, DW::Event *workevent, DW::MLE *threadmle) { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
476 char buf[BUF_SIZE+1] = {0}; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
477 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
478 snprintf(buf, BUF_SIZE, "Thread %d started.\r\n", threadnum); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
479 UpdateMLE(threadmle, buf, mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
480 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
481 // Increment the ready count while protected by mutex |
2934
6d3da42f63af
C++: Fix a couple issues reported by GCC 6 on PPC Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2933
diff
changeset
|
482 mutex->Lock(); |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
483 ready++; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
484 // If all 4 threads have incrememted the ready count... |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
485 // Post the control event semaphore so things will get started. |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
486 if(ready == 4) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
487 controlevent->Post(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
488 mutex->Unlock(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
489 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
490 while(!finished) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
491 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
492 int result = workevent->Wait(2000); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
493 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
494 if(result == DW_ERROR_TIMEOUT) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
495 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
496 snprintf(buf, BUF_SIZE, "Thread %d timeout waiting for event.\r\n", threadnum); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
497 UpdateMLE(threadmle, buf, mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
498 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
499 else if(result == DW_ERROR_NONE) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
500 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
501 snprintf(buf, BUF_SIZE, "Thread %d doing some work.\r\n", threadnum); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
502 UpdateMLE(threadmle, buf, mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
503 // Pretend to do some work |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
504 app->MainSleep(1000 * threadnum); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
505 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
506 // Increment the ready count while protected by mutex |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
507 mutex->Lock(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
508 ready++; |
2938
1184f58135ba
C++: Eliminate remnants of C code I missed while porting to C++.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2935
diff
changeset
|
509 snprintf(buf, BUF_SIZE, "Thread %d work done. ready=%d", threadnum, ready); |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
510 // If all 4 threads have incrememted the ready count... |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
511 // Post the control event semaphore so things will get started. |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
512 if(ready == 4) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
513 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
514 controlevent->Post(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
515 strcat(buf, " Control posted."); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
516 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
517 mutex->Unlock(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
518 strcat(buf, "\r\n"); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
519 UpdateMLE(threadmle, buf, mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
520 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
521 else |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
522 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
523 snprintf(buf, BUF_SIZE, "Thread %d error %d.\r\n", threadnum, result); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
524 UpdateMLE(threadmle, buf, mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
525 app->MainSleep(10000); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
526 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
527 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
528 snprintf(buf, BUF_SIZE, "Thread %d finished.\r\n", threadnum); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
529 UpdateMLE(threadmle, buf, mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
530 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
531 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
532 void ControlThread(DW::Mutex *mutex, DW::Event *controlevent, DW::Event *workevent, DW::MLE *threadmle) { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
533 int inprogress = 5; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
534 char buf[BUF_SIZE+1] = {0}; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
535 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
536 while(inprogress) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
537 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
538 int result = controlevent->Wait(2000); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
539 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
540 if(result == DW_ERROR_TIMEOUT) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
541 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
542 UpdateMLE(threadmle, "Control thread timeout waiting for event.\r\n", mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
543 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
544 else if(result == DW_ERROR_NONE) |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
545 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
546 // Reset the control event |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
547 controlevent->Reset(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
548 ready = 0; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
549 snprintf(buf, BUF_SIZE, "Control thread starting worker threads. Inprogress=%d\r\n", inprogress); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
550 UpdateMLE(threadmle, buf, mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
551 // Start the work threads |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
552 workevent->Post(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
553 app->MainSleep(100); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
554 // Reset the work event |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
555 workevent->Reset(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
556 inprogress--; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
557 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
558 else |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
559 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
560 snprintf(buf, BUF_SIZE, "Control thread error %d.\r\n", result); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
561 UpdateMLE(threadmle, buf, mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
562 app->MainSleep(10000); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
563 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
564 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
565 // Tell the other threads we are done |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
566 finished = TRUE; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
567 workevent->Post(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
568 // Close the control event |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
569 controlevent->Close(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
570 UpdateMLE(threadmle, "Control thread finished.\r\n", mutex); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
571 } |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
572 |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
573 // Add the menus to the window |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
574 void CreateMenus() { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
575 // Setup the menu |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
576 DW::MenuBar *menubar = this->MenuBarNew(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
577 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
578 // add menus to the menubar |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
579 DW::Menu *menu = new DW::Menu(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
580 DW::MenuItem *menuitem = menu->AppendItem("~Quit"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
581 menuitem->ConnectClicked([this] () -> int |
2915
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
582 { |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
583 if(this->app->MessageBox(APP_TITLE, DW_MB_YESNO | DW_MB_QUESTION, APP_EXIT) != 0) { |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
584 this->app->MainQuit(); |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
585 } |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
586 return TRUE; |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
587 }); |
2889
4b075e64536c
C++: Add some simple menu code to see if things are working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2883
diff
changeset
|
588 |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
589 // Add the "File" menu to the menubar... |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
590 menubar->AppendItem("~File", menu); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
591 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
592 menu = new DW::Menu(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
593 DW::MenuItem *checkable_menuitem = menu->AppendItem("~Checkable Menu Item", 0, TRUE); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
594 checkable_menuitem->ConnectClicked([this]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
595 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
596 this->app->MessageBox("Menu Item Callback", DW_MB_OK | DW_MB_INFORMATION, "\"Checkable Menu Item\" selected"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
597 return FALSE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
598 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
599 DW::MenuItem *noncheckable_menuitem = menu->AppendItem("~Non-Checkable Menu Item"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
600 noncheckable_menuitem->ConnectClicked([this]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
601 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
602 this->app->MessageBox("Menu Item Callback", DW_MB_OK | DW_MB_INFORMATION, "\"Non-Checkable Menu Item\" selected"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
603 return FALSE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
604 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
605 menuitem = menu->AppendItem("~Disabled menu Item", DW_MIS_DISABLED|DW_MIS_CHECKED, TRUE); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
606 // separator |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
607 menuitem = menu->AppendItem(DW_MENU_SEPARATOR); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
608 menuitem = menu->AppendItem("~Menu Items Disabled", 0, TRUE); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
609 menuitem->ConnectClicked([this, checkable_menuitem, noncheckable_menuitem]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
610 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
611 // Toggle the variable |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
612 this->menu_enabled = !this->menu_enabled; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
613 // Set the ENABLED/DISABLED state on the menu items |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
614 checkable_menuitem->SetStyle(menu_enabled ? DW_MIS_ENABLED : DW_MIS_DISABLED); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
615 noncheckable_menuitem->SetStyle(menu_enabled ? DW_MIS_ENABLED : DW_MIS_DISABLED); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
616 return FALSE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
617 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
618 // Add the "Menu" menu to the menubar... |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
619 menubar->AppendItem("~Menu", menu); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
620 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
621 menu = new DW::Menu(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
622 menuitem = menu->AppendItem("~About"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
623 menuitem->ConnectClicked([this]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
624 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
625 DWEnv env; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
626 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
627 this->app->GetEnvironment(&env); |
2915
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
628 this->app->MessageBox("About dwindows", DW_MB_OK | DW_MB_INFORMATION, |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
629 "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d\n\nHTML: %s\n\ndwindows Version: %d.%d.%d\n\nScreen: %dx%d %dbpp", |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
630 env.osName, env.buildDate, env.buildTime, |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
631 env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild, |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
632 env.htmlEngine, |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
633 env.DWMajorVersion, env.DWMinorVersion, env.DWSubVersion, |
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
634 this->app->GetScreenWidth(), this->app->GetScreenHeight(), this->app->GetColorDepth()); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
635 return FALSE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
636 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
637 // Add the "Help" menu to the menubar... |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
638 menubar->AppendItem("~Help", menu); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
639 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
640 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
641 // Notebook page 1 |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
642 void CreateInput(DW::Box *notebookbox) { |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
643 DW::Box *lbbox = new DW::Box(DW_VERT, 10); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
644 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
645 notebookbox->PackStart(lbbox, 150, 70, TRUE, TRUE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
646 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
647 // Copy and Paste |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
648 DW::Box *browsebox = new DW::Box(DW_HORZ, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
649 lbbox->PackStart(browsebox, 0, 0, FALSE, FALSE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
650 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
651 DW::Entryfield *copypastefield = new DW::Entryfield(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
652 copypastefield->SetLimit(260); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
653 browsebox->PackStart(copypastefield, TRUE, FALSE, 4); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
654 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
655 DW::Button *copybutton = new DW::Button("Copy"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
656 browsebox->PackStart(copybutton, FALSE, FALSE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
657 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
658 DW::Button *pastebutton = new DW::Button("Paste"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
659 browsebox->PackStart(pastebutton, FALSE, FALSE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
660 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
661 // Archive Name |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
662 DW::Text *stext = new DW::Text("File to browse"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
663 stext->SetStyle(DW_DT_VCENTER); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
664 lbbox->PackStart(stext, 130, 15, TRUE, TRUE, 2); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
665 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
666 browsebox = new DW::Box(DW_HORZ, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
667 lbbox->PackStart(browsebox, 0, 0, TRUE, TRUE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
668 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
669 DW::Entryfield *entryfield = new DW::Entryfield(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
670 entryfield->SetLimit(260); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
671 browsebox->PackStart(entryfield, 100, 15, TRUE, TRUE, 4); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
672 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
673 DW::Button *browsefilebutton = new DW::Button("Browse File"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
674 browsebox->PackStart(browsefilebutton, 40, 15, TRUE, TRUE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
675 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
676 DW::Button *browsefolderbutton = new DW::Button("Browse Folder"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
677 browsebox->PackStart(browsefolderbutton, 40, 15, TRUE, TRUE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
678 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
679 browsebox->SetColor(DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
680 stext->SetColor(DW_CLR_BLACK, DW_CLR_PALEGRAY); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
681 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
682 // Buttons |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
683 DW::Box *buttonbox = new DW::Box(DW_HORZ, 10); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
684 lbbox->PackStart(buttonbox, 0, 0, TRUE, TRUE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
685 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
686 DW::Button *cancelbutton = new DW::Button("Exit"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
687 buttonbox->PackStart(cancelbutton, 130, 30, TRUE, TRUE, 2); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
688 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
689 DW::Button *cursortogglebutton = new DW::Button("Set Cursor pointer - CLOCK"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
690 buttonbox->PackStart(cursortogglebutton, 130, 30, TRUE, TRUE, 2); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
691 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
692 DW::Button *okbutton = new DW::Button("Turn Off Annoying Beep!"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
693 buttonbox->PackStart(okbutton, 130, 30, TRUE, TRUE, 2); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
694 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
695 cancelbutton->Unpack(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
696 buttonbox->PackStart(cancelbutton, 130, 30, TRUE, TRUE, 2); |
2939
ebbc5b16899e
C++: Another couple fixes, context menus and PackAtIndex that got lost during porting.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2938
diff
changeset
|
697 this->ClickDefault(cancelbutton); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
698 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
699 DW::Button *colorchoosebutton = new DW::Button("Color Chooser Dialog"); |
2939
ebbc5b16899e
C++: Another couple fixes, context menus and PackAtIndex that got lost during porting.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2938
diff
changeset
|
700 buttonbox->PackAtIndex(colorchoosebutton, 1, 130, 30, TRUE, TRUE, 2); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
701 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
702 // Set some nice fonts and colors |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
703 lbbox->SetColor(DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
704 buttonbox->SetColor(DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
705 okbutton->SetColor(DW_CLR_PALEGRAY, DW_CLR_DARKCYAN); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
706 #ifdef COLOR_DEBUG |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
707 copypastefield->SetColor(DW_CLR_WHITE, DW_CLR_RED); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
708 copybutton->SetColor(DW_CLR_WHITE, DW_CLR_RED); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
709 // Set a color then clear it to make sure it clears correctly |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
710 entryfield->SetColor(DW_CLR_WHITE, DW_CLR_RED); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
711 entryfield->SetColor(DW_CLR_DEFAULT, DW_CLR_DEFAULT); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
712 // Set a color then clear it to make sure it clears correctly... again |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
713 pastebutton->SetColor(DW_CLR_WHITE, DW_CLR_RED); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
714 pastebutton->SetColor(DW_CLR_DEFAULT, DW_CLR_DEFAULT); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
715 #endif |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
716 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
717 // Connect signals |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
718 browsefilebutton->ConnectClicked([this, entryfield, copypastefield]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
719 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
720 char *tmp = this->app->FileBrowse("Pick a file", "dwtest.c", "c", DW_FILE_OPEN); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
721 if(tmp) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
722 { |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
723 char *errors = ReadFile(tmp); |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
724 const char *title = "New file load"; |
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
725 const char *image = "image/test.png"; |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
726 DW::Notification *notification; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
727 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
728 if(errors) |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
729 notification = new DW::Notification(title, image, APP_TITLE " failed to load the file into the file browser."); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
730 else |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
731 notification = new DW::Notification(title, image, APP_TITLE " loaded the file into the file browser on the Render tab, with \"File Display\" selected from the drop down list."); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
732 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
733 if(current_file) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
734 this->app->Free(current_file); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
735 current_file = tmp; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
736 entryfield->SetText(current_file); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
737 current_col = current_row = 0; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
738 |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
739 RenderDraw(); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
740 notification->ConnectClicked([this]() -> int { |
2916
fe43f8667d3d
C++: Implement Notification class, and enable dwtestoo code that relied on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2915
diff
changeset
|
741 this->app->Debug("Notification clicked\n"); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
742 return TRUE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
743 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
744 notification->Send(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
745 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
746 copypastefield->SetFocus(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
747 return FALSE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
748 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
749 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
750 browsefolderbutton->ConnectClicked([this]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
751 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
752 char *tmp = this->app->FileBrowse("Pick a folder", ".", "c", DW_DIRECTORY_OPEN); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
753 this->app->Debug("Folder picked: %s\n", tmp ? tmp : "None"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
754 return FALSE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
755 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
756 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
757 copybutton->ConnectClicked([this, copypastefield, entryfield]() -> int { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
758 char *test = copypastefield->GetText(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
759 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
760 if(test) { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
761 this->app->SetClipboard(test); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
762 this->app->Free(test); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
763 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
764 entryfield->SetFocus(); |
2882
99311a9091af
C++: Add lambda support via Connect functions on C++11, on older compilers
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2873
diff
changeset
|
765 return TRUE; |
99311a9091af
C++: Add lambda support via Connect functions on C++11, on older compilers
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2873
diff
changeset
|
766 }); |
2889
4b075e64536c
C++: Add some simple menu code to see if things are working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2883
diff
changeset
|
767 |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
768 pastebutton->ConnectClicked([this, copypastefield]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
769 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
770 char *test = this->app->GetClipboard(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
771 if(test) { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
772 copypastefield->SetText(test); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
773 this->app->Free(test); |
2889
4b075e64536c
C++: Add some simple menu code to see if things are working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2883
diff
changeset
|
774 } |
4b075e64536c
C++: Add some simple menu code to see if things are working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2883
diff
changeset
|
775 return TRUE; |
4b075e64536c
C++: Add some simple menu code to see if things are working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2883
diff
changeset
|
776 }); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
777 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
778 okbutton->ConnectClicked([this]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
779 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
780 if(this->timer) { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
781 delete this->timer; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
782 this->timer = DW_NULL; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
783 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
784 return TRUE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
785 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
786 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
787 cancelbutton->ConnectClicked([this] () -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
788 { |
2915
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
789 if(this->app->MessageBox(APP_TITLE, DW_MB_YESNO | DW_MB_QUESTION, APP_EXIT) != 0) { |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
790 this->app->MainQuit(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
791 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
792 return TRUE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
793 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
794 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
795 cursortogglebutton->ConnectClicked([this, cursortogglebutton] () -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
796 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
797 cursortogglebutton->SetText(this->cursor_arrow ? "Set Cursor pointer - ARROW" : |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
798 "Set Cursor pointer - CLOCK"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
799 this->SetPointer(this->cursor_arrow ? DW_POINTER_CLOCK : DW_POINTER_DEFAULT); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
800 this->cursor_arrow = !this->cursor_arrow; |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
801 return FALSE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
802 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
803 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
804 colorchoosebutton->ConnectClicked([this]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
805 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
806 this->current_color = this->app->ColorChoose(this->current_color); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
807 return FALSE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
808 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
809 } |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
810 |
2929
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
811 // Notebook page 2 |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
812 void CreateRender(DW::Box *notebookbox) { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
813 int vscrollbarwidth, hscrollbarheight; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
814 wchar_t widestring[100] = L"DWTest Wide"; |
2938
1184f58135ba
C++: Eliminate remnants of C code I missed while porting to C++.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2935
diff
changeset
|
815 char *utf8string = app->WideToUTF8(widestring); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
816 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
817 // create a box to pack into the notebook page |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
818 DW::Box *pagebox = new DW::Box(DW_HORZ, 2); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
819 notebookbox->PackStart(pagebox, 0, 0, TRUE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
820 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
821 // now a status area under this box |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
822 DW::Box *hbox = new DW::Box(DW_HORZ, 1); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
823 notebookbox->PackStart(hbox, 100, 20, TRUE, FALSE, 1); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
824 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
825 DW::StatusText *status1 = new DW::StatusText(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
826 hbox->PackStart(status1, 100, DW_SIZE_AUTO, TRUE, FALSE, 1); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
827 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
828 DW::StatusText *status2 = new DW::StatusText(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
829 hbox->PackStart(status2, 100, DW_SIZE_AUTO, TRUE, FALSE, 1); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
830 // a box with combobox and button |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
831 hbox = new DW::Box(DW_HORZ, 1 ); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
832 notebookbox->PackStart(hbox, 100, 25, TRUE, FALSE, 1); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
833 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
834 DW::ComboBox *rendcombo = new DW::ComboBox( "Shapes Double Buffered"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
835 hbox->PackStart(rendcombo, 80, 25, TRUE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
836 rendcombo->Append("Shapes Double Buffered"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
837 rendcombo->Append("Shapes Direct"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
838 rendcombo->Append("File Display"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
839 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
840 DW::Text *label = new DW::Text("Image X:"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
841 label->SetStyle(DW_DT_VCENTER | DW_DT_CENTER); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
842 hbox->PackStart(label, DW_SIZE_AUTO, 25, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
843 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
844 imagexspin = new DW::SpinButton("20"); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
845 hbox->PackStart(imagexspin, 25, 25, TRUE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
846 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
847 label = new DW::Text("Y:"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
848 label->SetStyle(DW_DT_VCENTER | DW_DT_CENTER); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
849 hbox->PackStart(label, DW_SIZE_AUTO, 25, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
850 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
851 imageyspin = new DW::SpinButton("20"); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
852 hbox->PackStart(imageyspin, 25, 25, TRUE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
853 imagexspin->SetLimits(2000, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
854 imageyspin->SetLimits(2000, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
855 imagexspin->SetPos(20); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
856 imageyspin->SetPos(20); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
857 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
858 imagestretchcheck = new DW::CheckBox("Stretch"); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
859 hbox->PackStart(imagestretchcheck, DW_SIZE_AUTO, 25, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
860 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
861 DW::Button *refreshbutton = new DW::Button("Refresh"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
862 hbox->PackStart(refreshbutton, DW_SIZE_AUTO, 25, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
863 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
864 DW::Button *printbutton = new DW::Button("Print"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
865 hbox->PackStart(printbutton, DW_SIZE_AUTO, 25, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
866 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
867 // Pre-create the scrollbars so we can query their sizes |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
868 vscrollbar = new DW::ScrollBar(DW_VERT, 50); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
869 hscrollbar = new DW::ScrollBar(DW_HORZ, 50); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
870 vscrollbar->GetPreferredSize(&vscrollbarwidth, NULL); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
871 hscrollbar->GetPreferredSize(NULL, &hscrollbarheight); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
872 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
873 // On GTK with overlay scrollbars enabled this returns us 0... |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
874 // so in that case we need to give it some real values. |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
875 if(!vscrollbarwidth) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
876 vscrollbarwidth = 8; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
877 if(!hscrollbarheight) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
878 hscrollbarheight = 8; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
879 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
880 // Create render box for line number pixmap |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
881 render1 = new DW::Render(); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
882 render1->SetFont(FIXEDFONT); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
883 render1->GetTextExtents("(g", &font_width, &font_height); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
884 font_width = font_width / 2; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
885 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
886 DW::Box *vscrollbox = new DW::Box(DW_VERT, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
887 vscrollbox->PackStart(render1, font_width*width1, font_height*rows, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
888 vscrollbox->PackStart(DW_NOHWND, (font_width*(width1+1)), hscrollbarheight, FALSE, FALSE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
889 pagebox->PackStart(vscrollbox, 0, 0, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
890 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
891 // pack empty space 1 character wide |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
892 pagebox->PackStart(DW_NOHWND, font_width, 0, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
893 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
894 // create box for filecontents and horz scrollbar |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
895 DW::Box *textbox = new DW::Box(DW_VERT,0 ); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
896 pagebox->PackStart(textbox, 0, 0, TRUE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
897 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
898 // create render box for filecontents pixmap |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
899 render2 = new DW::Render(); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
900 textbox->PackStart(render2, 10, 10, TRUE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
901 render2->SetFont(FIXEDFONT); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
902 // create horizonal scrollbar |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
903 textbox->PackStart(hscrollbar, TRUE, FALSE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
904 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
905 // create vertical scrollbar |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
906 vscrollbox = new DW::Box(DW_VERT, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
907 vscrollbox->PackStart(vscrollbar, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
908 // Pack an area of empty space of the scrollbar dimensions |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
909 vscrollbox->PackStart(DW_NOHWND, vscrollbarwidth, hscrollbarheight, FALSE, FALSE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
910 pagebox->PackStart(vscrollbox, 0, 0, FALSE, TRUE, 0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
911 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
912 pixmap1 = new DW::Pixmap(render1, font_width*width1, font_height*rows); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
913 pixmap2 = new DW::Pixmap(render2, font_width*cols, font_height*rows); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
914 image = new DW::Pixmap(render1, "image/test"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
915 if(!image || !image->GetHPIXMAP()) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
916 image = new DW::Pixmap(render1, "~/test"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
917 if(!image || !image->GetHPIXMAP()) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
918 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
919 char *appdir = app->GetDir(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
920 char pathbuff[1025] = {0}; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
921 int pos = (int)strlen(appdir); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
922 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
923 strncpy(pathbuff, appdir, 1024); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
924 pathbuff[pos] = DW_DIR_SEPARATOR; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
925 pos++; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
926 strncpy(&pathbuff[pos], "test", 1024-pos); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
927 image = new DW::Pixmap(render1, pathbuff); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
928 } |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
929 if(image) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
930 image->SetTransparentColor(DW_CLR_WHITE); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
931 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
932 app->MessageBox(utf8string ? utf8string : "DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
933 if(utf8string) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
934 app->Free(utf8string); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
935 pixmap1->DrawRect(DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, font_width*width1, font_height*rows); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
936 pixmap2->DrawRect(DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, font_width*cols, font_height*rows); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
937 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
938 // Signal handler lambdas |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
939 render1->ConnectButtonPress([this](int x, int y, int buttonmask) -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
940 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
941 DW::Menu *menu = new DW::Menu(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
942 DW::MenuItem *menuitem = menu->AppendItem("~Quit"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
943 long px, py; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
944 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
945 menuitem->ConnectClicked([this] () -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
946 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
947 if(this->app->MessageBox(APP_TITLE, DW_MB_YESNO | DW_MB_QUESTION, APP_EXIT) != 0) { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
948 this->app->MainQuit(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
949 } |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
950 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
951 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
952 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
953 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
954 menu->AppendItem(DW_MENU_SEPARATOR); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
955 menuitem = menu->AppendItem("~Show Window"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
956 menuitem->ConnectClicked([this]() -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
957 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
958 this->Show(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
959 this->Raise(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
960 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
961 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
962 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
963 this->app->GetPointerPos(&px, &py); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
964 menu->Popup(this, (int)px, (int)py); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
965 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
966 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
967 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
968 render1->ConnectExpose([this](DWExpose *exp) -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
969 { |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
970 if(render_type != SHAPES_DIRECT) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
971 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
972 this->render1->BitBlt(0, 0, (int)pixmap1->GetWidth(), (int)pixmap1->GetHeight(), pixmap1, 0, 0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
973 render1->Flush(); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
974 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
975 else |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
976 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
977 UpdateRender(); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
978 } |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
979 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
980 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
981 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
982 render2->ConnectExpose([this](DWExpose *exp) -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
983 { |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
984 if(render_type != SHAPES_DIRECT) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
985 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
986 this->render2->BitBlt(0, 0, (int)pixmap2->GetWidth(), (int)pixmap2->GetHeight(), pixmap2, 0, 0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
987 render2->Flush(); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
988 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
989 else |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
990 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
991 UpdateRender(); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
992 } |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
993 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
994 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
995 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
996 render2->ConnectKeyPress([this, status1](char ch, int vk, int state, char *utf8) -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
997 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
998 char tmpbuf[101] = {0}; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
999 if(ch) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1000 snprintf(tmpbuf, 100, "Key: %c(%d) Modifiers: %s(%d) utf8 %s", ch, ch, this->ResolveKeyModifiers(state), state, utf8); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1001 else |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1002 snprintf(tmpbuf, 100, "Key: %s(%d) Modifiers: %s(%d) utf8 %s", this->ResolveKeyName(vk), vk, ResolveKeyModifiers(state), state, utf8); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1003 status1->SetText(tmpbuf); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1004 return FALSE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1005 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1006 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1007 hscrollbar->ConnectValueChanged([this, status1](int value) -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1008 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1009 char tmpbuf[101] = {0}; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1010 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1011 this->current_col = value; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1012 snprintf(tmpbuf, 100, "Row:%d Col:%d Lines:%d Cols:%d", current_row,current_col,num_lines,max_linewidth); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1013 status1->SetText(tmpbuf); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1014 this->RenderDraw(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1015 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1016 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1017 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1018 vscrollbar->ConnectValueChanged([this, status1](int value) -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1019 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1020 char tmpbuf[101] = {0}; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1021 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1022 this->current_row = value; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1023 snprintf(tmpbuf, 100, "Row:%d Col:%d Lines:%d Cols:%d", current_row,current_col,num_lines,max_linewidth); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1024 status1->SetText(tmpbuf); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1025 this->RenderDraw(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1026 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1027 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1028 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1029 render2->ConnectMotionNotify([status2](int x, int y, int buttonmask) -> int |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1030 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1031 char buf[201] = {0}; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1032 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1033 snprintf(buf, 200, "motion_notify: %dx%d buttons %d", x, y, buttonmask); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1034 status2->SetText(buf); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1035 return FALSE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1036 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1037 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1038 render2->ConnectButtonPress([status2](int x, int y, int buttonmask) -> int |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1039 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1040 char buf[201] = {0}; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1041 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1042 snprintf(buf, 200, "button_press: %dx%d buttons %d", x, y, buttonmask); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1043 status2->SetText(buf); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1044 return FALSE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1045 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1046 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1047 render2->ConnectConfigure([this](int width, int height) -> int |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1048 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1049 DW::Pixmap *old1 = this->pixmap1, *old2 = this->pixmap2; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1050 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1051 rows = height / font_height; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1052 cols = width / font_width; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1053 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1054 // Create new pixmaps with the current sizes |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1055 this->pixmap1 = new DW::Pixmap(this->render1, (unsigned long)(font_width*(width1)), (unsigned long)height); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1056 this->pixmap2 = new DW::Pixmap(this->render2, (unsigned long)width, (unsigned long)height); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1057 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1058 // Make sure the side area is cleared |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1059 this->pixmap1->SetForegroundColor(DW_CLR_WHITE); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1060 this->pixmap1->DrawRect(DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)this->pixmap1->GetWidth(), (int)this->pixmap1->GetHeight()); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1061 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1062 // Destroy the old pixmaps |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1063 delete old1; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1064 delete old2; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1065 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1066 // Update scrollbar ranges with new values |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1067 this->hscrollbar->SetRange(max_linewidth, cols); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1068 this->vscrollbar->SetRange(num_lines, rows); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1069 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1070 // Redraw the render widgets |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1071 this->RenderDraw(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1072 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1073 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1074 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1075 imagestretchcheck->ConnectClicked([this]() -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1076 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1077 this->RenderDraw(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1078 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1079 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1080 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1081 refreshbutton->ConnectClicked([this]() -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1082 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1083 this->RenderDraw(); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1084 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1085 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1086 |
2921
235fef840df2
C++: Implement Print class and enable the print code in dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2920
diff
changeset
|
1087 printbutton->ConnectClicked([this]() -> int |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1088 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1089 DW::Print *print = new DW::Print("DWTest Job", 0, 2, [this](DW::Pixmap *pixmap, int page_num) -> int |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1090 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1091 pixmap->SetFont(FIXEDFONT); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1092 if(page_num == 0) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1093 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1094 this->DrawShapes(FALSE, pixmap); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1095 } |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1096 else if(page_num == 1) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1097 { |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1098 // Get the font size for this printer context... |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1099 int fheight, fwidth; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1100 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1101 // If we have a file to display... |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1102 if(current_file) |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1103 { |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1104 int nrows; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1105 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1106 // Calculate new dimensions |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1107 pixmap->GetTextExtents("(g", NULL, &fheight); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1108 nrows = (int)(pixmap->GetHeight() / fheight); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1109 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1110 // Do the actual drawing |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1111 this->DrawFile(0, 0, nrows, fheight, pixmap); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1112 } |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1113 else |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1114 { |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1115 // We don't have a file so center an error message on the page |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1116 const char *text = "No file currently selected!"; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1117 int posx, posy; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1118 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1119 pixmap->GetTextExtents(text, &fwidth, &fheight); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1120 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1121 posx = (int)(pixmap->GetWidth() - fwidth)/2; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1122 posy = (int)(pixmap->GetHeight() - fheight)/2; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1123 |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1124 pixmap->SetColor(DW_CLR_BLACK, DW_CLR_WHITE); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1125 pixmap->DrawText(posx, posy, text); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1126 } |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1127 } |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1128 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1129 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1130 print->Run(0); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1131 return TRUE; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1132 }); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1133 |
2930
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1134 rendcombo->ConnectListSelect([this](unsigned int index) -> int |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1135 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1136 if(index != this->render_type) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1137 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1138 if(index == DRAW_FILE) |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1139 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1140 this->hscrollbar->SetRange(max_linewidth, cols); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1141 this->hscrollbar->SetPos(0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1142 this->vscrollbar->SetRange(num_lines, rows); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1143 this->vscrollbar->SetPos(0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1144 this->current_col = this->current_row = 0; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1145 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1146 else |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1147 { |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1148 this->hscrollbar->SetRange(0, 0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1149 this->hscrollbar->SetPos(0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1150 this->vscrollbar->SetRange(0, 0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1151 this->vscrollbar->SetPos(0); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1152 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1153 this->render_type = index; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1154 this->RenderDraw(); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1155 } |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1156 return FALSE; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1157 }); |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1158 |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1159 app->TaskBarInsert(render1, fileicon, "DWTest"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1160 } |
2929
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1161 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1162 // Notebook page 3 |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
1163 void CreateTree(DW::Box *notebookbox) { |
2929
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1164 // create a box to pack into the notebook page |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1165 DW::ListBox *listbox = new DW::ListBox(TRUE); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1166 notebookbox->PackStart(listbox, 500, 200, TRUE, TRUE, 0); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1167 listbox->Append("Test 1"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1168 listbox->Append("Test 2"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1169 listbox->Append("Test 3"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1170 listbox->Append("Test 4"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1171 listbox->Append("Test 5"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1172 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1173 // now a tree area under this box |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1174 DW::Tree *tree = new DW::Tree(); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1175 if(tree->GetHWND()) |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1176 { |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1177 notebookbox->PackStart(tree, 500, 200, TRUE, TRUE, 1); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1178 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1179 // and a status area to see whats going on |
2929
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1180 DW::StatusText *tree_status = new DW::StatusText(); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1181 notebookbox->PackStart(tree_status, 100, DW_SIZE_AUTO, TRUE, FALSE, 1); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1182 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1183 // set up our signal trappers... |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1184 tree->ConnectItemContext([this, tree_status](char *text, int x, int y, void *data) -> int |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1185 { |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1186 char buf[201] = {0}; |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1187 DW::Menu *popupmenu = ItemContextMenu(tree_status, "Item context menu clicked."); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1188 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1189 snprintf(buf, 200, "DW_SIGNAL_ITEM_CONTEXT: Text: %s x: %d y: %d", text, x, y); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1190 tree_status->SetText(buf); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1191 popupmenu->Popup(this, x, y); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1192 return FALSE; |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1193 }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1194 tree->ConnectItemSelect([tree_status](HTREEITEM item, char *text, void *itemdata) |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1195 { |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1196 char buf[201] = {0}; |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1197 |
2930
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1198 snprintf(buf, 200, "DW_SIGNAL_ITEM_SELECT:Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata)); |
2929
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1199 tree_status->SetText(buf); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1200 return FALSE; |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1201 }); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1202 |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1203 HTREEITEM t1 = tree->Insert("tree folder 1", foldericon, DW_NULL, DW_INT_TO_POINTER(1)); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1204 HTREEITEM t2 = tree->Insert("tree folder 2", foldericon, DW_NULL, DW_INT_TO_POINTER(2)); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1205 tree->Insert("tree file 1", fileicon, t1, DW_INT_TO_POINTER(3)); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1206 tree->Insert("tree file 2", fileicon, t1, DW_INT_TO_POINTER(4)); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1207 tree->Insert("tree file 3", fileicon, t2, DW_INT_TO_POINTER(5)); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1208 tree->Insert("tree file 4", fileicon, t2, DW_INT_TO_POINTER(6)); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1209 tree->Change(t1, "tree folder 1", foldericon); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1210 tree->Change(t2, "tree folder 2", foldericon); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1211 tree->SetData(t2, DW_INT_TO_POINTER(100)); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1212 tree->Expand(t1); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1213 char *title = tree->GetTitle(t1); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1214 this->app->Debug("t1 title \"%s\" data %d t2 data %d\n", title, DW_POINTER_TO_INT(tree->GetData(t1)), |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1215 DW_POINTER_TO_INT(tree->GetData(t2))); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1216 this->app->Free(title); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1217 } |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1218 else |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1219 { |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1220 DW::Text *text = new DW::Text("Tree widget not available."); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1221 notebookbox->PackStart(text, 500, 200, TRUE, TRUE, 1); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1222 } |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1223 } |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1224 |
2930
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1225 // Page 4 - Container |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
1226 void CreateContainer(DW::Box *notebookbox) { |
2930
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1227 char buffer[101] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1228 CTIME time; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1229 CDATE date; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1230 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1231 // create a box to pack into the notebook page |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1232 DW::Box *containerbox = new DW::Box(DW_HORZ, 2); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1233 notebookbox->PackStart(containerbox, 500, 200, TRUE, TRUE, 0); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1234 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1235 // Add a word wrap checkbox |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1236 DW::Box *hbox = new DW::Box(DW_HORZ, 0); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1237 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1238 DW::CheckBox *checkbox = new DW::CheckBox("Word wrap"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1239 hbox->PackStart(checkbox, FALSE, TRUE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1240 DW::Text *text = new DW::Text("Foreground:"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1241 text->SetStyle(DW_DT_VCENTER); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1242 hbox->PackStart(text, FALSE, TRUE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1243 DW::ComboBox *mlefore = ColorCombobox(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1244 hbox->PackStart(mlefore, 150, DW_SIZE_AUTO, TRUE, FALSE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1245 text = new DW::Text("Background:"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1246 text->SetStyle(DW_DT_VCENTER); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1247 hbox->PackStart(text, FALSE, TRUE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1248 DW::ComboBox *mleback = ColorCombobox(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1249 hbox->PackStart(mleback, 150, DW_SIZE_AUTO, TRUE, FALSE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1250 checkbox->Set(TRUE); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1251 text = new DW::Text("Font:"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1252 text->SetStyle(DW_DT_VCENTER); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1253 hbox->PackStart(text, FALSE, TRUE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1254 DW::SpinButton *fontsize = new DW::SpinButton("9"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1255 hbox->PackStart(fontsize, FALSE, FALSE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1256 fontsize->SetLimits(100, 5); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1257 fontsize->SetPos(9); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1258 DW::ComboBox *fontname = new DW::ComboBox("Default"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1259 fontname->Append("Default"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1260 fontname->Append("Arial"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1261 fontname->Append("Geneva"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1262 fontname->Append("Verdana"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1263 fontname->Append("Helvetica"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1264 fontname->Append("DejaVu Sans"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1265 fontname->Append("Times New Roman"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1266 fontname->Append("Times New Roman Bold"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1267 fontname->Append("Times New Roman Italic"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1268 fontname->Append("Times New Roman Bold Italic"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1269 hbox->PackStart(fontname, 150, DW_SIZE_AUTO, TRUE, FALSE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1270 notebookbox->PackStart(hbox, TRUE, FALSE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1271 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1272 // now a container area under this box |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1273 DW::Filesystem *container = new DW::Filesystem(TRUE); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1274 notebookbox->PackStart(container, 500, 200, TRUE, FALSE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1275 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1276 // and a status area to see whats going on |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1277 DW::StatusText *container_status = new DW::StatusText(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1278 notebookbox->PackStart(container_status, 100, DW_SIZE_AUTO, TRUE, FALSE, 1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1279 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1280 const char *titles[] = { "Type", "Size", "Time", "Date" }; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1281 unsigned long flags[4] = { DW_CFA_BITMAPORICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1282 DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1283 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1284 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR }; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1285 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1286 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1287 container->SetColumnTitle("Test"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1288 container->Setup(flags, titles, 4); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1289 container->SetStripe(DW_CLR_DEFAULT, DW_CLR_DEFAULT); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1290 container->Alloc(3); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1291 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1292 for(int z=0;z<3;z++) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1293 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1294 char names[101] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1295 HICN thisicon = (z == 0 ? foldericon : fileicon); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1296 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1297 snprintf(names, 100, "We can now allocate from the stack: Item: %d", z); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1298 unsigned long size = z*100; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1299 snprintf(buffer, 100, "Filename %d", z+1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1300 container->SetFile(z, buffer, thisicon); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1301 container->SetItem(0, z, &thisicon); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1302 container->SetItem(1, z, &size); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1303 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1304 time.seconds = z+10; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1305 time.minutes = z+10; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1306 time.hours = z+10; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1307 container->SetItem(2, z, &time); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1308 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1309 date.day = z+10; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1310 date.month = z+10; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1311 date.year = z+2000; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1312 container->SetItem(3, z, &date); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1313 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1314 container->SetRowTitle(z, names); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1315 container->SetRowData(z, DW_INT_TO_POINTER(z)); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1316 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1317 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1318 container->Insert(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1319 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1320 container->Alloc(1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1321 container->SetFile(0, "Yikes", foldericon); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1322 unsigned long size = 324; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1323 container->SetItem(0, 0, &foldericon); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1324 container->SetItem(1, 0, &size); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1325 container->SetItem(2, 0, &time); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1326 container->SetItem(3, 0, &date); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1327 container->SetRowTitle(0, "Extra"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1328 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1329 container->Insert(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1330 container->Optimize(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1331 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1332 DW::MLE *container_mle = new DW::MLE(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1333 containerbox->PackStart(container_mle, 500, 200, TRUE, TRUE, 0); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1334 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1335 mle_point = container_mle->Import("", -1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1336 snprintf(buffer, 100, "[%d]", mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1337 mle_point = container_mle->Import(buffer, mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1338 snprintf(buffer, 100, "[%d]abczxydefijkl", mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1339 mle_point = container_mle->Import(buffer, mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1340 container_mle->Delete(9, 3); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1341 mle_point = container_mle->Import("gh", 12); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1342 unsigned long newpoint; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1343 container_mle->GetSize(&newpoint, NULL); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1344 mle_point = (int)newpoint; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1345 snprintf(buffer, 100, "[%d]\r\n\r\n", mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1346 mle_point = container_mle->Import(buffer, mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1347 container_mle->SetCursor(mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1348 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1349 // connect our event trappers... |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1350 container->ConnectItemEnter([container_status](char *text, void *itemdata) -> int |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1351 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1352 char buf[201] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1353 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1354 snprintf(buf, 200, "DW_SIGNAL_ITEM_ENTER: Text: %s Itemdata: %x", text, DW_POINTER_TO_UINT(itemdata)); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1355 container_status->SetText(buf); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1356 return FALSE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1357 }); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1358 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1359 container->ConnectItemContext([this, container_status](char *text, int x, int y, void *itemdata) -> int |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1360 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1361 char buf[201] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1362 DW::Menu *popupmenu = ItemContextMenu(container_status, "Item context menu clicked."); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1363 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1364 snprintf(buf, 200, "DW_SIGNAL_ITEM_CONTEXT: Text: %s x: %d y: %d Itemdata: %x", text, x, y, DW_POINTER_TO_UINT(itemdata)); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1365 container_status->SetText(buf); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1366 popupmenu->Popup(this, x, y); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1367 return FALSE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1368 }); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1369 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1370 container->ConnectItemSelect([this, container_mle, container, container_status](HTREEITEM item, char *text, void *itemdata) -> int |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1371 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1372 char buf[201] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1373 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1374 snprintf(buf, 200, "DW_SIGNAL_ITEM_SELECT:Item: %x Text: %s Itemdata: %x", |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1375 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata)); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1376 container_status->SetText(buf); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1377 snprintf(buf, 200, "\r\nDW_SIGNAL_ITEM_SELECT: Item: %x Text: %s Itemdata: %x\r\n", |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1378 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata)); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1379 this->mle_point = container_mle->Import(buf, mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1380 char *str = container->QueryStart(DW_CRA_SELECTED); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1381 while(str) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1382 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1383 snprintf(buf, 200, "Selected: %s\r\n", str); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1384 mle_point = container_mle->Import(buf, mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1385 this->app->Free(str); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1386 str = container->QueryNext(DW_CRA_SELECTED); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1387 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1388 // Make the last inserted point the cursor location |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1389 container_mle->SetCursor(mle_point); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1390 // set the details of item 0 to new data |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1391 this->app->Debug("In cb: icon: %x\n", DW_POINTER_TO_INT(fileicon)); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1392 container->ChangeFile(0, "new data", fileicon); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1393 unsigned long size = 999; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1394 this->app->Debug("In cb: icon: %x\n", DW_POINTER_TO_INT(fileicon)); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1395 container->ChangeItem(1, 0, &size); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1396 return FALSE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1397 }); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1398 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1399 container->ConnectColumnClick([container, container_status](int column_num) -> int |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1400 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1401 const char *type_string = "Filename"; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1402 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1403 if(column_num != 0) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1404 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1405 int column_type = container->GetColumnType(column_num-1); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1406 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1407 if(column_type == DW_CFA_STRING) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1408 type_string = "String"; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1409 else if(column_type == DW_CFA_ULONG) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1410 type_string ="ULong"; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1411 else if(column_type == DW_CFA_DATE) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1412 type_string = "Date"; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1413 else if(column_type == DW_CFA_TIME) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1414 type_string ="Time"; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1415 else if(column_type == DW_CFA_BITMAPORICON) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1416 type_string = "BitmapOrIcon"; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1417 else |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1418 type_string = "Unknown"; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1419 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1420 char buf[201] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1421 snprintf(buf, 200, "DW_SIGNAL_COLUMN_CLICK: Column: %d Type: %s", column_num, type_string); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1422 container_status->SetText(buf); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1423 return FALSE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1424 }); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1425 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1426 mlefore->ConnectListSelect([this, mlefore, mleback, container_mle](unsigned int pos) -> int |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1427 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1428 char colortext[101] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1429 ULONG fore = DW_CLR_DEFAULT, back = DW_CLR_DEFAULT; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1430 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1431 mlefore->GetListText(pos, colortext, 100); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1432 fore = ComboboxColor(colortext); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1433 char *text = mleback->GetText(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1434 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1435 if(text && *text) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1436 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1437 back = ComboboxColor(text); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1438 this->app->Free(text); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1439 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1440 container_mle->SetColor(fore, back); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1441 return FALSE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1442 }); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1443 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1444 mleback->ConnectListSelect([this, mlefore, mleback, container_mle](unsigned int pos) -> int |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1445 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1446 char colortext[101] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1447 ULONG fore = DW_CLR_DEFAULT, back = DW_CLR_DEFAULT; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1448 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1449 mleback->GetListText(pos, colortext, 100); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1450 back = ComboboxColor(colortext); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1451 char *text = mlefore->GetText(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1452 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1453 if(text && *text) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1454 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1455 fore = ComboboxColor(text); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1456 this->app->Free(text); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1457 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1458 container_mle->SetColor(fore, back); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1459 return FALSE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1460 }); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1461 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1462 fontname->ConnectListSelect([this, fontname, fontsize, container_mle](unsigned int pos) -> int |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1463 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1464 char font[101] = {0}; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1465 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1466 fontname->GetListText(pos, font, 100); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1467 MLESetFont(container_mle, (int)fontsize->GetPos(), strcmp(font, "Default") == 0 ? NULL : font); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1468 return FALSE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1469 }); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1470 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1471 fontsize->ConnectValueChanged([this, fontname, container_mle](int size) -> int |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1472 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1473 char *font = fontname->GetText(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1474 |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1475 if(font) |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1476 { |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1477 MLESetFont(container_mle, size, strcmp(font, "Default") == 0 ? NULL : font); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1478 this->app->Free(font); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1479 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1480 else |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1481 MLESetFont(container_mle, size, NULL); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1482 return FALSE; |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1483 }); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1484 } |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1485 |
2931
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1486 // Page 5 - Buttons |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
1487 void CreateButtons(DW::Box *notebookbox) { |
2931
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1488 // create a box to pack into the notebook page |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1489 DW::Box *buttonsbox = new DW::Box(DW_VERT, 2); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1490 notebookbox->PackStart(buttonsbox, 25, 200, TRUE, TRUE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1491 buttonsbox->SetColor(DW_CLR_RED, DW_CLR_RED); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1492 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1493 DW::Box *calbox = new DW::Box(DW_HORZ, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1494 notebookbox->PackStart(calbox, 0, 0, TRUE, FALSE, 1); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1495 DW::Calendar *cal = new DW::Calendar(); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1496 calbox->PackStart(cal, TRUE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1497 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1498 cal->SetDate(2019, 4, 30); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1499 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1500 // Create our file toolbar boxes... |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1501 DW::Box *buttonboxperm = new DW::Box(DW_VERT, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1502 buttonsbox->PackStart(buttonboxperm, 25, 0, FALSE, TRUE, 2); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1503 buttonboxperm->SetColor(DW_CLR_WHITE, DW_CLR_WHITE); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1504 DW::BitmapButton *topbutton = new DW::BitmapButton("Top Button", fileiconpath); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1505 buttonboxperm->PackStart(topbutton, 100, 30, FALSE, FALSE, 0 ); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1506 buttonboxperm->PackStart(DW_NOHWND, 25, 5, FALSE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1507 DW::BitmapButton *iconbutton = new DW::BitmapButton( "Folder Icon", foldericonpath); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1508 buttonsbox->PackStart(iconbutton, 25, 25, FALSE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1509 iconbutton->ConnectClicked([this, iconbutton]() -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1510 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1511 static int isfoldericon = 0; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1512 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1513 isfoldericon = !isfoldericon; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1514 if(isfoldericon) |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1515 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1516 iconbutton->Set(this->fileiconpath); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1517 iconbutton->SetTooltip("File Icon"); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1518 } |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1519 else |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1520 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1521 iconbutton->Set(this->foldericonpath); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1522 iconbutton->SetTooltip("Folder Icon"); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1523 } |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1524 return FALSE; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1525 }); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1526 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1527 DW::Box *filetoolbarbox = new DW::Box(DW_VERT, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1528 buttonboxperm->PackStart(filetoolbarbox, 0, 0, TRUE, TRUE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1529 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1530 DW::BitmapButton *button = new DW::BitmapButton("Empty image. Should be under Top button", 0, "junk"); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1531 filetoolbarbox->PackStart(button, 25, 25, FALSE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1532 button->ConnectClicked([buttonsbox]() -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1533 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1534 buttonsbox->SetColor(DW_CLR_RED, DW_CLR_RED); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1535 return TRUE; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1536 }); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1537 filetoolbarbox->PackStart(DW_NOHWND, 25, 5, FALSE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1538 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1539 button = new DW::BitmapButton("A borderless bitmapbitton", 0, foldericonpath); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1540 filetoolbarbox->PackStart(button, 25, 25, FALSE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1541 button->ConnectClicked([buttonsbox]() -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1542 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1543 buttonsbox->SetColor(DW_CLR_YELLOW, DW_CLR_YELLOW); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1544 return TRUE; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1545 }); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1546 filetoolbarbox->PackStart(DW_NOHWND, 25, 5, FALSE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1547 button->SetStyle(DW_BS_NOBORDER); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1548 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1549 DW::BitmapButton *perbutton = new DW::BitmapButton("A button from data", 0, foldericonpath); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1550 filetoolbarbox->PackStart(perbutton, 25, 25, FALSE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1551 filetoolbarbox->PackStart(DW_NOHWND, 25, 5, FALSE, FALSE, 0 ); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1552 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1553 // make a combobox |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1554 DW::Box *combox = new DW::Box(DW_VERT, 2); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1555 notebookbox->PackStart(combox, 25, 200, TRUE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1556 DW::ComboBox *combobox1 = new DW::ComboBox("fred"); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1557 combobox1->Append("fred"); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1558 combox->PackStart(combobox1, TRUE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1559 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1560 int iteration = 0; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1561 combobox1->ConnectListSelect([this, &iteration](unsigned int index) -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1562 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1563 this->app->Debug("got combobox_select_event for index: %d, iteration: %d\n", index, iteration++); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1564 return FALSE; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1565 }); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1566 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1567 DW::ComboBox *combobox2 = new DW::ComboBox("joe"); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1568 combox->PackStart(combobox2, TRUE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1569 combobox2->ConnectListSelect([this, &iteration](unsigned int index) -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1570 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1571 this->app->Debug("got combobox_select_event for index: %d, iteration: %d\n", index, iteration++); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1572 return FALSE; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1573 }); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1574 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1575 // add LOTS of items |
2938
1184f58135ba
C++: Eliminate remnants of C code I missed while porting to C++.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2935
diff
changeset
|
1576 app->Debug("before appending 500 items to combobox using DW::ListBox::ListAppend()\n"); |
2931
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1577 char **text = (char **)malloc(500*sizeof(char *)); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1578 for(int i = 0; i < 500; i++) |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1579 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1580 text[i] = (char *)calloc(1, 50); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1581 snprintf(text[i], 50, "item %d", i); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1582 } |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1583 combobox2->ListAppend(text, 500); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1584 app->Debug("after appending 500 items to combobox\n"); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1585 for(int i = 0; i < 500; i++) |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1586 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1587 free(text[i]); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1588 } |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1589 free(text); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1590 // now insert a couple of items |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1591 combobox2->Insert("inserted item 2", 2); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1592 combobox2->Insert("inserted item 5", 5); |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1593 // make a spinbutton |
2931
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1594 DW::SpinButton *spinbutton = new DW::SpinButton(); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1595 combox->PackStart(spinbutton, TRUE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1596 spinbutton->SetLimits(100, 1); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1597 spinbutton->SetPos(30); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1598 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1599 spinbutton->ConnectValueChanged([this](int value) -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1600 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1601 this->app->MessageBox("DWTest", DW_MB_OK, "New value from spinbutton: %d\n", value); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1602 return TRUE; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1603 }); |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1604 // make a slider |
2931
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1605 DW::Slider *slider = new DW::Slider(FALSE, 11, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1606 combox->PackStart(slider, TRUE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1607 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1608 // make a percent |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1609 DW::Percent *percent = new DW::Percent(); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1610 combox->PackStart(percent, TRUE, FALSE, 0); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1611 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1612 topbutton->ConnectClicked([this, combobox1, combobox2, spinbutton, cal]() -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1613 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1614 char buf1[101] = {0}; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1615 char buf2[101] = {0}; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1616 char buf3[501] = {0}; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1617 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1618 unsigned int idx = combobox1->Selected(); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1619 combobox1->GetListText(idx, buf1, 100); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1620 idx = combobox2->Selected(); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1621 combobox2->GetListText(idx, buf2, 100); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1622 unsigned int y,m,d; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1623 cal->GetDate(&y, &m, &d); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1624 long spvalue = spinbutton->GetPos(); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1625 int len = snprintf(buf3, 500, "spinbutton: %ld\ncombobox1: \"%s\"\ncombobox2: \"%s\"\ncalendar: %d-%d-%d", |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1626 spvalue, |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1627 buf1, buf2, |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1628 y, m, d); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1629 this->app->MessageBox("Values", DW_MB_OK | DW_MB_INFORMATION, buf3); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1630 this->app->SetClipboard(buf3, len); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1631 return 0; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1632 }); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1633 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1634 perbutton->ConnectClicked([percent]() -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1635 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1636 percent->SetPos(DW_PERCENT_INDETERMINATE); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1637 return TRUE; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1638 }); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1639 |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1640 slider->ConnectValueChanged([percent](int value) -> int |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1641 { |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1642 percent->SetPos(value * 10); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1643 return TRUE; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1644 }); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1645 } |
2932
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1646 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1647 // Page 6 - HTML |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
1648 void CreateHTML(DW::Box *notebookbox) { |
2932
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1649 DW::HTML *rawhtml = new DW::HTML(); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1650 if(rawhtml && rawhtml->GetHWND()) |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1651 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1652 DW::Box *hbox = new DW::Box(DW_HORZ, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1653 DW::ComboBox *javascript = new DW::ComboBox(); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1654 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1655 javascript->Append("window.scrollTo(0,500);"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1656 javascript->Append("window.document.title;"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1657 javascript->Append("window.navigator.userAgent;"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1658 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1659 notebookbox->PackStart(rawhtml, 0, 100, TRUE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1660 rawhtml->Raw("<html><body><center><h1>dwtest</h1></center></body></html>"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1661 DW::HTML *html = new DW::HTML(); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1662 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1663 notebookbox->PackStart(hbox, 0, 0, TRUE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1664 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1665 // Add navigation buttons |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1666 DW::Button *button = new DW::Button("Back"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1667 hbox->PackStart(button, FALSE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1668 button->ConnectClicked([html]() -> int |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1669 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1670 html->Action(DW_HTML_GOBACK); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1671 return TRUE; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1672 }); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1673 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1674 button = new DW::Button("Forward"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1675 hbox->PackStart(button, FALSE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1676 button->ConnectClicked([html]() -> int |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1677 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1678 html->Action(DW_HTML_GOFORWARD); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1679 return TRUE; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1680 }); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1681 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1682 // Put in some extra space |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1683 hbox->PackStart(0, 5, 1, FALSE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1684 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1685 button = new DW::Button("Reload"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1686 hbox->PackStart(button, FALSE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1687 button->ConnectClicked([html]() -> int |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1688 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1689 html->Action(DW_HTML_RELOAD); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1690 return TRUE; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1691 }); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1692 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1693 // Put in some extra space |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1694 hbox->PackStart(0, 5, 1, FALSE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1695 hbox->PackStart(javascript, TRUE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1696 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1697 button = new DW::Button("Run"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1698 hbox->PackStart(button, FALSE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1699 button->ConnectClicked([this, javascript, html]() -> int |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1700 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1701 char *script = javascript->GetText(); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1702 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1703 html->JavascriptRun(script); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1704 this->app->Free(script); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1705 return FALSE; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1706 }); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1707 javascript->ClickDefault(button); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1708 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1709 notebookbox->PackStart(html, 0, 100, TRUE, TRUE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1710 html->URL("https://dbsoft.org/dw_help.php"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1711 DW::StatusText *htmlstatus = new DW::StatusText("HTML status loading..."); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1712 notebookbox->PackStart(htmlstatus, 100, DW_SIZE_AUTO, TRUE, FALSE, 1); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1713 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1714 // Connect the signal handlers |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1715 html->ConnectChanged([htmlstatus](int status, char *url) -> int |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1716 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1717 const char *statusnames[] = { "none", "started", "redirect", "loading", "complete", NULL }; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1718 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1719 if(htmlstatus && url && status < 5) |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1720 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1721 int length = (int)strlen(url) + (int)strlen(statusnames[status]) + 10; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1722 char *text = (char *)calloc(1, length+1); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1723 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1724 snprintf(text, length, "Status %s: %s", statusnames[status], url); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1725 htmlstatus->SetText(text); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1726 free(text); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1727 } |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1728 return FALSE; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1729 }); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1730 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1731 html->ConnectResult([this](int status, char *result, void *script_data) |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1732 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1733 this->app->MessageBox("Javascript Result", DW_MB_OK | (status ? DW_MB_ERROR : DW_MB_INFORMATION), |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1734 result ? result : "Javascript result is not a string value"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1735 return TRUE; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1736 }); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1737 } |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1738 else |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1739 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1740 DW::Text *htmltext = new DW::Text("HTML widget not available."); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1741 notebookbox->PackStart(htmltext, 0, 100, TRUE, TRUE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1742 } |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1743 } |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1744 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1745 // Page 7 - ScrollBox |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
1746 void CreateScrollBox(DW::Box *notebookbox) { |
2932
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1747 char buf[101] = {0}; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1748 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1749 // create a box to pack into the notebook page |
2932
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1750 DW::ScrollBox *scrollbox = new DW::ScrollBox(DW_VERT, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1751 notebookbox->PackStart(scrollbox, 0, 0, TRUE, TRUE, 1); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1752 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1753 DW::Button *adjbutton = new DW::Button("Show Adjustments", 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1754 scrollbox->PackStart(adjbutton, FALSE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1755 adjbutton->ConnectClicked([this, scrollbox]() -> int |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1756 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1757 int pos = scrollbox->GetPos(DW_VERT); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1758 int range = scrollbox->GetRange(DW_VERT); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1759 this->app->Debug("Pos %d Range %d\n", pos, range); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1760 return FALSE; |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1761 }); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1762 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1763 for(int i = 0; i < MAX_WIDGETS; i++) |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1764 { |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1765 DW::Box *tmpbox = new DW::Box(DW_HORZ, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1766 scrollbox->PackStart(tmpbox, 0, 0, TRUE, FALSE, 2); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1767 snprintf(buf, 100, "Label %d", i); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1768 DW::Text *label = new DW::Text(buf ); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1769 tmpbox->PackStart(label, 0, DW_SIZE_AUTO, TRUE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1770 snprintf(buf, 100, "Entry %d", i); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1771 DW::Entryfield *entry = new DW::Entryfield(buf , i); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1772 tmpbox->PackStart(entry, 0, DW_SIZE_AUTO, TRUE, FALSE, 0); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1773 } |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1774 } |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1775 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1776 // Page 8 - Thread and Event |
2940
60e90b783cb1
C++: ListBox and ComboBoxes need to call Setup() to configure the handlers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2939
diff
changeset
|
1777 void CreateThreadEvent(DW::Box *notebookbox) { |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1778 // create a box to pack into the notebook page |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1779 DW::Box *tmpbox = new DW::Box(DW_VERT, 0); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1780 notebookbox->PackStart(tmpbox, 0, 0, TRUE, TRUE, 1); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1781 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1782 DW::Button *startbutton = new DW::Button("Start Threads"); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1783 tmpbox->PackStart(startbutton, FALSE, FALSE, 0); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1784 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1785 // Create the base threading components |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1786 DW::MLE *threadmle = new DW::MLE(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1787 tmpbox->PackStart(threadmle, 1, 1, TRUE, TRUE, 0); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1788 DW::Mutex *mutex = new DW::Mutex(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1789 DW::Event *workevent = new DW::Event(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1790 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1791 startbutton->ConnectClicked([this, mutex, workevent, threadmle, startbutton]() -> int |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1792 { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1793 startbutton->Disable(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1794 mutex->Lock(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1795 DW::Event *controlevent = new DW::Event(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1796 workevent->Reset(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1797 finished = FALSE; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1798 ready = 0; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1799 UpdateMLE(threadmle, "Starting thread 1\r\n", DW_NULL); |
2935
440de3640522
C++: Fix warnings reported by clang on FreeBSD of unused capture variables.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2934
diff
changeset
|
1800 new DW::Thread([this, mutex, controlevent, workevent, threadmle](DW::Thread *thread) -> void { |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1801 this->RunThread(1, mutex, controlevent, workevent, threadmle); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1802 }); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1803 UpdateMLE(threadmle, "Starting thread 2\r\n", DW_NULL); |
2935
440de3640522
C++: Fix warnings reported by clang on FreeBSD of unused capture variables.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2934
diff
changeset
|
1804 new DW::Thread([this, mutex, controlevent, workevent, threadmle](DW::Thread *thread) -> void { |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1805 this->RunThread(2, mutex, controlevent, workevent, threadmle); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1806 }); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1807 UpdateMLE(threadmle, "Starting thread 3\r\n", DW_NULL); |
2935
440de3640522
C++: Fix warnings reported by clang on FreeBSD of unused capture variables.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2934
diff
changeset
|
1808 new DW::Thread([this, mutex, controlevent, workevent, threadmle](DW::Thread *thread) -> void { |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1809 this->RunThread(3, mutex, controlevent, workevent, threadmle); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1810 }); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1811 UpdateMLE(threadmle, "Starting thread 4\r\n", DW_NULL); |
2935
440de3640522
C++: Fix warnings reported by clang on FreeBSD of unused capture variables.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2934
diff
changeset
|
1812 new DW::Thread([this, mutex, controlevent, workevent, threadmle](DW::Thread *thread) -> void { |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1813 this->RunThread(4, mutex, controlevent, workevent, threadmle); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1814 }); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1815 UpdateMLE(threadmle, "Starting control thread\r\n", DW_NULL); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1816 new DW::Thread([this, startbutton, mutex, controlevent, workevent, threadmle](DW::Thread *thread) -> void { |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1817 this->ControlThread(mutex, controlevent, workevent, threadmle); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1818 startbutton->Enable(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1819 }); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1820 mutex->Unlock(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1821 return FALSE; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1822 }); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1823 } |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1824 public: |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1825 // Constructor creates the application |
2915
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
1826 DWTest(const char *title): DW::Window(title) { |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1827 // Get our application singleton |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1828 app = DW::App::Init(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1829 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1830 // Add menus to the window |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1831 CreateMenus(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1832 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1833 // Create our notebook and add it to the window |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1834 DW::Box *notebookbox = new DW::Box(DW_VERT, 5); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1835 this->PackStart(notebookbox, 0, 0, TRUE, TRUE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1836 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1837 /* First try the current directory */ |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1838 foldericon = app->LoadIcon(foldericonpath); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1839 fileicon = app->LoadIcon(fileiconpath); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1840 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1841 #ifdef PLATFORMFOLDER |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1842 // In case we are running from the build directory... |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1843 // also check the appropriate platform subfolder |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1844 if(!foldericon) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1845 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1846 strncpy(foldericonpath, PLATFORMFOLDER "folder", 1024); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1847 foldericon = app->LoadIcon(foldericonpath); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1848 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1849 if(!fileicon) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1850 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1851 strncpy(fileiconpath, PLATFORMFOLDER "file", 1024); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1852 fileicon = app->LoadIcon(fileiconpath); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1853 } |
2889
4b075e64536c
C++: Add some simple menu code to see if things are working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2883
diff
changeset
|
1854 #endif |
4b075e64536c
C++: Add some simple menu code to see if things are working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2883
diff
changeset
|
1855 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1856 // Finally try from the platform application directory |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1857 if(!foldericon && !fileicon) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1858 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1859 char *appdir = app->GetDir(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1860 char pathbuff[1025] = {0}; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1861 int pos = (int)strlen(appdir); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1862 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1863 strncpy(pathbuff, appdir, 1024); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1864 pathbuff[pos] = DW_DIR_SEPARATOR; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1865 pos++; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1866 strncpy(&pathbuff[pos], "folder", 1024-pos); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1867 foldericon = app->LoadIcon(pathbuff); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1868 if(foldericon) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1869 strncpy(foldericonpath, pathbuff, 1025); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1870 strncpy(&pathbuff[pos], "file", 1024-pos); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1871 fileicon = app->LoadIcon(pathbuff); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1872 if(fileicon) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1873 strncpy(fileiconpath, pathbuff, 1025); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1874 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1875 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1876 DW::Notebook *notebook = new DW::Notebook(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1877 notebookbox->PackStart(notebook, TRUE, TRUE, 0); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1878 notebook->ConnectSwitchPage([this](unsigned long page_num) -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1879 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1880 this->app->Debug("DW_SIGNAL_SWITCH_PAGE: PageNum: %u\n", page_num); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1881 return TRUE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1882 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1883 |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1884 // Create Notebook Page 1 - Input |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1885 notebookbox = new DW::Box(DW_VERT, 5); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1886 CreateInput(notebookbox); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1887 unsigned long notebookpage = notebook->PageNew(0, TRUE); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1888 notebook->Pack(notebookpage, notebookbox); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1889 notebook->PageSetText(notebookpage, "buttons and entry"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1890 |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1891 // Create Notebook Page 2 - Render |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1892 notebookbox = new DW::Box(DW_VERT, 5); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1893 CreateRender(notebookbox); |
2920
c6b699a441fe
C++: Fix a couple minor errors while attempting to fix Mac crash.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2919
diff
changeset
|
1894 notebookpage = notebook->PageNew(); |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1895 notebook->Pack(notebookpage, notebookbox); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1896 notebook->PageSetText(notebookpage, "render"); |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1897 |
2929
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1898 // Create Notebook Page 3 - Tree |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1899 notebookbox = new DW::Box(DW_VERT, 5); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1900 CreateTree(notebookbox); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1901 notebookpage = notebook->PageNew(); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1902 notebook->Pack(notebookpage, notebookbox); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1903 notebook->PageSetText(notebookpage, "tree"); |
2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2928
diff
changeset
|
1904 |
2930
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1905 // Create Notebook Page 4 - Container |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1906 notebookbox = new DW::Box(DW_VERT, 5); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1907 CreateContainer(notebookbox); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1908 notebookpage = notebook->PageNew(); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1909 notebook->Pack(notebookpage, notebookbox); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1910 notebook->PageSetText(notebookpage, "container"); |
d8117d36ed27
C++: Add Page 4 - Container to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2929
diff
changeset
|
1911 |
2931
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1912 // Create Notebook Page 5 - Buttons |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1913 notebookbox = new DW::Box(DW_VERT, 5); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1914 CreateButtons(notebookbox); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1915 notebookpage = notebook->PageNew(); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1916 notebook->Pack(notebookpage, notebookbox); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1917 notebook->PageSetText(notebookpage, "buttons"); |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1918 |
2932
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1919 // Create Notebook Page 6 - HTML |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1920 notebookbox = new DW::Box(DW_VERT, 5); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1921 CreateHTML(notebookbox); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1922 notebookpage = notebook->PageNew(); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1923 notebook->Pack(notebookpage, notebookbox); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1924 notebook->PageSetText(notebookpage, "html"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1925 |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1926 // Create Notebook Page 7 - ScrollBox |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1927 notebookbox = new DW::Box(DW_VERT, 5); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1928 CreateScrollBox(notebookbox); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1929 notebookpage = notebook->PageNew(); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1930 notebook->Pack(notebookpage, notebookbox); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1931 notebook->PageSetText(notebookpage, "scrollbox"); |
3f660f47a45f
C++: Add HTML and ScrollBox pages to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2931
diff
changeset
|
1932 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1933 // Create Notebook Page 8 - Thread and Event |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1934 notebookbox = new DW::Box(DW_VERT, 5); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1935 CreateThreadEvent(notebookbox); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1936 notebookpage = notebook->PageNew(); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1937 notebook->Pack(notebookpage, notebookbox); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1938 notebook->PageSetText(notebookpage, "thread/event"); |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1939 |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1940 // Finalize the window |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1941 this->SetSize(640, 550); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1942 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1943 timer = new DW::Timer(2000, [this]() -> int |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1944 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1945 this->app->Beep(200, 200); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1946 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1947 // Return TRUE so we get called again |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1948 return TRUE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1949 }); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1950 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1951 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1952 DW::App *app; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1953 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1954 // Page 1 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1955 DW::Timer *timer; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1956 int cursor_arrow = TRUE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1957 unsigned long current_color; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1958 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1959 // Page 2 |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1960 DW::Render *render1, *render2; |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1961 DW::Pixmap *pixmap1, *pixmap2, *image; |
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1962 DW::ScrollBar *hscrollbar, *vscrollbar; |
2919
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1963 DW::SpinButton *imagexspin, *imageyspin; |
e609aa6a5b93
C++: Attempt to implement page 2 rendering...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2917
diff
changeset
|
1964 DW::CheckBox *imagestretchcheck; |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1965 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1966 int font_width = 8, font_height=12; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1967 int rows=10,width1=6,cols=80; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1968 int num_lines=0, max_linewidth=0; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1969 int current_row=0,current_col=0; |
2931
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1970 unsigned int render_type = SHAPES_DOUBLE_BUFFERED; |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1971 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1972 char **lp; |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1973 char *current_file = NULL; |
2889
4b075e64536c
C++: Add some simple menu code to see if things are working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2883
diff
changeset
|
1974 |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1975 // Page 4 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1976 int mle_point=-1; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1977 |
2933
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1978 // Page 8 |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1979 int finished = FALSE, ready = 0; |
3cdb02171b01
C++: Implement Thread class and add the last page Thread/Event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2932
diff
changeset
|
1980 |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1981 // Miscellaneous |
2917
77e5d6743013
C++: Implement most of Page 2 (Render) except the actual rendering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2916
diff
changeset
|
1982 int menu_enabled = TRUE; |
2931
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1983 HICN fileicon, foldericon; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1984 char fileiconpath[1025] = "file"; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1985 char foldericonpath[1025] = "folder"; |
30c1f37713b6
C++: Add page 5 - Buttons to dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2930
diff
changeset
|
1986 |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1987 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1988 int OnDelete() override { |
2915
0cde119fc945
C++: Fix initialization and #define reused strings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2914
diff
changeset
|
1989 if(app->MessageBox(APP_TITLE, DW_MB_YESNO | DW_MB_QUESTION, APP_EXIT) != 0) { |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1990 app->MainQuit(); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1991 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1992 return TRUE; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1993 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1994 }; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1995 |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
1996 // Pretty list of features corresponding to the DWFEATURE enum in dw.h |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1997 const char *DWFeatureList[] = { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1998 "Supports the HTML Widget", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
1999 "Supports the DW_SIGNAL_HTML_RESULT callback", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2000 "Supports custom window border sizes", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2001 "Supports window frame transparency", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2002 "Supports Dark Mode user interface", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2003 "Supports auto completion in Multi-line Edit boxes", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2004 "Supports word wrapping in Multi-line Edit boxes", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2005 "Supports striped line display in container widgets", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2006 "Supports Multiple Document Interface window frame", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2007 "Supports status text area on notebook/tabbed controls", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2008 "Supports sending system notifications", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2009 "Supports UTF8 encoded Unicode text", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2010 "Supports Rich Edit based MLE control (Windows)", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2011 "Supports icons in the taskbar or similar system widget", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2012 "Supports the Tree Widget", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2013 "Supports arbitrary window placement", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2014 "Supports alternate container view modes", |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2015 NULL }; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2016 |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
2017 // Let's demonstrate the functionality of this library. :) |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2018 int dwmain(int argc, char* argv[]) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2019 { |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
2020 // Initialize the Dynamic Windows engine |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2021 DW::App *app = DW::App::Init(argc, argv, "org.dbsoft.dwindows.dwtestoo", "Dynamic Windows Test C++"); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2022 |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
2023 // Enable full dark mode on platforms that support it |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2024 if(getenv("DW_DARK_MODE")) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2025 app->SetFeature(DW_FEATURE_DARK_MODE, DW_DARK_MODE_FULL); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2026 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2027 #ifdef DW_MOBILE |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
2028 // Enable multi-line container display on Mobile platforms |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2029 app->SetFeature(DW_FEATURE_CONTAINER_MODE, DW_CONTAINER_MODE_MULTI); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2030 #endif |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2031 |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
2032 // Test all the features and display the results |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2033 for(int intfeat=DW_FEATURE_HTML; intfeat<DW_FEATURE_MAX; intfeat++) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2034 { |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2035 DWFEATURE feat = static_cast<DWFEATURE>(intfeat); |
2938
1184f58135ba
C++: Eliminate remnants of C code I missed while porting to C++.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2935
diff
changeset
|
2036 int result = app->GetFeature(feat); |
2914
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2037 const char *status = "Unsupported"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2038 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2039 if(result == 0) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2040 status = "Disabled"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2041 else if(result > 0) |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2042 status = "Enabled"; |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2043 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2044 app->Debug("%s: %s (%d)\n", DWFeatureList[feat], status, result); |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2045 } |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2046 |
8af64b6d75a9
C++: Start rewriting dwtest in C++ as dwtestoo.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2895
diff
changeset
|
2047 DWTest *window = new DWTest("dwindows test UTF8 中国語 (繁体) cañón"); |
2869
c873b6f862b9
C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2868
diff
changeset
|
2048 window->Show(); |
2861
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2049 |
2869
c873b6f862b9
C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2868
diff
changeset
|
2050 app->Main(); |
c873b6f862b9
C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2868
diff
changeset
|
2051 app->Exit(0); |
2861
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2052 |
2869
c873b6f862b9
C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2868
diff
changeset
|
2053 return 0; |
2861
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2054 } |
2923
969cc3b8bec2
C++: Include the old style function support even when lambdas are available.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2921
diff
changeset
|
2055 #endif |