/**************************************************************************** If do_restore is FALSE it should change the turn button style (to draw the user's attention to it). If called regularly from a timer this will give a blinking turn done button. If do_restore is TRUE this should reset the turn done button to the default style. ****************************************************************************/ void update_turn_done_button(bool do_restore) { static bool flip = FALSE; if (!get_turn_done_button_state()) { return; } if ((do_restore && flip) || !do_restore) { /* ... */ flip = !flip; } /* PORTME */ }
/************************************************************************** If do_restore is FALSE it will invert the turn done button style. If called regularly from a timer this will give a blinking turn done button. If do_restore is TRUE this will reset the turn done button to the default style. **************************************************************************/ void update_turn_done_button(bool do_restore) { static bool flip = FALSE; if (!get_turn_done_button_state()) { return; } if ((do_restore && flip) || !do_restore) { GdkGC *fore = turn_done_button->style->bg_gc[GTK_STATE_NORMAL]; GdkGC *back = turn_done_button->style->light_gc[GTK_STATE_NORMAL]; turn_done_button->style->bg_gc[GTK_STATE_NORMAL] = back; turn_done_button->style->light_gc[GTK_STATE_NORMAL] = fore; gtk_expose_now(turn_done_button); flip = !flip; } }
/************************************************************************** If do_restore is FALSE it will invert the turn done button style. If called regularly from a timer this will give a blinking turn done button. If do_restore is TRUE this will reset the turn done button to the default style. **************************************************************************/ void update_turn_done_button(bool do_restore) { static bool flip = FALSE; if (!get_turn_done_button_state()) { return; } if ((do_restore && flip) || !do_restore) { GdkColor *fore = >k_widget_get_style(turn_done_button)->bg[GTK_STATE_NORMAL]; GdkColor *back = >k_widget_get_style(turn_done_button)->light[GTK_STATE_NORMAL]; gtk_widget_get_style(turn_done_button)->bg[GTK_STATE_NORMAL] = *back; gtk_widget_get_style(turn_done_button)->light[GTK_STATE_NORMAL] = *fore; gtk_expose_now(turn_done_button); flip = !flip; } }
/************************************************************************** ... **************************************************************************/ void update_turn_done_button(bool do_restore) { static bool flip = FALSE; if (!get_turn_done_button_state()) { return; } if ((do_restore && flip) || !do_restore) { Pixel fore, back; XtVaGetValues(turn_done_button, XtNforeground, &fore, XtNbackground, &back, NULL); XtVaSetValues(turn_done_button, XtNforeground, back, XtNbackground, fore, NULL); flip = !flip; } }
static PyObject* python_get_turn_done_button_state(PyObject* self, PyObject* args) { if(PyArg_ParseTuple(args, "") == 0) return NULL; bool retval = get_turn_done_button_state(); return Py_BuildValue("i", (int)retval); }