1 // generated by Fast Light User Interface Designer (fluid) version 1.0300
3 #include "../FL/Fl_Theme_Chooser.H"
4 #include <FL/Fl_Color_Chooser.H>
5 #include <FL/Fl_Double_Window.H>
7 Fl_Color_Button::Fl_Color_Button( int X
, int Y
, int W
, int H
, const char *L
) : Fl_Button( X
, Y
, W
, H
, L
) {
10 int Fl_Color_Button::handle( int m
) {
17 Fl::get_color( color(), r
, g
, b
);
19 fl_color_chooser( label(), r
, g
, b
);
21 color( fl_rgb_color( r
, g
, b
) );
29 return Fl_Button::handle( m
);
32 void Fl_Theme_Chooser::cb_theme_choice_i(Fl_Choice
* o
, void*) {
33 Fl_Theme::set( o
->mvalue()->label() );
37 void Fl_Theme_Chooser::cb_theme_choice(Fl_Choice
* o
, void* v
) {
38 ((Fl_Theme_Chooser
*)(o
->parent()))->cb_theme_choice_i(o
,v
);
41 void Fl_Theme_Chooser::cb_color_scheme_choice_i(Fl_Choice
* o
, void*) {
42 Fl_Color_Scheme::set( o
->mvalue()->label() );
46 void Fl_Theme_Chooser::cb_color_scheme_choice(Fl_Choice
* o
, void* v
) {
47 ((Fl_Theme_Chooser
*)(o
->parent()))->cb_color_scheme_choice_i(o
,v
);
50 void Fl_Theme_Chooser::cb_OK_i(Fl_Return_Button
*, void*) {
51 Fl_Theme::save(); Fl_Color_Scheme::save(); hide();
53 void Fl_Theme_Chooser::cb_OK(Fl_Return_Button
* o
, void* v
) {
54 ((Fl_Theme_Chooser
*)(o
->parent()))->cb_OK_i(o
,v
);
57 void Fl_Theme_Chooser::cb_background_color_button_i(Fl_Color_Button
* o
, void*) {
60 Fl::get_color( o
->color(), r
,g
,b
);
62 Fl::background( r
,g
,b
);
64 o
->window()->redraw();
66 void Fl_Theme_Chooser::cb_background_color_button(Fl_Color_Button
* o
, void* v
) {
67 ((Fl_Theme_Chooser
*)(o
->parent()))->cb_background_color_button_i(o
,v
);
70 void Fl_Theme_Chooser::cb_background2_color_button_i(Fl_Color_Button
* o
, void*) {
73 Fl::get_color( o
->color(), r
,g
,b
);
75 Fl::background2( r
,g
,b
);
77 o
->window()->redraw();
79 void Fl_Theme_Chooser::cb_background2_color_button(Fl_Color_Button
* o
, void* v
) {
80 ((Fl_Theme_Chooser
*)(o
->parent()))->cb_background2_color_button_i(o
,v
);
83 void Fl_Theme_Chooser::cb_foreground_color_button_i(Fl_Color_Button
* o
, void*) {
86 Fl::get_color( o
->color(), r
,g
,b
);
88 Fl::foreground( r
,g
,b
);
90 o
->window()->redraw();
92 void Fl_Theme_Chooser::cb_foreground_color_button(Fl_Color_Button
* o
, void* v
) {
93 ((Fl_Theme_Chooser
*)(o
->parent()))->cb_foreground_color_button_i(o
,v
);
95 Fl_Theme_Chooser::Fl_Theme_Chooser(int X
, int Y
, int W
, int H
, const char *L
)
96 : Fl_Double_Window(X
, Y
, W
, H
, L
) {
100 Fl_Theme_Chooser::Fl_Theme_Chooser(int W
, int H
, const char *L
)
101 : Fl_Double_Window(0, 0, W
, H
, L
) {
106 Fl_Theme_Chooser::Fl_Theme_Chooser()
107 : Fl_Double_Window(0, 0, 435, 380, "Theme") {
112 void Fl_Theme_Chooser::_Fl_Theme_Chooser() {
113 this->box(FL_FLAT_BOX
);
114 this->color(FL_BACKGROUND_COLOR
);
115 this->selection_color(FL_BACKGROUND_COLOR
);
116 this->labeltype(FL_NO_LABEL
);
119 this->labelcolor(FL_FOREGROUND_COLOR
);
120 this->align(Fl_Align(FL_ALIGN_TOP
));
121 this->when(FL_WHEN_RELEASE
);
122 { theme_choice
= new Fl_Choice(120, 20, 300, 25, "Theme:");
123 theme_choice
->down_box(FL_BORDER_BOX
);
124 theme_choice
->callback((Fl_Callback
*)cb_theme_choice
);
125 } // Fl_Choice* theme_choice
126 { color_scheme_choice
= new Fl_Choice(120, 48, 300, 25, "Color Scheme:");
127 color_scheme_choice
->down_box(FL_BORDER_BOX
);
128 color_scheme_choice
->callback((Fl_Callback
*)cb_color_scheme_choice
);
129 } // Fl_Choice* color_scheme_choice
130 { Fl_Return_Button
* o
= new Fl_Return_Button(355, 345, 75, 25, "OK");
131 o
->callback((Fl_Callback
*)cb_OK
);
132 } // Fl_Return_Button* o
133 { Fl_Group
* o
= new Fl_Group(5, 215, 425, 120, "Example");
134 o
->box(FL_ENGRAVED_FRAME
);
135 { Fl_Scrollbar
* o
= new Fl_Scrollbar(155, 240, 265, 25, "Scroll Bar");
137 o
->align(Fl_Align(FL_ALIGN_TOP
));
139 { Fl_Check_Button
* o
= new Fl_Check_Button(15, 230, 120, 15, "Check Button");
140 o
->down_box(FL_DOWN_BOX
);
141 } // Fl_Check_Button* o
142 { new Fl_Dial(155, 275, 35, 35, "Dial");
144 { Fl_Progress
* o
= new Fl_Progress(240, 300, 185, 30, "Progress");
147 { new Fl_Light_Button(15, 285, 120, 35, "Light Button");
148 } // Fl_Light_Button* o
151 { Fl_Color_Button
* o
= background_color_button
= new Fl_Color_Button(120, 76, 300, 25, "Background 1:");
152 background_color_button
->box(FL_BORDER_BOX
);
153 background_color_button
->color(FL_BACKGROUND_COLOR
);
154 background_color_button
->selection_color(FL_BACKGROUND_COLOR
);
155 background_color_button
->labeltype(FL_NORMAL_LABEL
);
156 background_color_button
->labelfont(0);
157 background_color_button
->labelsize(14);
158 background_color_button
->labelcolor(FL_FOREGROUND_COLOR
);
159 background_color_button
->callback((Fl_Callback
*)cb_background_color_button
);
160 background_color_button
->align(Fl_Align(FL_ALIGN_LEFT
));
161 background_color_button
->when(FL_WHEN_RELEASE_ALWAYS
);
162 o
->color( FL_BACKGROUND_COLOR
);
163 } // Fl_Color_Button* background_color_button
164 { Fl_Color_Button
* o
= background2_color_button
= new Fl_Color_Button(120, 104, 300, 25, "Background 2:");
165 background2_color_button
->box(FL_BORDER_BOX
);
166 background2_color_button
->color(FL_BACKGROUND_COLOR
);
167 background2_color_button
->selection_color(FL_BACKGROUND_COLOR
);
168 background2_color_button
->labeltype(FL_NORMAL_LABEL
);
169 background2_color_button
->labelfont(0);
170 background2_color_button
->labelsize(14);
171 background2_color_button
->labelcolor(FL_FOREGROUND_COLOR
);
172 background2_color_button
->callback((Fl_Callback
*)cb_background2_color_button
);
173 background2_color_button
->align(Fl_Align(FL_ALIGN_LEFT
));
174 background2_color_button
->when(FL_WHEN_RELEASE
);
175 o
->color( FL_BACKGROUND2_COLOR
);
176 } // Fl_Color_Button* background2_color_button
177 { Fl_Color_Button
* o
= foreground_color_button
= new Fl_Color_Button(120, 132, 300, 25, "Foreground:");
178 foreground_color_button
->box(FL_BORDER_BOX
);
179 foreground_color_button
->color(FL_BACKGROUND_COLOR
);
180 foreground_color_button
->selection_color(FL_BACKGROUND_COLOR
);
181 foreground_color_button
->labeltype(FL_NORMAL_LABEL
);
182 foreground_color_button
->labelfont(0);
183 foreground_color_button
->labelsize(14);
184 foreground_color_button
->labelcolor(FL_FOREGROUND_COLOR
);
185 foreground_color_button
->callback((Fl_Callback
*)cb_foreground_color_button
);
186 foreground_color_button
->align(Fl_Align(FL_ALIGN_LEFT
));
187 foreground_color_button
->when(FL_WHEN_RELEASE
);
188 o
->color( FL_FOREGROUND_COLOR
);
189 } // Fl_Color_Button* foreground_color_button
190 { selection_color_button
= new Fl_Color_Button(120, 160, 300, 25, "Selection:");
191 selection_color_button
->box(FL_BORDER_BOX
);
192 selection_color_button
->color(FL_BACKGROUND_COLOR
);
193 selection_color_button
->selection_color(FL_BACKGROUND_COLOR
);
194 selection_color_button
->labeltype(FL_NORMAL_LABEL
);
195 selection_color_button
->labelfont(0);
196 selection_color_button
->labelsize(14);
197 selection_color_button
->labelcolor(FL_FOREGROUND_COLOR
);
198 selection_color_button
->align(Fl_Align(FL_ALIGN_LEFT
));
199 selection_color_button
->when(FL_WHEN_RELEASE
);
200 selection_color_button
->hide();
201 } // Fl_Color_Button* selection_color_button
203 Fl_Theme
**ta
= Fl_Theme::get();
205 for ( Fl_Theme
**t
= ta
; *t
; t
++ )
206 theme_choice
->add( (*t
)->name() );
210 const Fl_Menu_Item
*item
= theme_choice
->find_item( Fl_Theme::current()->name() );
212 theme_choice
->value( item
);
216 Fl_Color_Scheme
**ta
= Fl_Color_Scheme::get();
218 for ( Fl_Color_Scheme
**t
= ta
; *t
; t
++ )
219 color_scheme_choice
->add( (*t
)->name() );
226 void fl_theme_chooser() {
227 Fl_Window
*w
= new Fl_Theme_Chooser();