2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
static void CheckButton_toggle(CheckButton* self) {
|
2013-03-15 13:11:33 +00:00
|
|
|
self->state.checked = self->checked();
|
|
|
|
if(self->p.locked == false && self->onToggle) self->onToggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool pCheckButton::checked() {
|
|
|
|
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkWidget));
|
|
|
|
}
|
|
|
|
|
|
|
|
Size pCheckButton::minimumSize() {
|
|
|
|
Size size = pFont::size(widget.state.font, checkButton.state.text);
|
|
|
|
return {size.width + 28, size.height + 4};
|
|
|
|
}
|
|
|
|
|
|
|
|
void pCheckButton::setChecked(bool checked) {
|
|
|
|
locked = true;
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkWidget), checked);
|
|
|
|
locked = false;
|
|
|
|
}
|
|
|
|
|
2013-05-05 09:21:30 +00:00
|
|
|
void pCheckButton::setText(string text) {
|
2013-03-15 13:11:33 +00:00
|
|
|
gtk_button_set_label(GTK_BUTTON(gtkWidget), text);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pCheckButton::constructor() {
|
|
|
|
gtkWidget = gtk_check_button_new_with_label("");
|
|
|
|
g_signal_connect_swapped(G_OBJECT(gtkWidget), "toggled", G_CALLBACK(CheckButton_toggle), (gpointer)&checkButton);
|
|
|
|
|
|
|
|
setChecked(checkButton.state.checked);
|
|
|
|
setText(checkButton.state.text);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pCheckButton::destructor() {
|
|
|
|
gtk_widget_destroy(gtkWidget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pCheckButton::orphan() {
|
|
|
|
destructor();
|
|
|
|
constructor();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|