10 RrButton
*RrButtonNew (const RrInstance
*inst
)
14 out
= g_new(RrButton
, 1);
17 /* no need to alloc colors, set them null (for freeing later) */
18 out
->focused_unpressed_color
= NULL
;
19 out
->unfocused_unpressed_color
= NULL
;
20 out
->focused_pressed_color
= NULL
;
21 out
->unfocused_pressed_color
= NULL
;
22 out
->disabled_focused_color
= NULL
;
23 out
->disabled_unfocused_color
= NULL
;
24 out
->hover_focused_color
= NULL
;
25 out
->hover_unfocused_color
= NULL
;
26 out
->toggled_hover_focused_color
= NULL
;
27 out
->toggled_hover_unfocused_color
= NULL
;
28 out
->toggled_focused_pressed_color
= NULL
;
29 out
->toggled_unfocused_pressed_color
= NULL
;
30 out
->toggled_focused_unpressed_color
= NULL
;
31 out
->toggled_unfocused_unpressed_color
= NULL
;
35 out
->pressed_mask
= NULL
;
36 out
->disabled_mask
= NULL
;
37 out
->hover_mask
= NULL
;
38 out
->toggled_mask
= NULL
;
39 out
->toggled_hover_mask
= NULL
;
40 out
->toggled_pressed_mask
= NULL
;
42 /* allocate appearances */
43 out
->a_focused_unpressed
= RrAppearanceNew(inst
, 1);
44 out
->a_unfocused_unpressed
= RrAppearanceNew(inst
, 1);
45 out
->a_focused_pressed
= RrAppearanceNew(inst
, 1);
46 out
->a_unfocused_pressed
= RrAppearanceNew(inst
, 1);
47 out
->a_disabled_focused
= RrAppearanceNew(inst
, 1);
48 out
->a_disabled_unfocused
= RrAppearanceNew(inst
, 1);
49 out
->a_hover_focused
= RrAppearanceNew(inst
, 1);
50 out
->a_hover_unfocused
= RrAppearanceNew(inst
, 1);
51 out
->a_toggled_focused_unpressed
= RrAppearanceNew(inst
, 1);
52 out
->a_toggled_unfocused_unpressed
= RrAppearanceNew(inst
, 1);
53 out
->a_toggled_focused_pressed
= RrAppearanceNew(inst
, 1);
54 out
->a_toggled_unfocused_pressed
= RrAppearanceNew(inst
, 1);
55 out
->a_toggled_hover_focused
= RrAppearanceNew(inst
, 1);
56 out
->a_toggled_hover_unfocused
= RrAppearanceNew(inst
, 1);
61 void RrButtonFree(RrButton
*b
)
64 if (b
->focused_unpressed_color
)
65 RrColorFree(b
->focused_unpressed_color
);
66 if (b
->unfocused_unpressed_color
)
67 RrColorFree(b
->unfocused_unpressed_color
);
68 if (b
->focused_pressed_color
)
69 RrColorFree(b
->focused_pressed_color
);
70 if (b
->unfocused_pressed_color
)
71 RrColorFree(b
->unfocused_pressed_color
);
72 if (b
->disabled_focused_color
)
73 RrColorFree(b
->disabled_focused_color
);
74 if (b
->disabled_unfocused_color
)
75 RrColorFree(b
->disabled_unfocused_color
);
76 if (b
->hover_focused_color
)
77 RrColorFree(b
->hover_focused_color
);
78 if (b
->hover_unfocused_color
)
79 RrColorFree(b
->hover_unfocused_color
);
80 if (b
->toggled_hover_focused_color
)
81 RrColorFree(b
->toggled_hover_focused_color
);
82 if (b
->toggled_hover_unfocused_color
)
83 RrColorFree(b
->toggled_hover_unfocused_color
);
84 if (b
->toggled_focused_pressed_color
)
85 RrColorFree(b
->toggled_focused_pressed_color
);
86 if (b
->toggled_unfocused_pressed_color
)
87 RrColorFree(b
->toggled_unfocused_pressed_color
);
88 if (b
->toggled_focused_unpressed_color
)
89 RrColorFree(b
->toggled_focused_unpressed_color
);
90 if (b
->toggled_unfocused_unpressed_color
)
91 RrColorFree(b
->toggled_unfocused_unpressed_color
);
94 if (b
->mask
) RrPixmapMaskFree(b
->mask
);
95 if (b
->pressed_mask
) RrPixmapMaskFree(b
->pressed_mask
);
96 if (b
->disabled_mask
) RrPixmapMaskFree(b
->disabled_mask
);
97 if (b
->hover_mask
) RrPixmapMaskFree(b
->hover_mask
);
98 if (b
->toggled_mask
) RrPixmapMaskFree(b
->toggled_mask
);
99 if (b
->toggled_hover_mask
) RrPixmapMaskFree(b
->toggled_hover_mask
);
100 if (b
->toggled_pressed_mask
) RrPixmapMaskFree(b
->toggled_pressed_mask
);
103 RrAppearanceFree(b
->a_focused_unpressed
);
104 RrAppearanceFree(b
->a_unfocused_unpressed
);
105 RrAppearanceFree(b
->a_focused_pressed
);
106 RrAppearanceFree(b
->a_unfocused_pressed
);
107 RrAppearanceFree(b
->a_disabled_focused
);
108 RrAppearanceFree(b
->a_disabled_unfocused
);
109 RrAppearanceFree(b
->a_hover_focused
);
110 RrAppearanceFree(b
->a_hover_unfocused
);
111 RrAppearanceFree(b
->a_toggled_focused_unpressed
);
112 RrAppearanceFree(b
->a_toggled_unfocused_unpressed
);
113 RrAppearanceFree(b
->a_toggled_focused_pressed
);
114 RrAppearanceFree(b
->a_toggled_unfocused_pressed
);
115 RrAppearanceFree(b
->a_toggled_hover_focused
);
116 RrAppearanceFree(b
->a_toggled_hover_unfocused
);