public XMSettingsScreen() { _options = new TextList(); Add( _options ); _email = new TextWindow(); Add( _email ); _emailEntry = new TextEntry(); Add( _emailEntry ); _password = new TextWindow(); Add( _password ); _passwordEntry = new TextEntry(); Add( _passwordEntry ); _emailEntry.Accept += new EventHandler(EmailEntry_Accept); _emailEntry.Cancel += new EventHandler(EmailEntry_Cancel); _passwordEntry.Accept += new EventHandler(PasswordEntry_Accept); _passwordEntry.Cancel += new EventHandler(PasswordEntry_Cancel); _options.Focus(); _options.ItemActivated += new ItemActivatedEventHandler( OnItemActivated ); return; }
public iTunesSearchScreen() { _options = new TextList(); Add( _options ); _search = new TextWindow(); Add( _search ); _searchEntry = new TextEntry(); Add( _searchEntry ); _searchEntry.Accept += new EventHandler(SearchEntry_Accept); _searchEntry.Cancel += new EventHandler(SearchEntry_Cancel); _options.Focus(); _options.ItemActivated += new ItemActivatedEventHandler( OnItemActivated ); return; }
public bool DeleteEntry(TextEntry entry) => false;
public SshCredentialsWidget(SshUserKeyCredentials creds) { Credentials = creds ?? new SshUserKeyCredentials(); DefaultRowSpacing = XwtCredentialsDialog.InputContainerContainerSpacing; int inputContainerCurrentRow = 0; var privateKeyLocationLabel = new Label(GettextCatalog.GetString("Private Key:")) { MinWidth = XwtCredentialsDialog.DefaultlLabelWidth, TextAlignment = Alignment.End }; Add(privateKeyLocationLabel, 0, inputContainerCurrentRow, hexpand: false, vpos: WidgetPlacement.Center); var privateKeyLocationContainer = new HBox(); Add(privateKeyLocationContainer, 1, inputContainerCurrentRow, hexpand: true); privateKeyLocationTextEntry = new TextEntry { Text = Credentials.PrivateKey ?? string.Empty }; privateKeyLocationTextEntry.Accessible.LabelWidget = privateKeyLocationLabel; privateKeyLocationTextEntry.Changed += PrivateKeyLocationTextEntry_Changed; privateKeyLocationContainer.PackStart(privateKeyLocationTextEntry, true, vpos: WidgetPlacement.Center); warningPrivateKey = new InformationPopoverWidget { Severity = Ide.Tasks.TaskSeverity.Warning }; privateKeyLocationContainer.PackStart(warningPrivateKey); privateKeyLocationButton = new Button("…"); privateKeyLocationButton.Accessible.LabelWidget = privateKeyLocationLabel; privateKeyLocationButton.Accessible.Title = GettextCatalog.GetString("Select a key file"); privateKeyLocationContainer.PackStart(privateKeyLocationButton); inputContainerCurrentRow++; //Public key location var publicKeyLocationLabel = new Label(GettextCatalog.GetString("Public Key:")) { MinWidth = XwtCredentialsDialog.DefaultlLabelWidth, TextAlignment = Alignment.End }; Add(publicKeyLocationLabel, 0, inputContainerCurrentRow, hexpand: false, vpos: WidgetPlacement.Center); var publicKeyLocationContainer = new HBox(); Add(publicKeyLocationContainer, 1, inputContainerCurrentRow, hexpand: true); publicKeyLocationTextEntry = new TextEntry { Text = Credentials.PublicKey ?? string.Empty }; publicKeyLocationTextEntry.Accessible.LabelWidget = publicKeyLocationLabel; publicKeyLocationTextEntry.Changed += PublicKeyLocationTextEntry_Changed; publicKeyLocationContainer.PackStart(publicKeyLocationTextEntry, true, vpos: WidgetPlacement.Center); warningPublicKey = new InformationPopoverWidget { Severity = Ide.Tasks.TaskSeverity.Warning }; publicKeyLocationContainer.PackStart(warningPublicKey); publicKeyLocationButton = new Button("…"); publicKeyLocationButton.Accessible.LabelWidget = publicKeyLocationLabel; publicKeyLocationButton.Accessible.Title = GettextCatalog.GetString("Select a key file"); publicKeyLocationContainer.PackStart(publicKeyLocationButton); inputContainerCurrentRow++; //password container var passwordLabel = new Label() { TextAlignment = Alignment.End, Text = GettextCatalog.GetString("Passphrase:"), MinWidth = XwtCredentialsDialog.DefaultlLabelWidth }; Add(passwordLabel, 0, inputContainerCurrentRow, hexpand: false, vpos: WidgetPlacement.Center); passphraseEntry = new PasswordEntry() { MarginTop = 5 }; passphraseEntry.Accessible.LabelWidget = passwordLabel; Add(passphraseEntry, 1, inputContainerCurrentRow, hexpand: true, vpos: WidgetPlacement.Center, marginRight: Toolkit.CurrentEngine.Type == ToolkitType.XamMac ? 1 : -1); passphraseEntry.Changed += PasswordEntry_Changed; privateKeyLocationButton.Clicked += PrivateKeyLocationButton_Clicked; publicKeyLocationButton.Clicked += PublicKeyLocationButton_Clicked; OnCredentialsChanged(); }
public TextEntries() { TextEntry te1 = new TextEntry(); PackStart(te1); te1.BackgroundColor = Xwt.Drawing.Colors.Red; Label la = new Label(); PackStart(la); te1.Changed += delegate { la.Text = "Text: " + te1.Text; }; HBox selBox = new HBox(); Label las = new Label("Selection:"); selBox.PackStart(las); Button selReplace = new Button("Replace"); selReplace.Clicked += delegate { te1.SelectedText = "[TEST]"; }; selBox.PackEnd(selReplace); Button selAll = new Button("Select all"); selAll.Clicked += delegate { te1.SelectionStart = 0; te1.SelectionLength = te1.Text.Length; }; selBox.PackEnd(selAll); Button selPlus = new Button("+"); selPlus.Clicked += delegate { te1.SelectionLength++; }; selBox.PackEnd(selPlus); Button selRight = new Button(">"); selRight.Clicked += delegate { te1.SelectionStart++; }; selBox.PackEnd(selRight); PackStart(selBox); te1.SelectionChanged += delegate { las.Text = "Selection: (" + te1.CursorPosition + " <-> " + te1.SelectionStart + " + " + te1.SelectionLength + ") " + te1.SelectedText; }; PackStart(new Label("Entry with small font")); TextEntry te2 = new TextEntry(); te2.Font = te2.Font.WithScaledSize(0.5); te2.PlaceholderText = "Placeholder text"; PackStart(te2); PackStart(new TextEntry { Text = "Entry with custom height", MinHeight = 50 }); PackStart(new TextEntry { Text = "Readonly text", ReadOnly = true }); PackStart(new Label("Entry with placeholder text")); TextEntry te3 = new TextEntry(); te3.PlaceholderText = "Placeholder text"; PackStart(te3); PackStart(new Label("Entry with no frame")); TextEntry te4 = new TextEntry(); te4.ShowFrame = false; PackStart(te4); PackStart(new Label("Entry with custom frame")); FrameBox teFrame = new FrameBox(); teFrame.BorderColor = Xwt.Drawing.Colors.Red; teFrame.BorderWidth = 1; teFrame.Content = new TextEntry() { ShowFrame = false }; PackStart(teFrame); TextEntry te5 = new TextEntry(); te5.Text = "I should be centered!"; te5.TextAlignment = Alignment.Center; te5.PlaceholderText = "Placeholder text"; PackStart(te5); TextEntry te6 = new TextEntry(); te6.Text = "I should have" + Environment.NewLine + "multiple lines!"; te6.PlaceholderText = "Placeholder text"; te6.MultiLine = true; te6.MinHeight = 40; PackStart(te6); try { SearchTextEntry te7 = new SearchTextEntry(); te7.PlaceholderText = "Type to search ..."; PackStart(te7); SearchTextEntry te8 = new SearchTextEntry(); te8.PlaceholderText = "I should have no frame"; te8.ShowFrame = false; PackStart(te8); } catch (InvalidOperationException ex) { Console.WriteLine(ex); } }
public bool AddEntry(TextEntry entry) => false;
public MainWindow(GameConfig config, bool forceNoMovies) { this.config = config; Title = "Librelancer Launcher"; Resizable = false; var mainBox = new VBox() { Spacing = 6 }; //Directory var dirbox = new HBox() { Spacing = 2 }; mainBox.PackStart(new Label() { Text = "Freelancer Directory: " }); dirbox.PackStart((textInput = new TextEntry()), true, true); textInput.Text = config.FreelancerPath; var btnChooseFolder = new Button() { Label = " ... " }; btnChooseFolder.Clicked += BtnChooseFolder_Clicked; dirbox.PackStart(btnChooseFolder); mainBox.PackStart(dirbox); //Options skipMovies = new CheckBox() { Label = "Skip Intro Movies" }; if (forceNoMovies) { skipMovies.Active = true; skipMovies.Sensitive = false; } else { skipMovies.Active = !config.IntroMovies; } var smbox = new HBox(); smbox.PackStart(skipMovies); mainBox.PackStart(smbox); muteMusic = new CheckBox() { Label = "Mute Music" }; muteMusic.Active = config.MuteMusic; mainBox.PackStart(muteMusic); vsync = new CheckBox() { Label = "VSync" }; vsync.Active = config.VSync; mainBox.PackStart(vsync); //Resolution resWidthBox = new TextEntry(); resWidthBox.Text = config.BufferWidth.ToString(); resWidthBox.TextInput += Masking; resHeightBox = new TextEntry(); resHeightBox.Text = config.BufferHeight.ToString(); resHeightBox.TextInput += Masking; var hboxResolution = new HBox(); hboxResolution.PackEnd(resHeightBox); hboxResolution.PackEnd(new Label() { Text = "x" }); hboxResolution.PackEnd(resWidthBox); hboxResolution.PackStart(new Label() { Text = "Resolution:" }); mainBox.PackStart(hboxResolution); //Launch var launchbox = new HBox() { Spacing = 2 }; var btnLaunch = new Button("Launch"); btnLaunch.Clicked += BtnLaunch_Clicked; launchbox.PackEnd(btnLaunch); mainBox.PackEnd(launchbox); //Finish CloseRequested += MainWindow_CloseRequested; Content = mainBox; }
public TextEntries() { TextEntry te1 = new TextEntry(); PackStart(te1); Label la = new Label(); PackStart(la); te1.Changed += delegate { la.Text = "Text: " + te1.Text; }; HBox selBox = new HBox(); Label las = new Label("Selection:"); selBox.PackStart(las); Button selReplace = new Button("Replace"); selReplace.Clicked += delegate { te1.SelectedText = "[TEST]"; }; selBox.PackEnd(selReplace); Button selAll = new Button("Select all"); selAll.Clicked += delegate { te1.SelectionStart = 0; te1.SelectionLength = te1.Text.Length; }; selBox.PackEnd(selAll); Button selPlus = new Button("+"); selPlus.Clicked += delegate { te1.SelectionLength++; }; selBox.PackEnd(selPlus); Button selRight = new Button(">"); selRight.Clicked += delegate { te1.SelectionStart++; }; selBox.PackEnd(selRight); PackStart(selBox); te1.SelectionChanged += delegate { las.Text = "Selection: (" + te1.CursorPosition + " <-> " + te1.SelectionStart + " + " + te1.SelectionLength + ") " + te1.SelectedText; }; PackStart(new Label("Entry with small font")); TextEntry te2 = new TextEntry(); te2.Font = te2.Font.WithScaledSize(0.5); PackStart(te2); PackStart(new Label("Entry with placeholder text")); TextEntry te3 = new TextEntry(); te3.PlaceholderText = "Placeholder text"; PackStart(te3); PackStart(new Label("Entry with no frame")); TextEntry te4 = new TextEntry(); te4.ShowFrame = false; PackStart(te4); TextEntry te5 = new TextEntry(); te5.Text = "I should be centered!"; te5.TextAlignment = Alignment.Center; PackStart(te5); TextEntry te6 = new TextEntry(); te6.Text = "I should have" + Environment.NewLine + "multiple lines!"; te6.MultiLine = true; PackStart(te6); }
// Previewer public IList <Bitmap> GeneratePreviews(TextEntry entry) { var pages = new List <Bitmap>(); if (entry?.EditedText == null) { return(pages); } string kuriimuString = GetKuriimuString(entry.EditedText); int boxes = kuriimuString.Count(c => c == (char)0x17) + 1; Bitmap img = new Bitmap(textBox.Width, textBox.Height * boxes); using (Graphics gfx = Graphics.FromImage(img)) { gfx.SmoothingMode = SmoothingMode.HighQuality; gfx.InterpolationMode = InterpolationMode.Bicubic; gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; for (int i = 0; i < boxes; i++) { gfx.DrawImage(textBox, 0, i * textBox.Height); } RectangleF rectText = new RectangleF(10, 10, 370, 100); Color colorDefault = Color.FromArgb(255, 255, 255, 255); float scaleDefault = 1.0f; //float scaleName = 0.86f; float scaleCurrent = scaleDefault; float x = rectText.X, pX = x; float y = rectText.Y, pY = y; //float yAdjust = 4; //int box = 0; //font.SetTextColor(colorDefault); for (int i = 0; i < kuriimuString.Length; i++) { if (kuriimuString[i] == ' ') { x += 5; } else if (kuriimuString[i] == '\xa') { x = rectText.X; y += 15; } else { var info = font.GetWidthInfo(kuriimuString[i]); x += info.left; font.Draw(kuriimuString[i], gfx, x, y, scaleDefault, scaleDefault); x += info.glyph_width - info.left; } } } pages.Add(img); return(pages); }
/// <summary> /// Shows the text which is stored in the given menu entry /// </summary> /// <param name="entry">The text entry determines the text content</param> public void ShowText(TextDisplayEntry entry) { currentEntry = entry; CreateText(); }
public LoginView(LauncherWindow window) { Window = window; this.MinWidth = 250; ErrorLabel = new Label("Username or password incorrect") { TextColor = Color.FromBytes(255, 0, 0), TextAlignment = Alignment.Center, Visible = false }; UsernameText = new TextEntry(); PasswordText = new PasswordEntry(); LogInButton = new Button("Log In"); RegisterButton = new Button("Register"); OfflineButton = new Button("Play Offline"); RememberCheckBox = new CheckBox("Remember Me"); UsernameText.Text = UserSettings.Local.Username; if (UserSettings.Local.AutoLogin) { PasswordText.Password = UserSettings.Local.Password; RememberCheckBox.Active = true; } using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.truecraft_logo.png")) TrueCraftLogoImage = new ImageView(Image.FromStream(stream).WithBoxSize(350, 75)); UsernameText.PlaceholderText = "Username"; PasswordText.PlaceholderText = "Password"; PasswordText.KeyReleased += (sender, e) => { if (e.Key == Key.Return || e.Key == Key.NumPadEnter) { LogInButton_Clicked(sender, e); } }; UsernameText.KeyReleased += (sender, e) => { if (e.Key == Key.Return || e.Key == Key.NumPadEnter) { LogInButton_Clicked(sender, e); } }; RegisterButton.Clicked += (sender, e) => { Window.WebView.Url = "https://truecraft.io/register"; }; OfflineButton.Clicked += (sender, e) => { Window.User.Username = UsernameText.Text; Window.User.SessionId = "-"; Window.InteractionBox.Remove(this); Window.InteractionBox.PackEnd(Window.MainMenuView = new MainMenuView(Window)); }; var regoffbox = new HBox(); RegisterButton.WidthRequest = OfflineButton.WidthRequest = 0.5; regoffbox.PackStart(RegisterButton, true); regoffbox.PackStart(OfflineButton, true); LogInButton.Clicked += LogInButton_Clicked; this.PackEnd(regoffbox); this.PackEnd(LogInButton); this.PackEnd(RememberCheckBox); this.PackEnd(PasswordText); this.PackEnd(UsernameText); this.PackEnd(ErrorLabel); }
public void AddText(TextEntry text) { texts.Add(text); }
// Previewer public IList <Bitmap> GeneratePreviews(TextEntry entry) { var pages = new List <Bitmap>(); if (entry?.EditedText == null) { return(pages); } string rawString = GetKuriimuString(entry.EditedText); var pagestr = new List <string>(); int curline = 0; string curstr = ""; foreach (string line in rawString.Split('\n')) { curstr += line + '\n'; curline++; if (curline % 3 == 0) { pagestr.Add(curstr); curstr = ""; } } if (curline % 3 != 0) { pagestr.Add(curstr); } foreach (string page in pagestr) { string p = GetRawString(page).Replace("\xE\x1\x0\x0", Properties.Settings.Default.PlayerName == string.Empty ? "Player" : Properties.Settings.Default.PlayerName); if (p.Trim() != string.Empty) { Bitmap img = new Bitmap(400, 240); using (Graphics gfx = Graphics.FromImage(img)) { gfx.SmoothingMode = SmoothingMode.HighQuality; gfx.InterpolationMode = InterpolationMode.Bicubic; gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; gfx.DrawImage(background, 0, 0); gfx.DrawImage(textBox, 0, 240 - textBox.Height); // Text Rectangle rectText = new Rectangle(32, 20, 336, 44); float scale = 1.0f; float x = rectText.X, y = 240 - textBox.Height + 20; bool cmd = false; string param = "", temp = ""; int skip = 0, j = 0, padding = 0; font.SetColor(Color.FromArgb(255, 80, 80, 80)); gfx.InterpolationMode = InterpolationMode.Bicubic; foreach (char c in p) { switch (param) { case "\x0\x3\x2\x9\x0": font.SetColor(Color.Blue); goto case "cleanup"; case "\x0\x3\x2\xA\x0": font.SetColor(Color.Red); goto case "cleanup"; case "\x0\x3\x2\xB\x0": font.SetColor(Color.Cyan); goto case "cleanup"; case "\x0\x3\x2\xFF\xFF": font.SetColor(Color.FromArgb(255, 80, 80, 80)); goto case "cleanup"; case "\x1\x2": case "\x1\x3": case "\x1\x4": case "\x1\xA": temp = "UNKNOWN"; font.SetColor(Color.Blue); skip = 1; goto case "placeholder"; case "\x0\x2\x2": // font size scale = (float)c / 100.0f; skip = 2; goto case "cleanup"; case "\x1\x8\x2": // pause (useless) case "\x1\x7\x2": skip = 2; goto case "cleanup"; case "\x1\x10\x0": // textbox effects (useless) case "\x1\xC\x0": case "\x1\xD\x0": case "\x1\xE\x0": case "\x1\xF\x0": goto case "cleanup"; case "\x1\x11\x4": // text padding x += c; padding = p[j + 2] / 2 - 4; y += padding; skip = 4; goto case "cleanup"; case "\x1\x5\x6": // value temp = "00"; skip = 6; goto case "placeholder"; case "\x2\x0\x2": // npc temp = npc_name[c]; font.SetColor(Color.Blue); skip = 2; goto case "placeholder"; case "\x2\x1\x4": // map temp = loc_name[c]; font.SetColor(Color.Blue); skip = 4; goto case "placeholder"; case "\x2\x2\x4": // item temp = it_name[c]; font.SetColor(Color.Blue); skip = 4; goto case "placeholder"; case "placeholder": foreach (char t in temp) { font.Draw(t, gfx, x, y, scale, scale); x += font.GetWidthInfo(t).char_width *scale; } font.SetColor(Color.FromArgb(255, 80, 80, 80)); goto case "cleanup"; case "cleanup": param = ""; cmd = false; break; } j++; if (!cmd && skip == 0) { switch (c) { case '\n': x = rectText.X; y += rectText.Y; continue; case '\xE': cmd = true; param = ""; continue; } } if (cmd) { param += c; } else if (skip > 0) { skip--; } else { font.Draw(c, gfx, x, y, scale, scale); x += font.GetWidthInfo(c).char_width *scale; } } } pages.Add(img); } } return(pages); }
// Previewer public IList <Bitmap> GeneratePreviews(TextEntry entry) { var pages = new List <Bitmap>(); if (entry == null) { return(pages); } string kuriimuString = GetKuriimuString(entry.EditedText); int boxes = kuriimuString.Count(c => c == (char)0x17) + 1; Bitmap img = new Bitmap(textBox.Width, textBox.Height * boxes); Encoding unicode = Encoding.GetEncoding("unicode"); Encoding sjis = Encoding.GetEncoding("SJIS"); using (Graphics gfx = Graphics.FromImage(img)) { gfx.SmoothingMode = SmoothingMode.HighQuality; gfx.InterpolationMode = InterpolationMode.Bicubic; gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; for (int i = 0; i < boxes; i++) { gfx.DrawImage(textBox, 0, i * textBox.Height); } RectangleF rectText = new RectangleF(10, 10, 370, 100); Color colorDefault = Color.FromArgb(255, 255, 255, 255); float scaleDefault = 1.0f; //float scaleName = 0.86f; float scaleCurrent = scaleDefault; float x = rectText.X, pX = x; float y = rectText.Y, pY = y; //float yAdjust = 4; //int box = 0; //font.SetTextColor(colorDefault); for (int i = 0; i < kuriimuString.Length; i++) { var info = font.GetWidthInfo(kuriimuString[i]); x += info.left; byte[] tmp = sjis.GetBytes(new char[] { kuriimuString[i] }); if (tmp.Length < 2) { tmp = new byte[] { 0, tmp[0] } } ; font.Draw(unicode.GetString(tmp.Reverse().ToArray())[0], gfx, x, y, scaleDefault, scaleDefault); x += info.glyph_width - info.left; if (kuriimuString[i] == '・') { x = rectText.X; y += 17; } } } pages.Add(img); return(pages); }
public CreateCharAppearanceGump() : base(0, 0) { // get the resource provider IResourceProvider provider = ServiceRegistry.GetService <IResourceProvider>(); // backdrop AddControl(new GumpPicTiled(this, 0, 0, 800, 600, 9274)); AddControl(new GumpPic(this, 0, 0, 5500, 0)); // character name AddControl(new GumpPic(this, 280, 53, 1801, 0)); m_TxtName = new TextEntry(this, 238, 70, 234, 20, 0, 0, 29, string.Empty); m_TxtName.HtmlTag = "<span color='#000' style='font-family:uni0;'>"; AddControl(new ResizePic(this, m_TxtName)); AddControl(m_TxtName); // character window AddControl(new GumpPic(this, 238, 98, 1800, 0)); // paperdoll m_paperdoll = new PaperdollLargeUninteractable(this, 237, 97); m_paperdoll.IsCharacterCreation = true; AddControl(m_paperdoll); // left option window AddControl(new ResizePic(this, 82, 125, 3600, 151, 310)); // this is the place where you would put the race selector. // if you do add it, move everything else in this left window down by 45 pixels // gender AddControl(new TextLabelAscii(this, 100, 141, 2036, 9, provider.GetString(3000120)), 1); AddControl(m_Gender = new DropDownList(this, 97, 154, 122, new string[] { provider.GetString(3000118), provider.GetString(3000119) }, 2, 0, false)); // hair (male) AddControl(new TextLabelAscii(this, 100, 186, 2036, 9, provider.GetString(3000121)), 1); AddControl(m_HairMale = new DropDownList(this, 97, 199, 122, HairStyles.MaleHairNames, 6, 0, false), 1); // facial hair (male) AddControl(new TextLabelAscii(this, 100, 231, 2036, 9, provider.GetString(3000122)), 1); AddControl(m_FacialHairMale = new DropDownList(this, 97, 244, 122, HairStyles.FacialHair, 6, 0, false), 1); // hair (female) AddControl(new TextLabelAscii(this, 100, 186, 2036, 9, provider.GetString(3000121)), 2); AddControl(m_HairFemale = new DropDownList(this, 97, 199, 122, HairStyles.FemaleHairNames, 6, 0, false), 2); // right option window AddControl(new ResizePic(this, 475, 125, 3600, 151, 310)); // skin tone AddControl(new TextLabelAscii(this, 489, 141, 2036, 9, provider.GetString(3000183))); AddControl(m_SkinHue = new ColorPicker(this, new Rectangle(490, 154, 120, 24), new Rectangle(490, 140, 120, 280), 7, 8, Hues.SkinTones)); // hair color AddControl(new TextLabelAscii(this, 489, 186, 2036, 9, provider.GetString(3000184))); AddControl(m_HairHue = new ColorPicker(this, new Rectangle(490, 199, 120, 24), new Rectangle(490, 140, 120, 280), 8, 6, Hues.HairTones)); // facial hair color (male) AddControl(new TextLabelAscii(this, 489, 231, 2036, 9, provider.GetString(3000185)), 1); AddControl(m_FacialHairHue = new ColorPicker(this, new Rectangle(490, 244, 120, 24), new Rectangle(490, 140, 120, 280), 8, 6, Hues.HairTones), 1); // back button AddControl(new Button(this, 586, 435, 5537, 5539, ButtonTypes.Activate, 0, (int)Buttons.BackButton), 1); ((Button)LastControl).GumpOverID = 5538; // forward button AddControl(new Button(this, 610, 435, 5540, 5542, ButtonTypes.Activate, 0, (int)Buttons.ForwardButton), 1); ((Button)LastControl).GumpOverID = 5541; // quit button AddControl(new Button(this, 554, 2, 5513, 5515, ButtonTypes.Activate, 0, (int)Buttons.QuitButton)); ((Button)LastControl).GumpOverID = 5514; IsUncloseableWithRMB = true; }
/// <summary> /// Creates the ComicsScreen /// </summary> public iTunesScreen() { SnapStream.Logging.WriteLog("iTunes Plugin Started"); System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.FileInfo fi = new System.IO.FileInfo( a.Location ); // Text Objects _header = new TextWindow(); Add( _header ); _volume = new TextWindow(); Add( _volume ); // Create the list viewer _list = new VariableItemList(); //Add( _list ); // Create control button _nextButton = new TextButton(); _nextButton.Click +=new EventHandler(_nextButton_Click); Add(_nextButton); // Create control button _shuffleButton = new TextButton(); _shuffleButton.Click +=new EventHandler(_shuffleButton_Click); Add(_shuffleButton); // Create control button _searchButton = new TextButton(); _searchButton.Click +=new EventHandler(_searchButton_Click); Add(_searchButton); // Search _searchEntry = new TextEntry(); Add( _searchEntry ); _searchEntry.Accept += new EventHandler(SearchEntry_Accept); _searchEntry.Cancel += new EventHandler(SearchEntry_Cancel); // Create control button _playallButton = new TextButton(); _playallButton.Click +=new EventHandler(_playallButton_Click); Add(_playallButton); _list.ItemActivated += new ItemActivatedEventHandler(List_ItemActivated); _list.Visible = true; _list.Focus(); misc1 = new TextWindow(); misc1.RelativeBounds = new Rectangle(210,170,200,40); misc1.FontSize = 20; misc1.Text = "(N or >> button on Firefly)"; Add(misc1); misc2 = new TextWindow(); misc2.RelativeBounds = new Rectangle(210,210,300,40); misc2.FontSize = 20; misc2.Text = "(S or A button on Firefly)"; Add(misc2); misc3 = new TextWindow(); misc3.RelativeBounds = new Rectangle(0,240,400,40); misc3.FontSize = 20; misc3.Text = "+/- controls volume on keyboard and Firefly remote"; Add(misc3); // Create the windows media player object wmp = new WMPLib.WindowsMediaPlayerClass(); // Create the timer updateTimer = new Timer(); updateTimer.Interval = 1000; updateTimer.Tick += new EventHandler(updateTimer_Tick); return; }
// Previewer public IList <Bitmap> GeneratePreviews(TextEntry entry) { var pages = new List <Bitmap>(); if (entry?.EditedText == null) { return(pages); } Bitmap img; float txtOffsetX, txtOffsetY, scale; float fullWidth; BCFNT font; var rawString = entry.EditedText; if (string.IsNullOrWhiteSpace(rawString)) { rawString = entry.OriginalText; } if (entry.Name.StartsWith("EDT_HELP") || entry.Name.StartsWith("VCL_HELP")) { img = new Bitmap(Resources.daigasso_box); font = fontBasic; font.SetColor(Color.Black); fontSisterSymbol.SetColor(Color.Black); fullWidth = 336; txtOffsetX = 32; txtOffsetY = 12; scale = 0.6f; } else if (entry.Name.StartsWith("Tutorial_") || rawString.Contains("\xE\x1")) { img = new Bitmap(410, 70); using (var g = Graphics.FromImage(img)) { g.FillRectangle(Brushes.White, 0, 0, img.Width, img.Height); g.FillRectangle(Brushes.LightYellow, 5, 6, 400, 58); } font = fontBasicRim; font.SetColor(Color.White); fullWidth = float.MaxValue; txtOffsetX = 5; txtOffsetY = 6; scale = 0.84f; } else { int height = 18 * (entry.OriginalText.Count(c => c == '\n') + 1); img = new Bitmap(226, height + 10); using (var g = Graphics.FromImage(img)) { g.FillRectangle(Brushes.White, 0, 0, img.Width, img.Height); g.FillRectangle(Brushes.LightYellow, 3, 5, 220, height); } font = fontCbfStd; font.SetColor(Color.Black); fontSisterSymbol.SetColor(Color.Black); fullWidth = 220; txtOffsetX = 3; txtOffsetY = 5; scale = 0.6f; } float widthMultiplier = 1; BCFNT baseFont = font; using (var g = Graphics.FromImage(img)) { g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.Bicubic; float x = 0, y = 0; for (int i = 0; i < rawString.Length; i++) { var c = rawString[i]; if (c == 0xE) { if (rawString[i + 1] == 2 && rawString[i + 2] == 0) { widthMultiplier = (rawString[i + 4] + 256 * rawString[i + 5]) / 100f; } else if (rawString[i + 1] == 0 && rawString[i + 2] == 3) { font.SetColor(Color.FromArgb(rawString[i + 7], rawString[i + 4], rawString[i + 5], rawString[i + 6])); } i += 3 + rawString[i + 3]; continue; } if (c == 0xF) { i += 2; widthMultiplier = 1; continue; } font = (c >> 8 == 0xE1) ? fontSisterSymbol : baseFont; // figure out how to merge fonts var char_width = font.GetWidthInfo(c).char_width *scale *widthMultiplier; if (c == '\n' || x + char_width >= fullWidth) { x = 0; y += font.LineFeed * scale; if (c == '\n') { continue; } } font.Draw(c, g, x + txtOffsetX, y + txtOffsetY, scale * widthMultiplier, scale); x += char_width; } } pages.Add(img); return(pages); }
// Previewer public IList <Bitmap> GeneratePreviews(TextEntry entry) { var pages = new List <Bitmap>(); if (entry?.EditedText == null) { return(pages); } //string kuriimuString = _previewPairs.Aggregate(GetKuriimuString(entry.EditedText), (s, pair) => s.Replace(pair.Key, pair.Value)); string kuriimuString = _previewPairs.Aggregate(GetKuriimuString(entry.EditedText), (s, pair) => s.Replace(pair.Key, pair.Value)); Bitmap img = new Bitmap(1, 1); switch (Enum.Parse(typeof(BubbleType), Properties.Settings.Default.BubbleType)) { case BubbleType.Type1: img = new Bitmap(bubble001.Width, bubble001.Height); break; case BubbleType.Type2: img = new Bitmap(bubble002.Width, bubble002.Height); break; } using (Graphics gfx = Graphics.FromImage(img)) { gfx.SmoothingMode = SmoothingMode.HighQuality; gfx.InterpolationMode = InterpolationMode.Bicubic; gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; RectangleF rectText = new RectangleF(0, 0, 0, 0); Color colorDefault = Color.FromArgb(255, 0, 0, 0); switch (Enum.Parse(typeof(BubbleType), Properties.Settings.Default.BubbleType)) { case BubbleType.Type1: gfx.DrawImage(bubble001, 0, 0); rectText = new RectangleF(12, 9, 370, 100); break; case BubbleType.Type2: gfx.DrawImage(bubble002, 0, 0); rectText = new RectangleF(20, 11, 370, 100); break; } float scaleDefault = 1.0f; float scaleCurrent = scaleDefault; float x = rectText.X, pX = x; float y = rectText.Y, pY = y; //float fontSize = 3.2f; float fontSize = 1.5f; for (int i = 0; i < kuriimuString.Length; i++) { BCFNT.CharWidthInfo widthInfo = font.GetWidthInfo(kuriimuString[i]); font.SetColor(colorDefault); if (kuriimuString[i] == '\n') { switch (Enum.Parse(typeof(BubbleType), Properties.Settings.Default.BubbleType)) { case BubbleType.Type1: y += 15; x = 12; continue; case BubbleType.Type2: y += 13; x = 18; continue; } } font.Draw(kuriimuString[i], gfx, x, y, scaleCurrent, scaleCurrent); x += widthInfo.char_width - fontSize; } } pages.Add(img); return(pages); }
void Init() { Title = "Image Generator"; _mainBox = new VBox { HeightRequest = 340, WidthRequest = 500 }; _baseSizeBox = new VBox(); _baseSizeLabel = new Label("Select your design base size"); _radioButtonsBox = new HBox(); _radioButtonsGroup = new RadioButtonGroup(); _4xRadioButton = new RadioButton("4x") { Group = _radioButtonsGroup }; _3xRadioButton = new RadioButton("3x") { Group = _radioButtonsGroup }; _imagesLabel = new Label("Select the largest image files to generate different sizes for all platforms"); _imagesBox = new HBox(); _imageNameField = new DataField <string>(); _imagePathField = new DataField <string>(); _imagesStore = new ListStore(_imageNameField, _imagePathField); _imagesListView = new ListView { WidthRequest = 460, HeightRequest = 120 }; _imagesListView.Columns.Add("Output name (editable)", new TextCellView(_imageNameField) { Editable = true }); _imagesListView.Columns.Add("Path", new TextCellView(_imagePathField)); _imagesListView.DataSource = _imagesStore; _imagesSelectorButton = new Button("...") { ExpandVertical = false, VerticalPlacement = WidgetPlacement.Start }; _outputFolderLabel = new Label("Select output folder:"); _outputFolderBox = new HBox(); _outputFolderEntry = new TextEntry { WidthRequest = 460, Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) }; _outputFolderButton = new Button("..."); _buttonBox = new HBox(); _generateButton = new Button("Generate") { BackgroundColor = Styles.BaseSelectionBackgroundColor, LabelColor = Styles.BaseSelectionTextColor, WidthRequest = 100, HeightRequest = 40 }; fileDialog = new OpenFileDialog("Select images") { Multiselect = true }; folderDialog = new SelectFolderDialog("Select output folder"); }
public DiffTest() { textALabel = new Label() { Text = "Param1:", TextAlignment = Alignment.Center }; textBLabel = new Label() { Text = "Param2:", TextAlignment = Alignment.Center }; textA = new TextEntry() { Text = "Sequential Read: Up to 550 MB/s " }; textB = new TextEntry() { Text = "Sequential Write: Up to 510 MB/s " }; testChar = new Button() { Label = "Test Char" }; testChar.Clicked += TestCharOnClick; testWord = new Button() { Label = "Test Word" }; testWord.Clicked += TestWordOnClick; result = new LayoutList() { GenerateToString = false }; result.SelectionChanged += result_SelectionChanged; panel = new Table(); panel.Add(textALabel, 0, 0); panel.Add(textA, 1, 0, colspan: 2, hexpand: true); panel.Add(textBLabel, 0, 1); panel.Add(textB, 1, 1, colspan: 2, hexpand: true); panel.Add(testChar, 0, 2); panel.Add(testWord, 1, 2, hexpand: false); //test.RowSpan = itemParam = new GroupBoxItem() { Widget = panel, FillWidth = true, Name = "Params" }; itemResult = new GroupBoxItem() { Widget = result, Row = 1, FillHeight = true, Name = "Result" }; map = new GroupBox(itemParam, itemResult); PackStart(map, true, true); Text = "Diff Test"; }
/// <summary> /// Initialize window. /// </summary> public override void _initializeComponents() { // Server Name + URL + Periodicity window Frame f = new Frame(); f.Label = Director.Properties.Resources.ServerSettings; f.Padding = 10; // Create VBOX VBox ServerSettings = new VBox(); // Prepare text box ServerSettings.PackStart(new Label() { Text = Director.Properties.Resources.ServerName }); ServerName = new TextEntry(); ServerName.Changed += ServerName_Changed; ServerSettings.PackStart(ServerName); // Add invalid server name ServerSettings.PackStart(InvalidServerName); // Server URL ServerSettings.PackStart(new Label() { Text = Director.Properties.Resources.ServerURL }); ServerURL = new TextEntry(); ServerURL.Changed += ServerURL_Changed; ServerSettings.PackStart(ServerURL); // Invalid URL ServerSettings.PackStart(InvalidServerURL); // Frequency settings ServerSettings.PackStart(new Label() { Text = Director.Properties.Resources.RunningPeriodicity }); FrequencyRunning = new ComboBox(); FrequencyHelper.FillComboBox(FrequencyRunning); ServerSettings.PackStart(FrequencyRunning); FrequencyRunning.SelectedIndex = 0; FrequencyRunning.SelectionChanged += FrequencyRunning_SelectionChanged; // Add Frame to server settings f.Content = ServerSettings; PackStart(f); // Authorization AuthRequired = new CheckBox(Director.Properties.Resources.Authorization); AuthRequired.MarginLeft = 10; PackStart(AuthRequired); // Create Authentication Frame Authentication = new Frame() { Label = Director.Properties.Resources.AuthorizationSettings, Padding = 10 }; // Login and Password fields VBox AuthBox = new VBox(); AuthBox.PackStart(new Label() { Text = Director.Properties.Resources.Username }); AuthUserName = new TextEntry(); AuthUserName.Changed += AuthUserName_Changed; AuthBox.PackStart(AuthUserName); AuthBox.PackStart(new Label() { Text = Director.Properties.Resources.Password }); AuthUserPassword = new PasswordEntry(); AuthUserPassword.Changed += AuthUserPassword_Changed; AuthBox.PackStart(AuthUserPassword); // Authentication content Authentication.Content = AuthBox; PackStart(Authentication); // Change value AuthRequired.Toggled += AuthRequired_Toggled; // Email settings Frame EmailFrame = new Frame() { Label = Director.Properties.Resources.EmailNotifications, Padding = 10, MinHeight = 180 }; // Create EmailList widget EmailWidget = new EmailList(); EmailFrame.Content = EmailWidget; PackStart(EmailFrame, expand: true, fill: true); }
public override void SetFocus() { TextEntry.SetFocus(); }
public int CompareTo(TextEntry rhs) { var result = Name.CompareTo(rhs.Name); return(result); }
public IList <Bitmap> GeneratePreviews(TextEntry entry) => new List <Bitmap>();
public static void Main(string[] args) { Application.Initialize(ToolkitType.Gtk); var mainWindow = new Window() { Title = "SwinAdventure", Width = 700, Height = 500 }; mainWindow.CloseRequested += delegate { Application.Exit(); }; VBox ContentData = new VBox() { ExpandHorizontal = true, ExpandVertical = true }; string inputText = null; var input = new TextEntry(); input.Changed += delegate { inputText = input.Text; }; var button = new Button("Send Command"); button.Type = ButtonType.Normal; button.Margin = 10; var label = new Label(); label.BackgroundColor = Xwt.Drawing.Color.FromName("black"); label.TextColor = Xwt.Drawing.Color.FromName("white"); label.MinHeight = 450; var scrollview = new ScrollView(); scrollview.VerticalScrollPolicy = ScrollPolicy.Automatic; scrollview.ExpandHorizontal = true; scrollview.HeightRequest = 460; scrollview.Content = label; int buttonClicks = 0; label.Text = "Enter Player Name: "; string PlayerName = null; Player GamePlayer = null; CommandProcessor MainCommandProcessor = new CommandProcessor(); LookCommand Look = new LookCommand(); MoveCommand Move = new MoveCommand(); PutCommand Put = new PutCommand(); QuitCommand Quit = new QuitCommand(); MainCommandProcessor.AddCommand(Look); MainCommandProcessor.AddCommand(Move); MainCommandProcessor.AddCommand(Put); MainCommandProcessor.AddCommand(Quit); button.Clicked += (object sender, EventArgs e) => { if (buttonClicks == 0) { label.Text += inputText + "\nEnter Player Description: "; PlayerName = inputText; } else if (buttonClicks == 1) { label.Text += inputText + "\n"; label.Text += Look.Description(); label.Text += Move.Description(); label.Text += Put.Description(); label.Text += Quit.Description(); label.Text += "Enter Command: "; GamePlayer = new Player(PlayerName, inputText); Item Gun = new Item(new String[] { "gun", "rifle" }, "a gun", "This is a killing tool ..."); Item Shovel = new Item(new String[] { "shovel", "spade" }, "a shovel", "This is a might fine ..."); GamePlayer.Inventory.Put(Gun); GamePlayer.Inventory.Put(Shovel); Bag PlayerBag = new Bag(new string[] { "Bag" }, "A Bag", "Game Player's Bag ..."); GamePlayer.Inventory.Put(PlayerBag); Item Gem = new Item(new string[] { "gem", "shiny" }, "Gem", "A Shiny Gem ..."); PlayerBag.Inventory.Put(Gem); Location NorthLocation = new Location("Hallway", "This is a long well lit hallway"); Location SouthLocation = new Location("Small Closet", "A small dark closet, with an odd smell"); Location EastLocation = new Location("Small Garden", "There are many small shrubs and flowers growing from well tended garden beds."); Location WestLocation = new Location("University", "This is a place were you spend your money and time for nothing in return."); Path path = new Path(); NorthLocation.Path = path; path.SetLocation("north", NorthLocation); path.SetLocation("south", SouthLocation); path.SetLocation("east", EastLocation); path.SetLocation("west", WestLocation); GamePlayer.Location = NorthLocation; } if (buttonClicks > 1) { label.Text += inputText + "\n"; String[] Command = inputText.Split(' '); label.Text += MainCommandProcessor.Execute(GamePlayer, Command) + "\nEnter Command: "; } inputText = ""; input.Text = ""; buttonClicks += 1; }; ContentData.PackStart(scrollview); ContentData.PackStart(input); ContentData.PackStart(button); mainWindow.Content = ContentData; mainWindow.Show(); Application.Run(); mainWindow.Dispose(); }
public IList <Bitmap> GeneratePreviews(TextEntry entry) { var pages = new List <Bitmap>(); if (entry?.EditedText == null) { return(pages); } string labelString = GetKuriimuString(entry.EditedText); if (string.IsNullOrWhiteSpace(labelString)) { labelString = entry.OriginalText; } Bitmap backgroundImg = new Bitmap(Resources.previewbg, 400, 120); // gold FromArgb(218, 165, 32) baseFont.SetColor(Color.FromArgb(218, 165, 32)); outlineFont.SetColor(Color.Black); // create default preview settings txtPreview = new TextPreviewFormat(); using (var g = Graphics.FromImage(backgroundImg)) { g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.Bicubic; float x = 0; float y = 0; for (int i = 0; i < labelString.Length; ++i) { var c = labelString[i]; var charWidth = baseFont.GetWidthInfo(c).char_width *txtPreview.scale *txtPreview.widthMultiplier; if (c == '\n' || (x + charWidth >= txtPreview.maxWidth)) { x = 0; y += baseFont.LineFeed * txtPreview.scale; if (c == '\n') { continue; } } // drawing the two fonts with a slightly different offset in order to simulate outline on the text outlineFont.Draw(c, g, x + txtPreview.offsetX + txtPreview.marginX + 2.0f, y + txtPreview.offsetY + txtPreview.marginY + 2.0f, txtPreview.scale * txtPreview.widthMultiplier, txtPreview.scale); baseFont.Draw(c, g, x + txtPreview.offsetX + txtPreview.marginX, y + txtPreview.offsetY + txtPreview.marginY, txtPreview.scale * txtPreview.widthMultiplier, txtPreview.scale); x += charWidth; } } pages.Add(backgroundImg); return(pages); }
/// <summary> /// Create result vbox data item. /// </summary> public void CreateResult(VBox RequestStatus, Font CaptionFont) { // Clear RequestStatus.Clear(); // Nothing to do! if (RequestRemoteResult == null) { RequestStatus.PackStart(new Label(Director.Properties.Resources.NoResponse) { Font = CaptionFont }); return; } // iterate bool first = true; foreach (var i in RequestRemoteResult) { if (i.Type == 1) { RequestStatus.PackStart(new Label(i.Data) { Font = CaptionFont, MarginTop = (first) ? 0 : 20 }, false, false); } else if (i.Type == 2) { RequestStatus.PackStart(new ListItem(i.Data)); } else { TextEntry RequestTextEntry = new TextEntry() { Margin = 10, Text = i.Data, Sensitive = false, MultiLine = true }; RequestStatus.PackStart(RequestTextEntry); Button ClipboardButtonReq = new Button(Image.FromResource(DirectorImages.COPY_ICON), "") { WidthRequest = 30, HeightRequest = 30, ExpandHorizontal = false, ExpandVertical = false, MarginRight = 10, TooltipText = Director.Properties.Resources.CopyInClipboard }; ClipboardButtonReq.Clicked += delegate { Clipboard.SetText(RequestTextEntry.Text); }; RequestStatus.PackStart(ClipboardButtonReq, hpos: WidgetPlacement.End); } first = false; } }
private void Awake() { textEntry = GetComponent <TextEntry>(); mainMenu = GetComponentInParent <SocialMenu>(); }
/// <summary> /// Create overview! /// </summary> public void CreateOverview(VBox RequestOverview, Font CaptionFont) { // Overview clear RequestOverview.Clear(); // Information RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestUrl + ":") { Font = CaptionFont }, false, false); // Create URL RequestOverview.PackStart(new LinkLabel(Url) { Uri = new Uri(Url), MarginLeft = 10 }, false, false); // Method RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestMethod + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); // Create URL RequestOverview.PackStart(new Label(HTTP_METHOD) { MarginLeft = 10 }, false, false); // Headers if (Headers.Count > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestHeaders + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); foreach (var h in Headers) { RequestOverview.PackStart(new ListItem(string.Format("{0} - {1}", h.Name, h.Value))); } } // Files if (Files.Count > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestFiles + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); foreach (var h in Files) { RequestOverview.PackStart(new ListItem(h.FileName)); } } // Request // Request if (RequestTemplate != null && RequestTemplate.Length > 0) { RequestOverview.PackStart(new Label(string.Format("{0} ({1}) :", Director.Properties.Resources.RequestTemplate, RequestTemplateTypeS)) { Font = CaptionFont, MarginTop = 20 }, false, false); TextEntry RequestTextEntry = new TextEntry() { Margin = 10, Sensitive = false, MultiLine = true }; if (RequestTemplateType == ContentType.JSON) { RequestTextEntry.Text = JSONFormatter.Format(RequestTemplate); if (RequestTextEntry.Text == null || RequestTextEntry.Text.Trim().Length == 0) { RequestTextEntry.Text = RequestTemplate; } } else { RequestTextEntry.Text = RequestTemplate; } RequestOverview.PackStart(RequestTextEntry); Button ClipboardButtonReq = new Button(Image.FromResource(DirectorImages.COPY_ICON), "") { WidthRequest = 30, HeightRequest = 30, ExpandHorizontal = false, ExpandVertical = false, MarginRight = 10, TooltipText = Director.Properties.Resources.CopyInClipboard }; ClipboardButtonReq.Clicked += delegate { Clipboard.SetText(RequestTextEntry.Text); }; RequestOverview.PackStart(ClipboardButtonReq, hpos: WidgetPlacement.End); } // Requested code if (ExpectedStatusCode > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.ExpectedStatusCode + ":") { Font = CaptionFont }, false, false); RequestOverview.PackStart(new ListItem(ExpectedStatusCode + "")); } // Request if (ResponseTemplate != null && ResponseTemplate.Length > 0) { RequestOverview.PackStart(new Label(string.Format("{0} ({1}): ", Director.Properties.Resources.ResponseTemplate, ResponseTemplateTypeS)) { Font = CaptionFont, MarginTop = (ExpectedStatusCode > 0) ? 20 : 0 }, false, false); TextEntry ResponseTextEntry = new TextEntry() { Margin = 10, Sensitive = false, MultiLine = true }; if (ResponseTemplate.Trim().StartsWith("{")) { ResponseTextEntry.Text = JSONFormatter.Format(ResponseTemplate); } else { ResponseTextEntry.Text = ResponseTemplate; } RequestOverview.PackStart(ResponseTextEntry); Button ClipboardButton = new Button(Image.FromResource(DirectorImages.COPY_ICON), "") { WidthRequest = 30, HeightRequest = 30, ExpandHorizontal = false, ExpandVertical = false, MarginRight = 10, MarginBottom = 10, TooltipText = Director.Properties.Resources.CopyInClipboard }; ClipboardButton.Clicked += delegate { Clipboard.SetText(ResponseTextEntry.Text); }; RequestOverview.PackStart(ClipboardButton, hpos: WidgetPlacement.End); } }
public bool RenameEntry(TextEntry entry, string newName) => false;
protected override Widget GetMainControl() { var table = new Table(); var fields = scaffolder.Fields.ToArray(); var rowCount = fields.Count(); int rowAdditionCount = 0; for (int fieldIndex = 0; fieldIndex < rowCount; fieldIndex++) { int rowIndex = fieldIndex + rowAdditionCount; var field = fields [fieldIndex]; var label = new Label(); switch (field) { case StringField s: var input = new TextEntry(); label.Text = s.DisplayName; table.Add(label, 0, rowIndex, hpos: WidgetPlacement.End); table.Add(input, 1, rowIndex); input.Changed += (sender, args) => s.SelectedValue = input.Text; input.MinWidth = 300; input.SetFocus(); break; case ComboField comboField: ComboBox comboBox; if (comboField.IsEditable) { var comboBoxEntry = new ComboBoxEntry(); comboBoxEntry.TextEntry.Changed += (sender, args) => { if (!string.IsNullOrWhiteSpace(comboBoxEntry.TextEntry.Text)) { comboField.SelectedValue = comboBoxEntry.TextEntry.Text; } }; if (comboField.PlaceholderText != null) { comboBoxEntry.TextEntry.PlaceholderText = comboField.PlaceholderText; } comboBox = comboBoxEntry; } else { comboBox = new ComboBox(); } comboBox.MinWidth = 300; Task.Run(async() => { var options = await comboField.Options; await Runtime.RunInMainThread(() => { if (Args.CancellationToken.IsCancellationRequested) { return; } Xwt.Toolkit.NativeEngine.Invoke(() => { foreach (var option in options) { comboBox.Items.Add(option); } }); }); }, Args.CancellationToken); label.Text = comboField.DisplayName; table.Add(label, 0, rowIndex, hpos: WidgetPlacement.End); table.Add(comboBox, 1, rowIndex); comboBox.TextInput += (sender, args) => comboField.SelectedValue = comboBox.SelectedText; comboBox.SelectionChanged += (sender, args) => comboField.SelectedValue = comboBox.SelectedText; break; case BoolFieldList boolFieldList: label.Text = boolFieldList.DisplayName; table.Add(label, 0, rowIndex, hpos: WidgetPlacement.End, vpos: WidgetPlacement.Start); var vbox = new VBox(); for (int i = 0; i < boolFieldList.Options.Count; i++) { var boolField = boolFieldList.Options [i]; var checkbox = new CheckBox(boolField.DisplayName) { Active = boolField.Selected, Sensitive = boolField.Enabled }; checkbox.Toggled += (sender, args) => boolField.Selected = checkbox.Active; vbox.PackStart(checkbox); } table.Add(vbox, 1, rowIndex); break; case FileField fileField: var fileSelector = new FileSelector(); if (!string.IsNullOrEmpty(fileField.FilterWildcard)) { // This doesn't work with native toolkit! var filter = new FileDialogFilter(fileField.FilterWildcard, fileField.FilterWildcard); fileSelector.Filters.Add(filter); } table.Add(fileSelector, 1, rowIndex); label.Text = fileField.DisplayName; table.Add(label, 1, rowIndex + 1); rowAdditionCount++; fileSelector.HeightRequest = 20; fileSelector.FileChanged += (sender, args) => fileField.SelectedValue = fileSelector.FileName; break; } } return(table); }
public void Insert(Guid ContentGUID,string Title,string ContentName,string Content,string IconPath,DateTime? DateExpires,string LastEditedBy,string ExternalLink,string Status,int ListOrder,string CallOut,DateTime? CreatedOn,string CreatedBy,DateTime? ModifiedOn,string ModifiedBy) { TextEntry item = new TextEntry(); item.ContentGUID = ContentGUID; item.Title = Title; item.ContentName = ContentName; item.Content = Content; item.IconPath = IconPath; item.DateExpires = DateExpires; item.LastEditedBy = LastEditedBy; item.ExternalLink = ExternalLink; item.Status = Status; item.ListOrder = ListOrder; item.CallOut = CallOut; item.CreatedOn = CreatedOn; item.CreatedBy = CreatedBy; item.ModifiedOn = ModifiedOn; item.ModifiedBy = ModifiedBy; item.Save(UserName); }
public override void Update(double totalMS, double frameMS) { if (m_TextEntry == null) { IResourceProvider provider = Service.Get <IResourceProvider>(); IFont font = provider.GetUnicodeFont(0); m_TextEntry = new TextEntry(this, 1, Height - font.Height, Width, font.Height, 0, 0, MaxChatMessageLength, string.Empty); m_TextEntry.LegacyCarat = true; Mode = ChatMode.Default; AddControl(new CheckerTrans(this, 0, Height - 20, Width, 20)); AddControl(m_TextEntry); } for (int i = 0; i < m_TextEntries.Count; i++) { m_TextEntries[i].Update(totalMS, frameMS); if (m_TextEntries[i].IsExpired) { m_TextEntries[i].Dispose(); m_TextEntries.RemoveAt(i); i--; } } // Ctrl-Q = Cycle backwards through the things you have said today // Ctrl-W = Cycle forwards through the things you have said today if (m_Input.HandleKeyboardEvent(KeyboardEvent.Down, WinKeys.Q, false, false, true) && m_MessageHistoryIndex > -1) { if (m_MessageHistoryIndex > 0) { m_MessageHistoryIndex -= 1; } { Mode = m_MessageHistory[m_MessageHistoryIndex].Item1; m_TextEntry.Text = m_MessageHistory[m_MessageHistoryIndex].Item2; } } else if (m_Input.HandleKeyboardEvent(KeyboardEvent.Down, WinKeys.W, false, false, true)) { if (m_MessageHistoryIndex < m_MessageHistory.Count - 1) { m_MessageHistoryIndex += 1; Mode = m_MessageHistory[m_MessageHistoryIndex].Item1; m_TextEntry.Text = m_MessageHistory[m_MessageHistoryIndex].Item2; } else { m_TextEntry.Text = string.Empty; } } // backspace when mode is not default and Text is empty = clear mode. else if (m_Input.HandleKeyboardEvent(KeyboardEvent.Down, WinKeys.Back, false, false, false) && m_TextEntry.Text == string.Empty) { Mode = ChatMode.Default; } // only switch mode if the single command char is the only char entered. if ((Mode == ChatMode.Default && m_TextEntry.Text.Length == 1) || (Mode != ChatMode.Default && m_TextEntry.Text.Length == 1)) { switch (m_TextEntry.Text[0]) { case ':': Mode = ChatMode.Emote; break; case ';': Mode = ChatMode.Whisper; break; case '/': Mode = ChatMode.Party; break; case '\\': Mode = ChatMode.Guild; break; case '|': Mode = ChatMode.Alliance; break; } } base.Update(totalMS, frameMS); }
public bool ShowEntryProperties(TextEntry entry, Icon icon) => false;
public MessageDialogs() { Table table = new Table(); TextEntry txtPrimay = new TextEntry(); TextEntry txtSecondary = new TextEntry(); txtSecondary.MultiLine = true; ComboBox cmbType = new ComboBox(); cmbType.Items.Add("Message"); cmbType.Items.Add("Question"); cmbType.Items.Add("Confirmation"); cmbType.Items.Add("Warning"); cmbType.Items.Add("Error"); cmbType.SelectedIndex = 0; Button btnShowMessage = new Button("Show Message"); Label lblResult = new Label(); table.Add(new Label("Primary Text:"), 0, 0); table.Add(txtPrimay, 1, 0, hexpand: true); table.Add(new Label("Secondary Text:"), 0, 1); table.Add(txtSecondary, 1, 1, hexpand: true); table.Add(new Label("Message Type:"), 0, 2); table.Add(cmbType, 1, 2, hexpand: true); table.Add(btnShowMessage, 1, 3, hexpand: true); table.Add(lblResult, 1, 4, hexpand: true); btnShowMessage.Clicked += (sender, e) => { switch (cmbType.SelectedText) { case "Message": MessageDialog.ShowMessage(this.ParentWindow, txtPrimay.Text, txtSecondary.Text); lblResult.Text = "Result: dialog closed"; break; case "Question": var question = new QuestionMessage(txtPrimay.Text, txtSecondary.Text); question.Buttons.Add(new Command("Answer 1")); question.Buttons.Add(new Command("Answer 2")); question.DefaultButton = 1; question.AddOption("option1", "Option 1", false); question.AddOption("option2", "Option 2", true); var result = MessageDialog.AskQuestion(question); lblResult.Text = "Result: " + result.Id; if (question.GetOptionValue("option1")) { lblResult.Text += " + Option 1"; } if (question.GetOptionValue("option2")) { lblResult.Text += " + Option 2"; } break; case "Confirmation": var confirmation = new ConfirmationMessage(txtPrimay.Text, txtSecondary.Text, Command.Apply); confirmation.AddOption("option1", "Option 1", false); confirmation.AddOption("option2", "Option 2", true); confirmation.AllowApplyToAll = true; var success = MessageDialog.Confirm(confirmation); lblResult.Text = "Result: " + success; if (confirmation.GetOptionValue("option1")) { lblResult.Text += " + Option 1"; } if (confirmation.GetOptionValue("option2")) { lblResult.Text += " + Option 2"; } lblResult.Text += " + All: " + confirmation.AllowApplyToAll; break; case "Warning": MessageDialog.ShowWarning(this.ParentWindow, txtPrimay.Text, txtSecondary.Text); lblResult.Text = "Result: dialog closed"; break; case "Error": MessageDialog.ShowError(this.ParentWindow, txtPrimay.Text, txtSecondary.Text); lblResult.Text = "Result: dialog closed"; break; } }; PackStart(table, true); }