annotate test/dw_ui_test.cc @ 2012:bfb8bc9ddf62

Avoid lots of flicker while resizing the window (when "buffered_drawing" is set to 0 or 1)
author Jorge Arellano Cid <jcid@dillo.org>
date Fri, 13 May 2011 14:14:43 -0400
parents 6b9486c3be92
children 8cf59505bd0a
rev   line source
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
1 /*
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
2 * Dillo Widget
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
3 *
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
5 *
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
8 * the Free Software Foundation; either version 3 of the License, or
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
9 * (at your option) any later version.
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
10 *
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
14 * GNU General Public License for more details.
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
15 *
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
972
d7dbd3dcfa38 Updated the GPL copyright note in the source files
Detlef Riekenberg <wine.dev@web.de>
parents: 903
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
18 */
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
19
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
20
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
21
1832
corvid <corvid@lavabit.com>
parents: 1462
diff changeset
22 #include <FL/Fl.H>
corvid <corvid@lavabit.com>
parents: 1462
diff changeset
23 #include <FL/Fl_Window.H>
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
24
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
25 #include "../dw/core.hh"
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
26 #include "../dw/fltkcore.hh"
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
27 #include "../dw/fltkviewport.hh"
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
28 #include "../dw/table.hh"
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
29 #include "../dw/textblock.hh"
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
30 #include "../dw/ui.hh"
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
31 #include "form.hh"
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
32
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
33 using namespace lout::object;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
34 using namespace lout::container::typed;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
35 using namespace dw;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
36 using namespace dw::core;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
37 using namespace dw::core::style;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
38 using namespace dw::core::ui;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
39 using namespace dw::fltk;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
40
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
41 int main(int argc, char **argv)
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
42 {
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
43 FltkPlatform *platform = new FltkPlatform ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
44 Layout *layout = new Layout (platform);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
45
1832
corvid <corvid@lavabit.com>
parents: 1462
diff changeset
46 Fl_Window *window = new Fl_Window(400, 400, "Dw UI Test");
2012
bfb8bc9ddf62 Avoid lots of flicker while resizing the window
Jorge Arellano Cid <jcid@dillo.org>
parents: 1890
diff changeset
47 window->box(FL_NO_BOX);
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
48 window->begin();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
49
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
50 FltkViewport *viewport = new FltkViewport (0, 0, 400, 400);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
51 layout->attachView (viewport);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
52
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
53 StyleAttrs styleAttrs;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
54 styleAttrs.initValues ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
55 styleAttrs.margin.setVal (5);
677
b6ef23efdac7 always use shaded colors
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 347
diff changeset
56 styleAttrs.color = Color::create (layout, 0x000000);
b6ef23efdac7 always use shaded colors
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 347
diff changeset
57 styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
58
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
59 FontAttrs fontAttrs;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
60 fontAttrs.name = "Helvetica";
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
61 fontAttrs.size = 14;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
62 fontAttrs.weight = 400;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
63 fontAttrs.style = FONT_STYLE_NORMAL;
1462
8de487d495f7 initialize fontAttrs.letterSpacing in test programs
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1147
diff changeset
64 fontAttrs.letterSpacing = 0;
1832
corvid <corvid@lavabit.com>
parents: 1462
diff changeset
65 styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
66
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
67 Style *tableStyle = Style::create (layout, &styleAttrs);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
68
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
69 Table *table = new Table (false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
70 table->setStyle (tableStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
71 layout->setWidget (table);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
72
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
73 tableStyle->unref();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
74
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
75 styleAttrs.backgroundColor = NULL;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
76 styleAttrs.margin.setVal (0);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
77
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
78 Style *cellStyle = Style::create (layout, &styleAttrs);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
79
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
80 // First of all, the resources. Later, they are embedded into the
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
81 // widget tree.
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
82 EntryResource *entryres1 =
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 347
diff changeset
83 layout->getResourceFactory()->createEntryResource (10, false, NULL);
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
84 entryres1->setText ("Hi!");
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
85 EntryResource *entryres2 =
484
cdfdb006f193 Added a right-click menu to the form submit button (allows to show hiddens)
Jorge Arellano Cid <jcid@dillo.org>
parents: 347
diff changeset
86 layout->getResourceFactory()->createEntryResource (10, true, NULL);
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
87 MultiLineTextResource *textres =
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
88 layout->getResourceFactory()->createMultiLineTextResource (15,3);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
89 RadioButtonResource *radiores1 =
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
90 layout->getResourceFactory()->createRadioButtonResource (NULL, false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
91 RadioButtonResource *radiores2 =
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
92 layout->getResourceFactory()->createRadioButtonResource (radiores1,
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
93 false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
94 CheckButtonResource *checkres =
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
95 layout->getResourceFactory()->createCheckButtonResource (true);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
96 SelectionResource *selres[2];
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
97 selres[0] = layout->getResourceFactory()->createOptionMenuResource ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
98 selres[1] = layout->getResourceFactory()->createListResource
903
4d76ce512830 Implemented size for SELECT lists
corvid <corvid@lavabit.com>
parents: 749
diff changeset
99 (ListResource::SELECTION_AT_MOST_ONE, 4);
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
100 LabelButtonResource *buttonres =
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
101 layout->getResourceFactory()->createLabelButtonResource ("Run!");
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
102
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
103 // Note on complex buttons: before any operations on the widget, which
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
104 // need a layout, the complex button resource should be created, since
1147
e048ab285d1e spelling
Jeremy Henty <onepoint@starurchin.org>
parents: 972
diff changeset
105 // then, a layout and a platform are instantiated.
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
106 Textblock *cbuttontext = new Textblock(false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
107 ComplexButtonResource *cbuttonres =
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
108 layout->getResourceFactory()->createComplexButtonResource (cbuttontext,
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
109 true);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
110 cbuttontext->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
111 cbuttontext->addText ("Run (complex)!", cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
112 cbuttontext->flush ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
113
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
114 // The entry resources are put into a special handler, which is
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
115 // also a receiver for the button resources.
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
116 form::Form *form = new form::Form();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
117 form->addTextResource ("val1", entryres1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
118 form->addTextResource ("val2", entryres2);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
119 form->addTextResource ("text", textres);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
120 const char *radiovalues[] = { "radio1", "radio2", NULL };
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
121 form->addRadioButtonResource ("val3", radiores1, radiovalues);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
122 form->addCheckButtonResource ("check", checkres);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
123 const char *selvalues[] = { "i1", "i11", "i12", "i13", "i2",
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
124 "i21", "i22", "i23", "i3", NULL };
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
125 form->addSelectionResource ("val4", selres[0], selvalues);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
126 form->addSelectionResource ("val5", selres[1], selvalues);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
127 form->addButtonResource ("button", buttonres, "Run!");
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
128 form->addButtonResource ("cbutton", cbuttonres, "cbuttonval");
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
129
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
130 // Create the widgets.
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
131 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
132
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
133 Textblock *label1 = new Textblock(false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
134 label1->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
135 table->addCell (label1, 1, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
136 label1->addText ("val1 = ", cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
137 label1->flush ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
138
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
139 Embed *input1 = new Embed (entryres1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
140 input1->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
141 table->addCell (input1, 1, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
142
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
143 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
144
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
145 Textblock *label2 = new Textblock(false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
146 label2->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
147 table->addCell (label2, 1, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
148 label2->addText ("val2 = ", cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
149 label2->flush ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
150
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
151 Embed *input2 = new Embed (entryres2);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
152 input2->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
153 table->addCell (input2, 1, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
154
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
155 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
156
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
157 Textblock *label = new Textblock(false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
158 label->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
159 table->addCell (label, 1, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
160 label->addText ("text = ", cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
161 label->flush ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
162
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
163 Embed *text = new Embed (textres);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
164 textres->setText("Hi textarea");
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
165 text->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
166 table->addCell (text, 1, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
167
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
168 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
169
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
170 Textblock *radiolabel1 = new Textblock(false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
171 radiolabel1->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
172 table->addCell (radiolabel1, 2, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
173 Embed *radio1 = new Embed (radiores1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
174 radiolabel1->addWidget (radio1, cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
175 radiolabel1->addText (" radio1", cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
176 radiolabel1->flush ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
177
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
178 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
179 Textblock *radiolabel2 = new Textblock(false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
180 radiolabel2->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
181 table->addCell (radiolabel2, 2, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
182 Embed *radio2 = new Embed (radiores2);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
183 radiolabel2->addWidget (radio2, cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
184 radiolabel2->addText (" radio2", cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
185 radiolabel2->flush ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
186
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
187 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
188 Textblock *checklabel = new Textblock(false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
189 checklabel->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
190 table->addCell (checklabel, 2, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
191 Embed *check = new Embed (checkres);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
192 checklabel->addWidget (check, cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
193 checklabel->addText (" check", cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
194 checklabel->flush ();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
195
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
196 for(int i = 0; i < 2; i++) {
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
197 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
198
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
199 Embed *sel = new Embed (selres[i]);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
200 sel->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
201 table->addCell (sel, 2, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
202
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
203 selres[i]->addItem("item 1", true, false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
204
1890
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
205 selres[i]->pushGroup("group 1", true);
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
206 selres[i]->addItem("item 1/1", true, false);
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
207 selres[i]->addItem("item 1/2", true, true);
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
208 selres[i]->addItem("item 1/3", false, false);
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
209 selres[i]->popGroup();
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
210
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
211 selres[i]->addItem("item 2", true, i == 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
212
1890
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
213 selres[i]->pushGroup("group 2", false);
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
214 selres[i]->addItem("item 2/1", true, false);
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
215 selres[i]->addItem("item 2/2", true, false);
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
216 selres[i]->addItem("item 2/3", false, false);
6b9486c3be92 restore push/pop in dw-ui-test
corvid <corvid@lavabit.com>
parents: 1835
diff changeset
217 selres[i]->popGroup();
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
218
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
219 selres[i]->addItem("item 3", false, false);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
220 }
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
221
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
222 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
223 Embed *button = new Embed (buttonres);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
224 button->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
225 table->addCell (button, 2, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
226
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
227 table->addRow (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
228 Embed *cbutton = new Embed (cbuttonres);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
229 cbutton->setStyle (cellStyle);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
230 table->addCell (cbutton, 2, 1);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
231
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
232 cellStyle->unref();
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
233
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
234 window->resizable(viewport);
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
235 window->show();
1832
corvid <corvid@lavabit.com>
parents: 1462
diff changeset
236 int errorCode = Fl::run();
347
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
237
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
238 delete form;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
239 delete layout;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
240
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
241 return errorCode;
e5955ab8dafb - Moved the dw2 tree into dillo2's tree.
jcid
parents:
diff changeset
242 }