parent
48a1ae651a
commit
8e01fb40ef
2 changed files with 45 additions and 26 deletions
|
@ -10,17 +10,14 @@
|
|||
<property name="use-header-bar">1</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-left">12</property>
|
||||
<property name="margin-right">12</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="layout-style">center</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton-queen">
|
||||
<object class="GtkButtonBox" id="button_box">
|
||||
<property name="visible">true</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="layout-style">expand</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button_queen">
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">120</property>
|
||||
<property name="visible">True</property>
|
||||
|
@ -28,6 +25,7 @@
|
|||
<property name="receives-default">True</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="image-position">top</property>
|
||||
<signal name="clicked" handler="queen_selected_cb"/>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
|
@ -70,7 +68,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton-knight">
|
||||
<object class="GtkButton" id="button_knight">
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">120</property>
|
||||
<property name="visible">True</property>
|
||||
|
@ -78,6 +76,7 @@
|
|||
<property name="receives-default">True</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="image-position">top</property>
|
||||
<signal name="clicked" handler="knight_selected_cb"/>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
|
@ -120,7 +119,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton-rook">
|
||||
<object class="GtkButton" id="button_rook">
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">120</property>
|
||||
<property name="visible">True</property>
|
||||
|
@ -128,6 +127,7 @@
|
|||
<property name="receives-default">True</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="image-position">top</property>
|
||||
<signal name="clicked" handler="rook_selected_cb"/>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
|
@ -170,7 +170,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton-bishop">
|
||||
<object class="GtkButton" id="button_bishop">
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">120</property>
|
||||
<property name="visible">True</property>
|
||||
|
@ -178,6 +178,7 @@
|
|||
<property name="receives-default">True</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="image-position">top</property>
|
||||
<signal name="clicked" handler="bishop_selected_cb"/>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
|
@ -220,20 +221,8 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack-type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">togglebutton-queen</action-widget>
|
||||
<action-widget response="1">togglebutton-knight</action-widget>
|
||||
<action-widget response="2">togglebutton-rook</action-widget>
|
||||
<action-widget response="3">togglebutton-bishop</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -61,6 +61,7 @@ public class ChessApplication : Gtk.Application
|
|||
private FileChooserNative open_dialog = null;
|
||||
private FileChooserNative? save_dialog = null;
|
||||
private AboutDialog? about_dialog = null;
|
||||
private Dialog? promotion_type_selector_dialog = null;
|
||||
|
||||
private PGNGame pgn_game;
|
||||
private ChessGame game;
|
||||
|
@ -319,11 +320,39 @@ Copyright © 2015–2016 Sahil Sareen""";
|
|||
return false;
|
||||
}
|
||||
|
||||
[CCode (cname = "queen_selected_cb", instance_pos = -1)]
|
||||
public void queen_selected_cb (Button button)
|
||||
requires (promotion_type_selector_dialog != null)
|
||||
{
|
||||
promotion_type_selector_dialog.response (PromotionTypeSelected.QUEEN);
|
||||
}
|
||||
|
||||
[CCode (cname = "knight_selected_cb", instance_pos = -1)]
|
||||
public void knight_selected_cb (Button button)
|
||||
requires (promotion_type_selector_dialog != null)
|
||||
{
|
||||
promotion_type_selector_dialog.response (PromotionTypeSelected.KNIGHT);
|
||||
}
|
||||
|
||||
[CCode (cname = "rook_selected_cb", instance_pos = -1)]
|
||||
public void rook_selected_cb (Button button)
|
||||
requires (promotion_type_selector_dialog != null)
|
||||
{
|
||||
promotion_type_selector_dialog.response (PromotionTypeSelected.KNIGHT);
|
||||
}
|
||||
|
||||
[CCode (cname = "bishop_selected_cb", instance_pos = -1)]
|
||||
public void bishop_selected_cb (Button button)
|
||||
requires (promotion_type_selector_dialog != null)
|
||||
{
|
||||
promotion_type_selector_dialog.response (PromotionTypeSelected.BISHOP);
|
||||
}
|
||||
|
||||
public PieceType? show_promotion_type_selector ()
|
||||
{
|
||||
Builder promotion_type_selector_builder = new Builder.from_resource ("/org/gnome/Chess/ui/promotion-type-selector.ui");
|
||||
var promotion_type_selector_builder = new Builder.from_resource ("/org/gnome/Chess/ui/promotion-type-selector.ui");
|
||||
|
||||
Dialog promotion_type_selector_dialog = (Dialog) promotion_type_selector_builder.get_object ("dialog_promotion_type_selector");
|
||||
promotion_type_selector_dialog = (Dialog) promotion_type_selector_builder.get_object ("dialog_promotion_type_selector");
|
||||
promotion_type_selector_dialog.transient_for = window;
|
||||
|
||||
string color;
|
||||
|
@ -364,6 +393,7 @@ Copyright © 2015–2016 Sahil Sareen""";
|
|||
break;
|
||||
}
|
||||
promotion_type_selector_dialog.destroy ();
|
||||
promotion_type_selector_dialog = null;
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue