예제 #1
0
 public ComboBox(DwarfGUI gui, GUIComponent parent) :
     base(gui, parent)
 {
     Values               = new List <string>();
     CurrentValue         = "";
     OnLeftClicked       += ComboBox_OnLeftPressed;
     Selector             = null;
     OnSelectionModified += ComboBox_OnSelectionModified;
 }
예제 #2
0
 private void ComboBox_OnLeftPressed()
 {
     if (Selector == null)
     {
         Rectangle fieldRect = new Rectangle(GlobalBounds.X, GlobalBounds.Y + GlobalBounds.Height / 2 - GUI.Skin.TileHeight / 2, GlobalBounds.Width, 32);
         if (fieldRect.Contains(Mouse.GetState().X, Mouse.GetState().Y))
         {
             Selector                      = new ComboBoxSelector(GUI, this, Values, CurrentValue);
             GUI.FocusComponent            = Selector;
             Selector.OnSelectionModified += Selector_OnSelectionModified;
         }
     }
 }
예제 #3
0
 private void ComboBox_OnLeftPressed()
 {
     if(Selector == null)
     {
         Rectangle fieldRect = new Rectangle(GlobalBounds.X, GlobalBounds.Y + GlobalBounds.Height / 2 - GUI.Skin.TileHeight / 2, GlobalBounds.Width, 32);
         if(fieldRect.Contains(Mouse.GetState().X, Mouse.GetState().Y))
         {
             Selector = new ComboBoxSelector(GUI, this, Values, CurrentValue);
             GUI.FocusComponent = Selector;
             Selector.OnSelectionModified += Selector_OnSelectionModified;
         }
     }
 }