mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
use board_canFlip() to prototype disabling flip button when useless.
This commit is contained in:
parent
43c34aa466
commit
e150db29ee
2 changed files with 14 additions and 0 deletions
|
@ -68,6 +68,7 @@ static void setCtrlsForTray( GtkAppGlobals* globals );
|
|||
static void new_game( GtkWidget* widget, GtkAppGlobals* globals );
|
||||
static void new_game_impl( GtkAppGlobals* globals, XP_Bool fireConnDlg );
|
||||
static void setZoomButtons( GtkAppGlobals* globals, XP_Bool* inOut );
|
||||
static void disenable_buttons( GtkAppGlobals* globals );
|
||||
|
||||
|
||||
#define GTK_TRAY_HT_ROWS 3
|
||||
|
@ -128,6 +129,7 @@ button_press_event( GtkWidget* XP_UNUSED(widget), GdkEventButton *event,
|
|||
event->x, event->y, &handled );
|
||||
if ( redraw ) {
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
disenable_buttons( globals );
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -146,6 +148,7 @@ motion_notify_event( GtkWidget* XP_UNUSED(widget), GdkEventMotion *event,
|
|||
event->y );
|
||||
if ( handled ) {
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
disenable_buttons( globals );
|
||||
}
|
||||
} else {
|
||||
handled = XP_FALSE;
|
||||
|
@ -168,6 +171,7 @@ button_release_event( GtkWidget* XP_UNUSED(widget), GdkEventMotion *event,
|
|||
event->y );
|
||||
if ( redraw ) {
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
disenable_buttons( globals );
|
||||
}
|
||||
globals->mouseDown = XP_FALSE;
|
||||
}
|
||||
|
@ -988,6 +992,13 @@ makeMenus( GtkAppGlobals* globals, int XP_UNUSED(argc),
|
|||
return menubar;
|
||||
} /* makeMenus */
|
||||
|
||||
static void
|
||||
disenable_buttons( GtkAppGlobals* globals )
|
||||
{
|
||||
XP_Bool canFlip = board_canFlip( globals->cGlobals.game.board );
|
||||
gtk_widget_set_sensitive( globals->flip_button, canFlip );
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_flip_button( GtkWidget* XP_UNUSED(widget), gpointer _globals )
|
||||
{
|
||||
|
@ -1018,6 +1029,7 @@ handle_hint_button( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
|
|||
#endif
|
||||
&redo ) ) {
|
||||
board_draw( globals->cGlobals.game.board );
|
||||
disenable_buttons( globals );
|
||||
}
|
||||
} /* handle_hint_button */
|
||||
|
||||
|
@ -1667,6 +1679,7 @@ makeVerticalBar( GtkAppGlobals* globals, GtkWidget* XP_UNUSED(window) )
|
|||
button = makeShowButtonFromBitmap( globals, "../flip.xpm", "f",
|
||||
G_CALLBACK(handle_flip_button) );
|
||||
gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, TRUE, 0 );
|
||||
globals->flip_button = button;
|
||||
|
||||
button = makeShowButtonFromBitmap( globals, "../value.xpm", "v",
|
||||
G_CALLBACK(handle_value_button) );
|
||||
|
|
|
@ -87,6 +87,7 @@ typedef struct GtkAppGlobals {
|
|||
/* GdkPixmap* pixmap; */
|
||||
GtkWidget* drawing_area;
|
||||
|
||||
GtkWidget* flip_button;
|
||||
GtkWidget* zoomin_button;
|
||||
GtkWidget* zoomout_button;
|
||||
|
||||
|
|
Loading…
Reference in a new issue