private WarpPointCreator() : base("Warp point creator") { #region widgets init AddItem(SettingBox); SettingBox.AddItem(NameTextBox); SettingBox.AddItem(PointBox); PointButton.Clicked += new ClickEventHandler(PointButton_Clicked); PointBox.AddItem(PointButton); foreach (Direction direction in Enum.GetValues(typeof(Direction))) { Button directionButton = new Button(direction.ToString(), Button.EMode.LabelEffect); DirectionDownList.DownList.AddText(directionButton); } SettingBox.AddItem(DirectionDownList); SettingBox.AddItem(DefaultCheckBox); AddItem(ButtonBox); SaveButton.Clicked += new ClickEventHandler(SaveButton_Clicked); ButtonBox.AddItem(SaveButton); CancelButton.Clicked += new ClickEventHandler(CancelButton_Clicked); ButtonBox.AddItem(CancelButton); #endregion }
ActionCreator() : base("Action creator") { #region widgets init AddItem(ActionCreatorMainVBox); ActionCreatorMainVBox.AddItem(ActionCreatorMainHBox); ActionCreatorMainHBox.AddItem(SettingsBox); foreach (ActionType actionType in Enum.GetValues(typeof(ActionType))) { Button actionTypeButton = new Button(actionType.ToString(), Button.EMode.LabelEffect); actionTypeButton.Clicked += new ClickEventHandler(actionTypeButton_Clicked); TypeDownList.DownList.AddText(actionTypeButton); } SettingsBox.AddItem(TypeDownList); SettingsBox.AddItem(TypeConfigurableBox); TypeConfigurableBox.AddConfiguration("Warp", WarpActionBox); TypeConfigurableBox.AddConfiguration("TakeItem", TakeItemActionBox); ActionCreatorMainVBox.AddItem(ButtonBox); SaveButton.Clicked += new ClickEventHandler(SaveButton_Clicked); ButtonBox.AddItem(SaveButton); CancelButton.Clicked += new ClickEventHandler(CancelButton_Clicked); ButtonBox.AddItem(CancelButton); #endregion }
public void AddText(Button text) { text.Clicked += new ClickEventHandler(button_Clicked); AddItem(text); if (Texts.Count == 0) Top.Text = text.Text; Texts.Add(text); }
public DownList(Int32 size = BlazeraLib.ExtendedBox.DEFAULT_SIZE) : base(size, false) { Top = new Button(null, Button.EMode.LabelEffect); Top.Clicked += new ClickEventHandler(Top_Clicked); MainBox.AddItemFirst(Top); ScrollBox.SetBackgroundAlphaFactor(100D); ScrollBox.Close(); Texts = new List<Button>(); }
private ConfirmationDialogBox() : base("Confirmation") { ButtonBox = new HAutoSizeBox(); AddItem(ButtonBox, 0, HAlignment.Center); YesButton = new Button("Yes", Button.EMode.BackgroundLabel, true); YesButton.Clicked += new ClickEventHandler(YesButton_Clicked); ButtonBox.AddItem(YesButton); NoButton = new Button("No", Button.EMode.BackgroundLabel, true); NoButton.Clicked += new ClickEventHandler(NoButton_Clicked); ButtonBox.AddItem(NoButton); }
public UpDownBox( Int32 minValue = DEFAULT_MIN_VALUE, Int32 maxValue = DEFAULT_MAX_VALUE, Int32 scaleValue = DEFAULT_SCALE_VALUE, Int32 defaultValue = DEFAULT_DEFAULT_VALUE, String label = null, LabeledWidget.EMode mode = DEFAULT_MODE, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE) : base(label, mode, shortCutMode) { MinValue = minValue; MaxValue = maxValue; ScaleValue = scaleValue; DefaultValue = defaultValue; MainBox = new HAutoSizeBox(true, null, 0); ButtonBox = new VAutoSizeBox(true, null, 0); DownBtn = new Button(Create.Texture("Gui_DownButtonN"), Create.Texture("Gui_DownButtonO")); DownBtn.Dimension *= BUTTON_RESIZE_FACTOR; DownBtn.Clicked += new ClickEventHandler(DownBtn_Clicked); AddWidget(DownBtn); UpBtn = new Button(Create.Texture("Gui_UpButtonN"), Create.Texture("Gui_UpButtonO")); UpBtn.Dimension *= BUTTON_RESIZE_FACTOR; UpBtn.Clicked += new ClickEventHandler(UpBtn_Clicked); ButtonBox.AddItem(UpBtn); ButtonBox.AddItem(DownBtn); TextBox = new TextBox(BlazeraLib.TextBox.EInputType.Numeric); SetCurrentValue(GetDefaultValue()); TextBox.Dimension = new SFML.Window.Vector2f(40F, UpBtn.Dimension.Y + DownBtn.Dimension.Y); TextBox.TextAdded += new TextAddedEventHandler(TextBox_TextAdded); AddWidget(TextBox); ValueIsModified = false; MainBox.AddItem(TextBox); MainBox.AddItem(ButtonBox); AddLabeledWidget(MainBox); GetLabelWidget().Clicked += new ClickEventHandler(UpDownBox_Clicked); }
public CheckBox(Texture picture, LabeledWidget.EMode mode = LabeledWidget.DEFAULT_MODE, Boolean isChecked = DEFAULT_STATE) : base(picture, mode) { TextureN = Create.Texture("CheckBoxN"); TextureN.Dimension *= RESIZE_FACTOR; TextureC = Create.Texture("CheckBoxC"); TextureC.Dimension *= RESIZE_FACTOR; Box = new Button(TextureN, null); Box.ClickOffset = BUTTON_CLICK_OFFSET; Box.Clicked += new ClickEventHandler(Button_Clicked); GetLabelWidget().Clicked += new ClickEventHandler(Button_Clicked); AddLabeledWidget(Box); SetIsChecked(isChecked); }
public void AddText(Button text, Boolean isCurrent = false) { text.Clicked += new ClickEventHandler(button_Clicked); AddItem(text); Texts.Add(text); if (CursorMode && Texts.Count > 0) { Current = Texts[0]; Current.CallClicked(null); } ExtendedBox.Reset(); Init(); // pour eviter l'absence de resize de la box RefreshCursor(); }
public LabeledWidget(Texture picture = null, EMode mode = DEFAULT_MODE) : base() { if (picture != null) { Mode = mode; Type = EType.Picture; Picture = new Button(picture, null); Picture.Dimension = new SFML.Window.Vector2f(DEFAULT_PICTURE_SIZE, DEFAULT_PICTURE_SIZE); switch (Mode) { case EMode.Left: case EMode.Right: HBox = new HAutoSizeBox(true, null, DEFAULT_BOXPICTURE_OFFSET); AddWidget(HBox); break; case EMode.Top: case EMode.Bottom: VBox = new VAutoSizeBox(true, null, DEFAULT_BOXPICTURE_OFFSET); AddWidget(VBox); break; } } }
public LabeledWidget(String label = null, EMode mode = DEFAULT_MODE, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE) : base() { if (label != null) { Mode = mode; Type = EType.Label; Label = new Button(label, Button.EMode.Label); switch (Mode) { case EMode.Left: case EMode.Right: HBox = new HAutoSizeBox(true, null); AddWidget(HBox); break; case EMode.Top: case EMode.Bottom: VBox = new VAutoSizeBox(true, null); AddWidget(VBox); break; } ShortCutMode = shortCutMode; if (Label.Text.Length > 0) ShortCutKey = WindowEvents.KeyCodeFromString(Label.Text[0].ToString()); } }
void AddAction(BlazeraLib.Action action) { Button actionButton = new Button(action.Type.ToString(), Button.EMode.LabelEffect); actionButton.Clicked += new ClickEventHandler(actionButton_Clicked); ActionTextList.AddText(actionButton); Actions.Add(actionButton, action); }
void BBButton_Clicked(object sender, MouseButtonEventArgs e) { CurrentEditedBBButton = (Button)sender; if (e.Button == Mouse.Button.Right) { CallConfirmationDialogBox(new String[] { ConfirmationDialogBox.Instance.GetDeletionStr("Event", ((Button)sender).Text) }, OnRemoveBoundingBoxFromCurrentSelectedObjectConfirmation); return; } EBoundingBox BB = CurrentSelectedObjectExternalBoundingBoxes[CurrentEditedBBButton]; SetFocusedWindow(BoundingBoxCreator.Instance, new OpeningInfo(true, new Dictionary<String, Object>() { { "Mode", "MapHandler_Edit_Mode" }, { "BoundingBox", BB }, { "Texture", new BlazeraLib.Texture(CurrentSelectedObjectTexture) } }), OnBoundingBoxCreatorEditValidated); }
void actionButton_Clicked(object sender, SFML.Window.MouseButtonEventArgs e) { CurrentEditedActionButton = (Button)sender; if (e.Button == SFML.Window.Mouse.Button.Right) { CallConfirmationDialogBox(new String[] { ConfirmationDialogBox.Instance.GetDeletionStr("Action", CurrentEditedActionButton.Text) }, OnActionRemovingConfirmation); return; } SetFocusedWindow(ActionCreator.Instance, new OpeningInfo(true, new Dictionary<String, Object>() { { "Mode", "EventCreator_Edit_Mode" }, { "Action", Actions[CurrentEditedActionButton] } }), OnActionCreatorEditValidated); }
private InformationDialogBox() : base(null) { OkButton = new Button("Ok", Button.EMode.BackgroundLabel, true); OkButton.Clicked += new ClickEventHandler(OkButton_Clicked); AddItem(OkButton, 0, HAlignment.Center); }
void AddType(WorldObjectBaseType baseType, String type) { if (!Objects[baseType].ContainsKey(type)) Objects[baseType].Add(type, GetObjectFromType(baseType, type)); Button typeButton = new Button(type, Button.EMode.Label); typeButton.Clicked += new ClickEventHandler(typeButton_Clicked); ObjectTextList.AddText(typeButton); }
private void LoadMaps() { foreach (String mapType in FileReader.Instance.GetMapTypes()) { Button button = new Button(mapType, Button.EMode.Label); button.Name = mapType; button.Clicked += new ClickEventHandler(button_Clicked); MapList.AddText(button, CurrentMap.Type == mapType); AddMap(mapType); } }
public Boolean RemoveText(Button text) { if (!RemoveItem(text)) return false; if (!Texts.Remove(text)) return false; if (CursorMode && Texts.Count > 0) { Current = Texts[0]; Current.CallClicked(null); } RefreshCursor(); Init(); // pour eviter l'absence de resize de la box return true; }
void RemoveBoundingBoxFromCurrentSelectedObject(Button BBButton) { CurrentSelectedObject.RemoveEventBoundingBox(CurrentSelectedObjectExternalBoundingBoxes[BBButton], EventBoundingBoxType.External); CurrentSelectedObjectExternalBoundingBoxes.Remove(BBButton); SelectorToolElementEventTextList.RemoveText(BBButton); }
void RemoveAction(Button actionButton) { ActionTextList.RemoveText(actionButton); Actions.Remove(actionButton); }
void AddWarpPoint(WarpPoint warpPoint, Boolean addToMap = true, Boolean defaultWarpPoint = false) { // ajout a la TextList Button button = new Button(WarpPointCreator.Instance.WarpPointToString(warpPoint), Button.EMode.LabelEffect); button.Clicked += new ClickEventHandler(warpPointbutton_Clicked); WarpPointList.AddText(button); // ajout au dico button/warpPoint WarpPoints.Add(button, warpPoint); // ajout a la map Maps[CurrentMap.Type].AddWarpPoint(warpPoint, addToMap, defaultWarpPoint); }
void AddSelectedObject(WorldObject wObj) { if (SelectedObjects.ContainsKey(wObj.Id)) return; Button objectButton = new Button(wObj.Id, Button.EMode.Label); SelectedObjects.Add(objectButton.Text, wObj); objectButton.Clicked += new ClickEventHandler(objectButton_Clicked); SelectorTextList.AddText(objectButton); SelectorToolSelectorObjectCountLabel.Text = "( " + SelectedObjects.Count + " )"; }
void warpPointbutton_Clicked(object sender, SFML.Window.MouseButtonEventArgs e) { CurrentWarpPointButton = (Button)sender; CurrentWarpPoint = WarpPoints[CurrentWarpPointButton]; // clique droit --> suppression if (e.Button == Mouse.Button.Right) { WarpPointToRemove = CurrentWarpPoint; if (WarpPoints.Count > 1) CallConfirmationDialogBox(new String[] { ConfirmationDialogBox.Instance.GetDeletionStr("WarpPoint", CurrentWarpPointButton.Text) }, RemoveWarpPoint); else CallInformationDialogBox(InformationDialogBox.EType.Error, new String[] { InformationDialogBox.Instance.GetDeletionErrorStr("WarpPoint", CurrentWarpPointButton.Text) }); return; } // clique gauche --> edit SetFocusedWindow(WarpPointCreator.Instance, new OpeningInfo( true, new Dictionary<String, Object> { { "Name", CurrentWarpPoint.Name }, { "Point", CurrentWarpPoint.Point }, { "Direction", CurrentWarpPoint.Direction }, { "Default", CurrentMap.DefaultWarpPoint == CurrentWarpPoint } }), CurrentWarpPointPointCreator_Validated); }
public Item(Texture picture, LabeledWidget.EMode mode = LabeledWidget.DEFAULT_MODE, Boolean isChecked = DEFAULT_STATE) : base(picture, mode) { TextureN = Create.Texture("Gui_RadioButtonN"); TextureN.Dimension *= RESIZE_FACTOR; TextureC = Create.Texture("Gui_RadioButtonC"); TextureC.Dimension *= RESIZE_FACTOR; Box = new Button(TextureN, null); Box.Clicked += new ClickEventHandler(Button_Clicked); GetLabelWidget().Clicked += new ClickEventHandler(Button_Clicked); AddLabeledWidget(Box); SetIsChecked(isChecked); IsActive = true; }
void InitBaseTypes() { foreach (WorldObjectBaseType baseType in Enum.GetValues(typeof(WorldObjectBaseType))) { Objects.Add(baseType, new Dictionary<String, WorldObject>()); Button baseTypeButton = new Button(baseType.ToString(), Button.EMode.LabelEffect); ObjectBaseTypeDownList.AddText(baseTypeButton); baseTypeButton.Clicked += new ClickEventHandler(baseTypeButton_Clicked); } }
void AddBoundingBoxToCurrentSelectedObject(EBoundingBox BB) { Button BBButton = new Button(BoundingBoxCreator.Instance.BBToString(BB), Button.EMode.LabelEffect); BBButton.Clicked += new ClickEventHandler(BBButton_Clicked); SelectorToolElementEventTextList.AddText(BBButton); CurrentSelectedObjectExternalBoundingBoxes.Add(BBButton, BB); }