1
1
use std:: cell:: RefCell ;
2
2
use std:: rc:: Rc ;
3
3
4
- use fltk:: { app, widget , widget_extends , draw:: * } ;
4
+ use fltk:: { app, draw:: * , widget , widget_extends } ;
5
5
use fltk:: enums:: { Color , Event , FrameType , Key } ;
6
6
use fltk:: prelude:: { WidgetBase , WidgetExt } ;
7
7
use mina:: { Animate , prelude:: * } ;
@@ -17,13 +17,9 @@ struct ButtonColorState {
17
17
border_g : u8 ,
18
18
border_b : u8 ,
19
19
20
- fill1_r : u8 ,
21
- fill1_g : u8 ,
22
- fill1_b : u8 ,
23
-
24
- fill2_r : u8 ,
25
- fill2_g : u8 ,
26
- fill2_b : u8 ,
20
+ fill_r : u8 ,
21
+ fill_g : u8 ,
22
+ fill_b : u8 ,
27
23
28
24
text_r : u8 ,
29
25
text_g : u8 ,
@@ -32,7 +28,6 @@ struct ButtonColorState {
32
28
33
29
pub struct CustomButton {
34
30
inner : widget:: Widget ,
35
- // state: Rc<RefCell<ButtonColorState>>,
36
31
}
37
32
38
33
#[ derive( Clone , Default , PartialEq , State ) ]
@@ -129,12 +124,9 @@ impl CustomButton {
129
124
border_r: dialog_theme. style_button_inactive. color_button_border. to_rgb( ) . 0 ,
130
125
border_g: dialog_theme. style_button_inactive. color_button_border. to_rgb( ) . 1 ,
131
126
border_b: dialog_theme. style_button_inactive. color_button_border. to_rgb( ) . 2 ,
132
- fill1_r: dialog_theme. style_button_inactive. color_button_background. 0 . to_rgb( ) . 0 ,
133
- fill1_g: dialog_theme. style_button_inactive. color_button_background. 0 . to_rgb( ) . 1 ,
134
- fill1_b: dialog_theme. style_button_inactive. color_button_background. 0 . to_rgb( ) . 2 ,
135
- fill2_r: dialog_theme. style_button_inactive. color_button_background. 1 . to_rgb( ) . 0 ,
136
- fill2_g: dialog_theme. style_button_inactive. color_button_background. 1 . to_rgb( ) . 1 ,
137
- fill2_b: dialog_theme. style_button_inactive. color_button_background. 1 . to_rgb( ) . 2 ,
127
+ fill_r: dialog_theme. style_button_inactive. color_button_background. to_rgb( ) . 0 ,
128
+ fill_g: dialog_theme. style_button_inactive. color_button_background. to_rgb( ) . 1 ,
129
+ fill_b: dialog_theme. style_button_inactive. color_button_background. to_rgb( ) . 2 ,
138
130
text_r: dialog_theme. style_button_inactive. color_button_text. to_rgb( ) . 0 ,
139
131
text_g: dialog_theme. style_button_inactive. color_button_text. to_rgb( ) . 1 ,
140
132
text_b: dialog_theme. style_button_inactive. color_button_text. to_rgb( ) . 2 ,
@@ -146,12 +138,9 @@ impl CustomButton {
146
138
border_r: dialog_theme. style_button_hover. color_button_border. to_rgb( ) . 0 ,
147
139
border_g: dialog_theme. style_button_hover. color_button_border. to_rgb( ) . 1 ,
148
140
border_b: dialog_theme. style_button_hover. color_button_border. to_rgb( ) . 2 ,
149
- fill1_r: dialog_theme. style_button_hover. color_button_background. 0 . to_rgb( ) . 0 ,
150
- fill1_g: dialog_theme. style_button_hover. color_button_background. 0 . to_rgb( ) . 1 ,
151
- fill1_b: dialog_theme. style_button_hover. color_button_background. 0 . to_rgb( ) . 2 ,
152
- fill2_r: dialog_theme. style_button_hover. color_button_background. 1 . to_rgb( ) . 0 ,
153
- fill2_g: dialog_theme. style_button_hover. color_button_background. 1 . to_rgb( ) . 1 ,
154
- fill2_b: dialog_theme. style_button_hover. color_button_background. 1 . to_rgb( ) . 2 ,
141
+ fill_r: dialog_theme. style_button_hover. color_button_background. to_rgb( ) . 0 ,
142
+ fill_g: dialog_theme. style_button_hover. color_button_background. to_rgb( ) . 1 ,
143
+ fill_b: dialog_theme. style_button_hover. color_button_background. to_rgb( ) . 2 ,
155
144
text_r: dialog_theme. style_button_hover. color_button_text. to_rgb( ) . 0 ,
156
145
text_g: dialog_theme. style_button_hover. color_button_text. to_rgb( ) . 1 ,
157
146
text_b: dialog_theme. style_button_hover. color_button_text. to_rgb( ) . 2 ,
@@ -162,12 +151,9 @@ impl CustomButton {
162
151
border_r: dialog_theme. style_button_pressed. color_button_border. to_rgb( ) . 0 ,
163
152
border_g: dialog_theme. style_button_pressed. color_button_border. to_rgb( ) . 1 ,
164
153
border_b: dialog_theme. style_button_pressed. color_button_border. to_rgb( ) . 2 ,
165
- fill1_r: dialog_theme. style_button_pressed. color_button_background. 0 . to_rgb( ) . 0 ,
166
- fill1_g: dialog_theme. style_button_pressed. color_button_background. 0 . to_rgb( ) . 1 ,
167
- fill1_b: dialog_theme. style_button_pressed. color_button_background. 0 . to_rgb( ) . 2 ,
168
- fill2_r: dialog_theme. style_button_pressed. color_button_background. 1 . to_rgb( ) . 0 ,
169
- fill2_g: dialog_theme. style_button_pressed. color_button_background. 1 . to_rgb( ) . 1 ,
170
- fill2_b: dialog_theme. style_button_pressed. color_button_background. 1 . to_rgb( ) . 2 ,
154
+ fill_r: dialog_theme. style_button_pressed. color_button_background. to_rgb( ) . 0 ,
155
+ fill_g: dialog_theme. style_button_pressed. color_button_background. to_rgb( ) . 1 ,
156
+ fill_b: dialog_theme. style_button_pressed. color_button_background. to_rgb( ) . 2 ,
171
157
text_r: dialog_theme. style_button_pressed. color_button_text. to_rgb( ) . 0 ,
172
158
text_g: dialog_theme. style_button_pressed. color_button_text. to_rgb( ) . 1 ,
173
159
text_b: dialog_theme. style_button_pressed. color_button_text. to_rgb( ) . 2 ,
@@ -178,12 +164,9 @@ impl CustomButton {
178
164
border_r: dialog_theme. style_button_focused. color_button_border. to_rgb( ) . 0 ,
179
165
border_g: dialog_theme. style_button_focused. color_button_border. to_rgb( ) . 1 ,
180
166
border_b: dialog_theme. style_button_focused. color_button_border. to_rgb( ) . 2 ,
181
- fill1_r: dialog_theme. style_button_focused. color_button_background. 0 . to_rgb( ) . 0 ,
182
- fill1_g: dialog_theme. style_button_focused. color_button_background. 0 . to_rgb( ) . 1 ,
183
- fill1_b: dialog_theme. style_button_focused. color_button_background. 0 . to_rgb( ) . 2 ,
184
- fill2_r: dialog_theme. style_button_focused. color_button_background. 1 . to_rgb( ) . 0 ,
185
- fill2_g: dialog_theme. style_button_focused. color_button_background. 1 . to_rgb( ) . 1 ,
186
- fill2_b: dialog_theme. style_button_focused. color_button_background. 1 . to_rgb( ) . 2 ,
167
+ fill_r: dialog_theme. style_button_focused. color_button_background. to_rgb( ) . 0 ,
168
+ fill_g: dialog_theme. style_button_focused. color_button_background. to_rgb( ) . 1 ,
169
+ fill_b: dialog_theme. style_button_focused. color_button_background. to_rgb( ) . 2 ,
187
170
text_r: dialog_theme. style_button_focused. color_button_text. to_rgb( ) . 0 ,
188
171
text_g: dialog_theme. style_button_focused. color_button_text. to_rgb( ) . 1 ,
189
172
text_b: dialog_theme. style_button_focused. color_button_text. to_rgb( ) . 2 ,
@@ -274,7 +257,7 @@ impl CustomButton {
274
257
let state = animator. current_values ( ) ;
275
258
276
259
draw_box ( FrameType :: FlatBox , i. x ( ) , i. y ( ) , i. w ( ) , i. h ( ) , Color :: Background2 ) ;
277
- draw_improved_rbox ( i. x ( ) , i. y ( ) , i. w ( ) , i. h ( ) , state. border_radius , true , Color :: from_rgb ( state. fill1_r , state. fill1_g , state. fill1_b ) ) ;
260
+ draw_improved_rbox ( i. x ( ) , i. y ( ) , i. w ( ) , i. h ( ) , state. border_radius , true , Color :: from_rgb ( state. fill_r , state. fill_g , state. fill_b ) ) ;
278
261
draw_improved_rbox ( i. x ( ) , i. y ( ) , i. w ( ) , i. h ( ) , state. border_radius , false , Color :: from_rgb ( state. border_r , state. border_g , state. border_b ) ) ;
279
262
280
263
set_font ( i. label_font ( ) , i. label_size ( ) ) ;
0 commit comments