public override Control GetVisualizerWidget (ObjectValue val) { string value = val.Value; Gdk.Color col = new Gdk.Color (85, 85, 85); if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]")) value = '"' + GetString (val) + '"'; if (DebuggingService.HasInlineVisualizer (val)) value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val); var label = new Gtk.Label (); label.Text = value; var font = label.Style.FontDescription.Copy (); if (font.SizeIsAbsolute) { font.AbsoluteSize = font.Size - 1; } else { font.Size -= (int)(Pango.Scale.PangoScale); } label.ModifyFont (font); label.ModifyFg (StateType.Normal, col); label.SetPadding (4, 4); if (label.SizeRequest ().Width > 500) { label.WidthRequest = 500; label.Wrap = true; label.LineWrapMode = Pango.WrapMode.WordChar; } else { label.Justify = Gtk.Justification.Center; } if (label.Layout.GetLine (1) != null) { label.Justify = Gtk.Justification.Left; var line15 = label.Layout.GetLine (15); if (line15 != null) { label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…"; } } label.Show (); return label; }
// Copied from Banshee.Hyena.Gui.GtkUtilities // Copyright (C) 2007 Aaron Bockover <*****@*****.**> public static Gdk.Color ColorBlend(Gdk.Color a, Gdk.Color b) { // at some point, might be nice to allow any blend? double blend = 0.5; if (blend < 0.0 || blend > 1.0) { throw new ApplicationException ("blend < 0.0 || blend > 1.0"); } double blendRatio = 1.0 - blend; int aR = a.Red >> 8; int aG = a.Green >> 8; int aB = a.Blue >> 8; int bR = b.Red >> 8; int bG = b.Green >> 8; int bB = b.Blue >> 8; double mR = aR + bR; double mG = aG + bG; double mB = aB + bB; double blR = mR * blendRatio; double blG = mG * blendRatio; double blB = mB * blendRatio; Gdk.Color color = new Gdk.Color ((byte)blR, (byte)blG, (byte)blB); Gdk.Colormap.System.AllocColor (ref color, true, true); return color; }
/// <summary> /// Initializes a new instance of the RowStyle class with default settings /// </summary> public RowStyle() { this.backColor = Color.Empty; this.foreColor = Color.Empty; this.font = null; this.alignment = RowAlignment.Center; }
public static Gdk.Color GetGdkTextMidColor (Widget widget) { Cairo.Color color = GetCairoTextMidColor (widget); Gdk.Color gdk_color = new Gdk.Color ((byte)(color.R * 255), (byte)(color.G * 255), (byte)(color.B * 255)); Gdk.Colormap.System.AllocColor (ref gdk_color, true, true); return gdk_color; }
public GtkProtobuildModuleConfigurationWidget() { this.Build (); var separatorColor = new Gdk.Color (176, 178, 181); solutionNameSeparator.ModifyBg (StateType.Normal, separatorColor); locationSeparator.ModifyBg (StateType.Normal, separatorColor); eventBox.ModifyBg (StateType.Normal, new Gdk.Color (255, 255, 255)); var leftHandBackgroundColor = new Gdk.Color (225, 228, 232); leftBorderEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor); projectConfigurationRightBorderEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor); projectConfigurationTopEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor); projectConfigurationTableEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor); projectConfigurationBottomEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor); moduleNameTextBox.ActivatesDefault = true; locationTextBox.ActivatesDefault = true; moduleNameTextBox.TruncateMultiline = true; locationTextBox.TruncateMultiline = true; RegisterEvents (); }
public SparkleLink(string title, string url) : base() { Label label = new Label () { Ellipsize = Pango.EllipsizeMode.Middle, UseMarkup = true, Markup = title, Xalign = 0 }; Add (label); Gdk.Color color = new Gdk.Color (); // Only make links for files that exist if (!url.StartsWith ("http://") && !File.Exists (url)) { // Use Tango Aluminium for the links Gdk.Color.Parse ("#2e3436", ref color); label.ModifyFg (StateType.Normal, color); return; } // Use Tango Sky Blue for the links Gdk.Color.Parse ("#3465a4", ref color); label.ModifyFg (StateType.Normal, color); // Open the URL when it is clicked ButtonReleaseEvent += delegate { Process process = new Process (); process.StartInfo.FileName = "gnome-open"; process.StartInfo.Arguments = url.Replace (" ", "\\ "); // Escape space-characters process.Start (); }; // Add underline when hovering the link with the cursor EnterNotifyEvent += delegate { label.Markup = "<u>" + title + "</u>"; ShowAll (); Realize (); GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Hand2); }; // Remove underline when leaving the link with the cursor LeaveNotifyEvent += delegate { label.Markup = title; ShowAll (); Realize (); GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Arrow); }; }
void RotatedTextExposeEvent (object sender, ExposeEventArgs a) { DrawingArea drawingArea = sender as DrawingArea; int width = drawingArea.Allocation.Width; int height = drawingArea.Allocation.Height; double deviceRadius; // Get the default renderer for the screen, and set it up for drawing Gdk.PangoRenderer renderer = Gdk.PangoRenderer.GetDefault (drawingArea.Screen); renderer.Drawable = drawingArea.GdkWindow; renderer.Gc = drawingArea.Style.BlackGC; // Set up a transformation matrix so that the user space coordinates for // the centered square where we draw are [-RADIUS, RADIUS], [-RADIUS, RADIUS] // We first center, then change the scale deviceRadius = Math.Min (width, height) / 2; Matrix matrix = Pango.Matrix.Identity; matrix.Translate (deviceRadius + (width - 2 * deviceRadius) / 2, deviceRadius + (height - 2 * deviceRadius) / 2); matrix.Scale (deviceRadius / RADIUS, deviceRadius / RADIUS); // Create a PangoLayout, set the font and text Context context = drawingArea.CreatePangoContext (); Pango.Layout layout = new Pango.Layout (context); layout.SetText ("Text"); FontDescription desc = FontDescription.FromString ("Sans Bold 27"); layout.FontDescription = desc; // Draw the layout N_WORDS times in a circle for (int i = 0; i < N_WORDS; i++) { Gdk.Color color = new Gdk.Color (); Matrix rotatedMatrix = matrix; int w, h; double angle = (360 * i) / N_WORDS; // Gradient from red at angle == 60 to blue at angle == 300 color.Red = (ushort) (65535 * (1 + Math.Cos ((angle - 60) * Math.PI / 180)) / 2); color.Green = 0; color.Blue = (ushort) (65535 - color.Red); renderer.SetOverrideColor (RenderPart.Foreground, color); rotatedMatrix.Rotate (angle); context.Matrix = rotatedMatrix; // Inform Pango to re-layout the text with the new transformation matrix layout.ContextChanged (); layout.GetSize (out w, out h); renderer.DrawLayout (layout, - w / 2, (int) (- RADIUS * Pango.Scale.PangoScale)); } // Clean up default renderer, since it is shared renderer.SetOverrideColor (RenderPart.Foreground, Gdk.Color.Zero); renderer.Drawable = null; renderer.Gc = null; }
public static Gdk.Color ToGdkColor(this Cairo.Color color) { Gdk.Color c = new Gdk.Color (); c.Blue = (ushort)(color.B * ushort.MaxValue); c.Red = (ushort)(color.R * ushort.MaxValue); c.Green = (ushort)(color.G * ushort.MaxValue); return c; }
/// <summary> /// Raises the button ok clicked event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> protected void OnButtonOkClicked (object sender, EventArgs e) { Application.Invoke(delegate { progressbar3.Text = Mono.Unix.Catalog.GetString("Verifying..."); }); bool bAreAllSettingsOK = true; Config.SetGameName (GameName_entry.Text); ESystemTarget SystemTarget = Utilities.ParseSystemTarget (combobox_SystemTarget.ActiveText); if (SystemTarget != ESystemTarget.Invalid) { Config.SetSystemTarget (SystemTarget); } else { bAreAllSettingsOK = false; } if (FTPURL_entry.Text.StartsWith ("ftp://")) { Config.SetBaseFTPUrl (FTPURL_entry.Text); } else { bAreAllSettingsOK = false; Gdk.Color col = new Gdk.Color(255, 128, 128); FTPURL_entry.ModifyBase(StateType.Normal, col); FTPURL_entry.TooltipText = Mono.Unix.Catalog.GetString("The URL needs to begin with \"ftp://\". Please correct the URL."); } Config.SetFTPPassword (FTPPassword_entry.Text); Config.SetFTPUsername (FTPUsername_entry.Text); if (bAreAllSettingsOK) { if (Checks.CanConnectToFTP ()) { Destroy (); } else { MessageDialog dialog = new MessageDialog ( null, DialogFlags.Modal, MessageType.Warning, ButtonsType.Ok, Mono.Unix.Catalog.GetString("Failed to connect to the FTP server. Please check your FTP settings.")); dialog.Run (); dialog.Destroy (); } } progressbar3.Text = Mono.Unix.Catalog.GetString("Idle"); }
public TerminalPad() { //FIXME look up most of these in GConf term = new Terminal (); term.ScrollOnKeystroke = true; term.CursorBlinks = true; term.MouseAutohide = true; term.FontFromString = "monospace 10"; term.Encoding = "UTF-8"; term.BackspaceBinding = TerminalEraseBinding.Auto; term.DeleteBinding = TerminalEraseBinding.Auto; term.Emulation = "xterm"; Gdk.Color fgcolor = new Gdk.Color (0, 0, 0); Gdk.Color bgcolor = new Gdk.Color (0xff, 0xff, 0xff); Gdk.Colormap colormap = Gdk.Colormap.System; colormap.AllocColor (ref fgcolor, true, true); colormap.AllocColor (ref bgcolor, true, true); term.SetColors (fgcolor, bgcolor, fgcolor, 16); //FIXME: whats a good default here //term.SetSize (80, 5); // seems to want an array of "variable=value" string[] envv = new string [Environment.GetEnvironmentVariables ().Count]; int i = 0; foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ()) { if (e.Key == "" || e.Value == "") continue; envv[i] = String.Format ("{0}={1}", e.Key, e.Value); i ++; } term.ForkCommand (Environment.GetEnvironmentVariable ("SHELL"), Environment.GetCommandLineArgs (), envv, Environment.GetEnvironmentVariable ("HOME"), false, true, true); term.ChildExited += new EventHandler (OnChildExited); VScrollbar vscroll = new VScrollbar (term.Adjustment); HBox hbox = new HBox (); hbox.PackStart (term, true, true, 0); hbox.PackStart (vscroll, false, true, 0); frame.ShadowType = Gtk.ShadowType.In; ScrolledWindow sw = new ScrolledWindow (); sw.Add (hbox); frame.Add (sw); Control.ShowAll (); /* Runtime.TaskService.CompilerOutputChanged += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (SetOutput)); projectService.StartBuild += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (SelectMessageView)); projectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed)); projectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen)); */ }
public HDateEdit() { this.Build(); CurrentDate = DateTime.Now; NormalColor = comboBox.Entry.Style.Text( Gtk.StateType.Normal ); // comboBox.Entry.Changed += new EventHandler( OnTxtDateChanged ); comboBox.PopupButton.Clicked += new EventHandler( OnBtnShowCalendarClicked ); }
private void CreateAbout() { Gdk.Color fgcolor = new Gdk.Color(); Gdk.Color.Parse("red", ref fgcolor); Label version = new Label() { Markup = string.Format( "<span font_size='small' fgcolor='#729fcf'>{0}</span>", string.Format( Properties_Resources.Version, this.Controller.RunningVersion, this.Controller.CreateTime.GetValueOrDefault().ToString("d"))), Xalign = 0 }; Label credits = new Label() { LineWrap = true, LineWrapMode = Pango.WrapMode.Word, Markup = "<span font_size='small' fgcolor='#729fcf'>" + "Copyright © 2013–" + DateTime.Now.Year.ToString() + " GRAU DATA AG, Aegif and others.\n" + "\n" + Properties_Resources.ApplicationName + " is Open Source software. You are free to use, modify, " + "and redistribute it under the GNU General Public License version 3 or later." + "</span>", WidthRequest = 330, Wrap = true, Xalign = 0 }; LinkButton website_link = new LinkButton(this.Controller.WebsiteLinkAddress, Properties_Resources.Website); website_link.ModifyFg(StateType.Active, fgcolor); LinkButton credits_link = new LinkButton(this.Controller.CreditsLinkAddress, Properties_Resources.Credits); LinkButton report_problem_link = new LinkButton(this.Controller.ReportProblemLinkAddress, Properties_Resources.ReportProblem); HBox layout_links = new HBox(false, 0); layout_links.PackStart(website_link, false, false, 0); layout_links.PackStart(credits_link, false, false, 0); layout_links.PackStart(report_problem_link, false, false, 0); VBox layout_vertical = new VBox(false, 0); layout_vertical.PackStart(new Label(string.Empty), false, false, 42); layout_vertical.PackStart(version, false, false, 0); layout_vertical.PackStart(credits, false, false, 9); layout_vertical.PackStart(new Label(string.Empty), false, false, 0); layout_vertical.PackStart(layout_links, false, false, 0); HBox layout_horizontal = new HBox(false, 0) { BorderWidth = 0, HeightRequest = 260, WidthRequest = 640 }; layout_horizontal.PackStart(new Label(string.Empty), false, false, 150); layout_horizontal.PackStart(layout_vertical, false, false, 0); this.Add(layout_horizontal); }
public frmFriendManager () : base (Gtk.WindowType.Toplevel) { this.Build (); Gdk.Color fontcolor = new Gdk.Color(255,255,255); label1.ModifyFg(StateType.Normal, fontcolor); label2.ModifyFg(StateType.Normal, fontcolor); label3.ModifyFg(StateType.Normal, fontcolor); label4.ModifyFg(StateType.Normal, fontcolor); label5.ModifyFg(StateType.Normal, fontcolor); Gdk.Color col = new Gdk.Color (); Gdk.Color.Parse ("#3b5998", ref col); ModifyBg (StateType.Normal, col); FriendManager.CampaignStopLogevents.addToLogger += new EventHandler (CampaignnameLog); txtUseSingleMessage.Visible = false; try { chkUseSingleItem.Label = "Use Single Keyword"; btnFriendsLoadKeywords.Sensitive = true; btnLoadProfileUrlFriendManager.Sensitive = false; btnFridendProfileUrl.Sensitive = false; btn_LoadUrlsMessage.Sensitive = false; btnFriendsLoadPicture.Sensitive = false; chkUseUploadedProfileUrls.Sensitive=true; txt_noOfFriendsCount.Sensitive=true; cmbFriendsInput.Active=0; chkFriendsManagerSendWithTxtMessage.Sensitive=false; chk_ExportDataFriendsManager.Sensitive=true; btnStopProcessFriendManager.Sensitive=false; btn_LoadSingleImage.Visible=false; chk_UseSingleImage.Sensitive=false; //chkFriendsManagerSendWithTxtMessage.Visible=false; chk_ExportDataFriendsManager.Visible=false; btn_loadFanpageUrls.Sensitive=false; } catch (Exception ex) { Console.WriteLine (ex.StackTrace); } }
/// <summary> /// Initializes a new instance of the <see cref="PrototypeBackend.DPin"/> class. /// </summary> /// <param name="info">Info.</param> /// <param name="context">Context.</param> public DPin(SerializationInfo info, StreamingContext context) { Type = (PinType)info.GetByte ("Type"); Mode = (PinMode)info.GetByte ("Mode"); Name = info.GetString ("Name"); Number = info.GetUInt32 ("Number"); AnalogNumber = info.GetInt32 ("AnalogNumber"); SDA = info.GetBoolean ("SDA"); SCL = info.GetBoolean ("SCL"); RX = info.GetBoolean ("RX"); TX = info.GetBoolean ("TX"); PlotColor = new Gdk.Color (info.GetByte ("RED"), info.GetByte ("GREEN"), info.GetByte ("BLUE")); }
public static Gdk.Color ConvertStringToColor(string color) { string[] rgba = color.Split(char.Parse(Constants.COLOR_SEPARATOR)); Gdk.Color clr = new Gdk.Color(0,0,0); clr.Red = ushort.Parse(rgba[0]); clr.Green = ushort.Parse(rgba[1]); clr.Blue = ushort.Parse(rgba[2]); clr.Pixel = uint.Parse(rgba[3]); return clr; }
public SparkleWindow() : base("") { Title = "SparkleShare Setup"; BorderWidth = 0; IconName = "folder-sparkleshare"; Resizable = false; WindowPosition = WindowPosition.Center; SetSizeRequest (680, 440); DeleteEvent += delegate (object o, DeleteEventArgs args) { args.RetVal = true; Close (); }; HBox = new HBox (false, 6); VBox = new VBox (false, 0); Wrapper = new VBox (false, 0) { BorderWidth = 30 }; Buttons = CreateButtonBox (); VBox.PackStart (Wrapper, true, true, 0); VBox.PackStart (Buttons, false, false, 0); EventBox box = new EventBox (); Gdk.Color bg_color = new Gdk.Color (); Gdk.Color.Parse ("#2e3336", ref bg_color); box.ModifyBg (StateType.Normal, bg_color); string image_path = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare", "pixmaps", "side-splash.png"); Image side_splash = new Image (image_path) { Yalign = 1 }; box.Add (side_splash); HBox.PackStart (box, false, false, 0); HBox.PackStart (VBox, true, true, 0); base.Add (HBox); }
public DemoRotatedText () : base ("Rotated text") { DrawingArea drawingArea = new DrawingArea (); Gdk.Color white = new Gdk.Color (0xff, 0xff, 0xff); // This overrides the background color from the theme drawingArea.ModifyBg (StateType.Normal, white); drawingArea.ExposeEvent += new ExposeEventHandler (RotatedTextExposeEvent); this.Add (drawingArea); this.DeleteEvent += new DeleteEventHandler (OnWinDelete); this.SetDefaultSize (2 * RADIUS, 2 * RADIUS); this.ShowAll (); }
public BuildProjectDialog(Project project) : base("BuildProjectDialog.ui", "buildproject") { Gtk.TextBuffer buffer_intro; this.project = project; buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ()); status_text.Buffer = buffer; color = totalprogress_label.Style.Background (StateType.Normal); buffer_intro = new Gtk.TextBuffer (new Gtk.TextTagTable ()); textview_intro.Buffer = buffer_intro; textview_intro.ModifyBase (Gtk.StateType.Normal, color); buffer_intro.Text = Catalog.GetString ("Welcome to the project building process. Press the 'Generate' button to start this process."); }
public LinkLabel(string text, Uri uri) { CanFocus = true; AppPaintable = true; this.uri = uri; label = new Label(text); label.Show(); link_color = label.Style.Background(StateType.Selected); ActAsLink = true; Add(label); }
public TimeStatisticsView (Gtk.Widget parent) { this.Build (); store = new TreeStore ( typeof (Gdk.Pixbuf), // Icon typeof(string), // Text typeof(int), // Count typeof(float), // Total time typeof(float), // Average typeof(float), // Min typeof(float), // Max typeof(bool), // Expanded typeof(Counter), typeof(CounterValue), typeof(bool), // Show stats typeof(bool), // Show icon typeof(Gdk.Color)); // Color treeView.Model = store; normalColor = parent.Style.Foreground (StateType.Normal); CellRendererText crt = new CellRendererText (); CellRendererPixbuf crp = new CellRendererPixbuf (); TreeViewColumn col = new TreeViewColumn (); col.Title = "Counter"; col.PackStart (crp, false); col.AddAttribute (crp, "pixbuf", 0); col.AddAttribute (crp, "visible", ColShowIcon); col.PackStart (crt, true); col.AddAttribute (crt, "text", 1); treeView.AppendColumn (col); col.SortColumnId = 1; treeView.AppendColumn ("Count", crt, "text", 2).SortColumnId = 2; treeView.AppendColumn ("Total Time", new CellRendererText (), "text", 3, "foreground-gdk", ColColor).SortColumnId = 3; treeView.AppendColumn ("Average Time", crt, "text", 4, "visible", ColShowStats).SortColumnId = 4; treeView.AppendColumn ("Min Time", crt, "text", 5, "visible", ColShowStats).SortColumnId = 5; treeView.AppendColumn ("Max Time", crt, "text", 6, "visible", ColShowStats).SortColumnId = 6; Show (); foreach (TreeViewColumn c in treeView.Columns) c.Resizable = true; treeView.TestExpandRow += HandleTreeViewTestExpandRow; treeView.RowActivated += HandleTreeViewRowActivated; }
public FanPage () : base (Gtk.WindowType.Toplevel) { this.Build (); Gdk.Color fontcolor = new Gdk.Color(255,255,255); label1.ModifyFg(StateType.Normal, fontcolor); label2.ModifyFg(StateType.Normal, fontcolor); label6.ModifyFg(StateType.Normal, fontcolor); label4.ModifyFg(StateType.Normal, fontcolor); label5.ModifyFg(StateType.Normal, fontcolor); Gdk.Color col = new Gdk.Color (); Gdk.Color.Parse ("#3b5998", ref col); ModifyBg (StateType.Normal, col); // PageManager.CampaignStopLogevents.addToLogger += new EventHandler (CampaignnameLog); BackGroundColorChangeMenuBar (); TxtUseSingleItem.Visible = false; try { btnUploadKeyword.Sensitive=true; btnUploadMessageFanPage.Sensitive = false; btnUploadPicsFanPageManager.Sensitive=false; btnUploadUrlFanPage.Sensitive=false; btn_FanPageLoadUrlsMassege.Sensitive=true; chkExportDataPageManager.Sensitive=false; Txt_NoofPostPerURLPageManager.Sensitive=false; cmbSelectInputFanPage.Active=0; btn_FanPageLoadUrlsMassege.Sensitive=false; chkFanPageManagerSendPicWithMessage.Sensitive=false; chkExportDataPageManager.Sensitive=true; rbk_fanPageScraperByKeyword.Active=true; btnStopProcess.Sensitive=false; btn_LoadSingleImage.Visible = false; chk_UseSingleImage.Sensitive=false; //chkFanPageManagerSendPicWithMessage.Visible = false; } catch (Exception ex) { Console.WriteLine (ex.StackTrace); } }
public void Fill(int id) { Status_id = id; NewItem = false; MainClass.StatusMessage(String.Format ("Запрос статуса №{0}...", id)); string sql = "SELECT status.* FROM status WHERE status.id = @id"; QSMain.CheckConnectionAlive(); try { MySqlCommand cmd = new MySqlCommand(sql, QSMain.connectionDB); cmd.Parameters.AddWithValue("@id", id); using(MySqlDataReader rdr = cmd.ExecuteReader()) { rdr.Read(); labelId.Text = rdr["id"].ToString(); entryName.Text = rdr["name"].ToString(); checkColor.Active = rdr["color"] != DBNull.Value; if(rdr["color"] != DBNull.Value) { Gdk.Color TempColor = new Gdk.Color(); Gdk.Color.Parse(rdr.GetString ("color"), ref TempColor); colorbuttonMarker.Color = TempColor; } //Читаем лист типов заказов string[] types = rdr["usedtypes"].ToString().Split(new char[] {','} ); foreach(string ordertype in types) { if(checklistTypes.CheckButtons.ContainsKey(ordertype)) checklistTypes.CheckButtons[ordertype].Active = true; } } MainClass.StatusMessage("Ok"); this.Title = entryName.Text; } catch (Exception ex) { Console.WriteLine(ex.ToString()); MainClass.StatusMessage("Ошибка получения информации о статусе!"); QSMain.ErrorMessage(this,ex); } TestCanSave(); }
/// <summary> /// Changes color to new state /// </summary> public void FlashColor() { if (flashedWidget == null) { return; } if (color < 0) { color = 0; } if (color > 255) { color = 255; } Gdk.Color colr = new Gdk.Color(NULL_COLOR, (byte)color, (byte)color); if (flashedWidget is Gtk.Button) { (flashedWidget as Gtk.Button).ModifyBg(StateType.Prelight, colr); (flashedWidget as Gtk.Button).ModifyBg(StateType.Normal, colr); return; } if (flashedWidget is Gtk.ToolButton) { TestAll(colr); (flashedWidget as Gtk.ToolButton).ModifyBg(StateType.Prelight, colr); (flashedWidget as Gtk.ToolButton).ModifyBg(StateType.Normal, colr); return; } if (flashedWidget is Gtk.Entry) { (flashedWidget as Gtk.Entry).ModifyBase(StateType.Normal, colr); return; } if (flashedWidget is Gtk.Label) { (flashedWidget as Gtk.Label).ModifyFg(StateType.Normal, colr); return; } if (flashedWidget is Gtk.EventBox) { (flashedWidget as Gtk.EventBox).ModifyBg(StateType.Normal, colr); return; } throw new Exception("FlashColor_Control_Type_NotSupported" + flashedWidget.ToString()); }
public SparkleSetupWindow() : base("") { Title = Catalog.GetString ("SparkleShare Setup"); BorderWidth = 0; IconName = "folder-sparkleshare"; Resizable = false; WindowPosition = WindowPosition.Center; Deletable = false; SetSizeRequest (680, 440); DeleteEvent += delegate (object o, DeleteEventArgs args) { args.RetVal = true; Close (); }; HBox = new HBox (false, 6); VBox = new VBox (false, 0); Wrapper = new VBox (false, 0) { BorderWidth = 30 }; Buttons = CreateButtonBox (); VBox.PackStart (Wrapper, true, true, 0); VBox.PackStart (Buttons, false, false, 0); EventBox box = new EventBox (); Gdk.Color bg_color = new Gdk.Color (); Gdk.Color.Parse ("#000", ref bg_color); box.ModifyBg (StateType.Normal, bg_color); Image side_splash = SparkleUIHelpers.GetImage ("side-splash.png"); side_splash.Yalign = 1; box.Add (side_splash); HBox.PackStart (box, false, false, 0); HBox.PackStart (VBox, true, true, 0); base.Add (HBox); }
public frmLicensing() : base(Gtk.WindowType.Toplevel) { this.Build(); Gdk.Color fontcolor = new Gdk.Color(255, 255, 255); lblUser.ModifyFg(StateType.Normal, fontcolor); lblPasswword.ModifyFg(StateType.Normal, fontcolor); lblEmail.ModifyFg(StateType.Normal, fontcolor); lblTransactionID.ModifyFg(StateType.Normal, fontcolor); lblstatus.ModifyFg(StateType.Normal, fontcolor); lblLicenseStatus.ModifyFg(StateType.Normal, fontcolor); lblMacID.ModifyFg(StateType.Normal, fontcolor); lblLicenseType.ModifyFg(StateType.Normal, fontcolor); Gdk.Color col = new Gdk.Color(); Gdk.Color.Parse("#3b5998", ref col); ModifyBg(StateType.Normal, col); try { btnStart.Visible = false; cpuID = licensemanager.FetchMacId(); new Thread(() => { Gtk.Application.Invoke((delegate { lblMacID.Text += " " + cpuID; lblMacID.ModifyBg(StateType.Normal, new Gdk.Color(120, 10, 120)); btnActivate.Label = "Validate Your License"; btnActivate.Visible = false; //AddToLogs("[ " + DateTime.Now + " ] => [ Please wait while your License is Validated ]"); //timer_start_LD.Start(); LicenceValidation(); DisableControls(); })); }).Start(); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(ex.Message, PDGlobals.pathErrorLog + "\\ErrorLogLicensing.txt"); } }
ColourExample() { FindColors(); win = new Window("Strawberry Reds"); win.SetDefaultSize(610, 70); win.DeleteEvent += OnWinDelete; da = new DrawingArea(); da.ExposeEvent += OnExposed; Gdk.Color col = new Gdk.Color(); Gdk.Color.Parse("red", ref col); win.ModifyBg(StateType.Normal, col); da.ModifyBg(StateType.Normal, new Gdk.Color(128, 128, 128)); win.Add(da); win.ShowAll(); }
public void SetBackgroundColor(Gdk.Color backgroundColor) { if (_root != null) { _root.ModifyBg(StateType.Normal, backgroundColor); _viewPort.ModifyBg(StateType.Normal, backgroundColor); if (_headerContainer != null && !_headerContainer.Children.Any()) { _headerContainer.ModifyBg(StateType.Normal, backgroundColor); } if (_footerContainer != null && !_footerContainer.Children.Any()) { _footerContainer.ModifyBg(StateType.Normal, backgroundColor); } } }
public LinkLabel(string text, Uri uri) { CanFocus = true; AppPaintable = true; this.uri = uri; label = new Label(text); label.Show(); link_color = label.Style.Background (StateType.Selected); hover_color = new Gdk.Color ((byte)(link_color.Red + 50), (byte)(link_color.Green + 50), (byte)(link_color.Blue + 50)); ActAsLink = true; Add(label); }
///<summary>Parse a font type</summary> void ParseDisplayType(XmlNode parentNode, out Gdk.Color fg, out Gdk.Color bg) { fg = Gdk.Color.Zero; bg = Gdk.Color.Zero; XmlNodeList childNodes = parentNode.ChildNodes; foreach (XmlNode node in childNodes) { if (node.Name == "foreground") { Gdk.Color.Parse(node.InnerText, ref fg); } if (node.Name == "background") { Gdk.Color.Parse(node.InnerText, ref bg); } } }
public MainWindow() : base(Gtk.WindowType.Toplevel) { this.Build(); notebook.CurrentPage = 0; this.Icon = this.RenderIcon("Icon", IconSize.Menu, null); this.Title = "Osobni troškovnik"; bgColor = new Gdk.Color(); Gdk.Color.Parse("#B9CFDD", ref bgColor); eventboxHome.ModifyBg(StateType.Normal, bgColor); eventBoxTroskovi.ModifyBg(StateType.Normal, bgColor); eventBoxStatistika.ModifyBg(StateType.Normal, bgColor); eventBoxTotalTroskovi.ModifyBg(StateType.Normal, bgColor); trosakPresenter = new TrosakNodeStore(); setupTreeView(); }
public void TestAll(Gdk.Color colr) { flashedWidget.ModifyBase(StateType.Prelight, colr); flashedWidget.ModifyBase(StateType.Active, colr); flashedWidget.ModifyBase(StateType.Insensitive, colr); flashedWidget.ModifyBase(StateType.Normal, colr); flashedWidget.ModifyBase(StateType.Selected, colr); flashedWidget.ModifyBg(StateType.Prelight, colr); flashedWidget.ModifyBg(StateType.Active, colr); flashedWidget.ModifyBg(StateType.Insensitive, colr); flashedWidget.ModifyBg(StateType.Normal, colr); flashedWidget.ModifyBg(StateType.Selected, colr); flashedWidget.ModifyFg(StateType.Prelight, colr); flashedWidget.ModifyFg(StateType.Active, colr); flashedWidget.ModifyFg(StateType.Insensitive, colr); flashedWidget.ModifyFg(StateType.Normal, colr); flashedWidget.ModifyFg(StateType.Selected, colr); }
protected override bool OnExposeEvent(Gdk.EventExpose evnt) { if (!IsDrawable) { return(false); } Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window); try { Gdk.Color color = Style.Background(StateType.Normal); theme.DrawFrame(cr, Allocation, CairoExtensions.GdkColorToCairoColor(color)); return(base.OnExposeEvent(evnt)); } finally { ((IDisposable)cr.Target).Dispose(); ((IDisposable)cr).Dispose(); } }
public frmAddAccounts () : base (Gtk.WindowType.Toplevel) { this.Build (); Gdk.Color fontcolor = new Gdk.Color(255,255,255); label1.ModifyFg(StateType.Normal, fontcolor); label2.ModifyFg(StateType.Normal, fontcolor); label3.ModifyFg(StateType.Normal, fontcolor); label4.ModifyFg(StateType.Normal, fontcolor); label5.ModifyFg(StateType.Normal, fontcolor); Gdk.Color col = new Gdk.Color (); Gdk.Color.Parse ("#3b5998", ref col); ModifyBg (StateType.Normal, col); }
public WindowMijenjajKorisnika(KorisnikNode k) : base(Gtk.WindowType.Toplevel) { this.Build(); Gdk.Color colorLightBlue = new Gdk.Color(); Gdk.Color.Parse("#3FB2F0", ref colorLightBlue); eventboxMijenjajKorisnika.ModifyBg(StateType.Normal, colorLightBlue); Add(eventboxMijenjajKorisnika); labelID.Text = k.id.ToString(); entryIme.Text = k.ime; entryPrezime.Text = k.prezime; calendarDatumRodjenja.Date = Convert.ToDateTime(k.datum_rodjenja); spinbuttonVisina.Value = double.Parse(k.visina); spinbuttonTezina.Value = double.Parse(k.tezina); PopuniDatum(); }
/// <summary> /// Whether the Progress implementation should change it's display to display an error /// </summary> /// <param name='hasError'> /// If set to <c>true</c> has error. /// </param> public void SetError(bool hasError) { //assure that value is set using GTK+ main loop thread to avoid any threading problems Gtk.Application.Invoke(delegate { if (hasError == true) { Gdk.Color col = new Gdk.Color(255, 0, 0); ModifyFg(Gtk.StateType.Normal, col); } else { Gdk.Color col = new Gdk.Color(0, 0, 0); ModifyFg(Gtk.StateType.Normal, col); } m_hasError = hasError; }); }
public LinkLabel(string text, Uri uri) { CanFocus = true; AppPaintable = true; this.uri = uri; label = new Label(text); label.Show(); link_color = label.Style.Background(StateType.Selected); hover_color = new Gdk.Color((byte)(link_color.Red + 50), (byte)(link_color.Green + 50), (byte)(link_color.Blue + 50)); ActAsLink = true; Add(label); }
public OptionsWidget(OptionsViewModel viewModel) { _viewModel = viewModel; if (MonoDevelop.Ide.IdeApp.Preferences.UserInterfaceTheme == MonoDevelop.Ide.Theme.Dark) { _groupHeaderColor = new Gdk.Color(0x22, 0x22, 0x22); _altRowColor = new Gdk.Color(0x44, 0x44, 0x44); } else { _groupHeaderColor = new Gdk.Color(0xaa, 0xaa, 0xaa); _altRowColor = new Gdk.Color(0xee, 0xee, 0xee); } this.Build(); this.InitializeWidget(); }
/// <summary> /// Initializes a new instance of the Row class with an array of Cell objects and /// the foreground color, background color, and font of the Row /// </summary> /// <param name="cells">An array of Cell objects that represent the Cells of the Row</param> /// <param name="foreColor">The foreground Color of the Row</param> /// <param name="backColor">The background Color of the Row</param> /// <param name="font">The Font used to draw the text in the Row's Cells</param> public Row(Cell[] cells, Gdk.Color foreColor, Gdk.Color backColor, Pango.FontDescription font) { if (cells == null) { throw new ArgumentNullException("cells", "Cell[] cannot be null"); } this.Init(); this.ForeColor = foreColor; this.BackColor = backColor; this.Font = font; if (cells.Length > 0) { this.Cells.AddRange(cells); } }
static Gdk.Color StringToColor (string colorStr) { string[] rgb = colorStr.Substring (colorStr.IndexOf (':') + 1).Split ('/'); if (rgb.Length != 3) return new Gdk.Color (0, 0, 0); Gdk.Color color = Gdk.Color.Zero; try { color.Red = UInt16.Parse (rgb[0], System.Globalization.NumberStyles.HexNumber); color.Green = UInt16.Parse (rgb[1], System.Globalization.NumberStyles.HexNumber); color.Blue = UInt16.Parse (rgb[2], System.Globalization.NumberStyles.HexNumber); } catch { // something went wrong, then use neutral black color color = new Gdk.Color (0, 0, 0); } return color; }
protected unsafe void RecreateSymbolStateImages() { foreach (StateType st in Enum.GetValues(typeof(StateType))) { if (mSymbolStates.ContainsKey(st)) { mSymbolStates[st].Dispose(); mSymbolStates.Remove(st); } if (mSymbol != null) { Gdk.Color fore_color = this.Style.Foreground(st); Gdk.Pixbuf buf = (Gdk.Pixbuf)mSymbol.Clone(); int h = buf.Height; int w = buf.Width; int stride = buf.Rowstride; int chan = buf.NChannels; byte *cur_row = (byte *)buf.Pixels; for (int j = 0; j < h; j++) { byte *cur_pixel = cur_row; for (int i = 0; i < w; i++) { byte r = (byte)(fore_color.Red / 256); byte g = (byte)(fore_color.Green / 256); byte b = (byte)(fore_color.Blue / 256); byte a = cur_pixel[3]; cur_pixel[0] = r; cur_pixel[1] = g; cur_pixel[2] = b; cur_pixel[3] = a; cur_pixel += chan; } cur_row += stride; } mSymbolStates.Add(st, buf); } } }
void CreateControl() { Gdk.Color white = new Gdk.Color(); Gdk.Color.Parse("white", ref white); Gdk.Color black = new Gdk.Color(); Gdk.Color.Parse("black", ref black); terminal = new Vte.Terminal { CursorBlinks = true, MouseAutohide = true, ScrollOnKeystroke = true, DeleteBinding = Vte.TerminalEraseBinding.Auto, BackspaceBinding = Vte.TerminalEraseBinding.Auto, Encoding = "UTF-8", Visible = true, IsFocus = true, BackgroundTintColor = black, }; string[] envv = new string[Environment.GetEnvironmentVariables().Count]; int i = 0; foreach (DictionaryEntry e in Environment.GetEnvironmentVariables()) { if ((string)e.Key == string.Empty || (string)e.Value == string.Empty) { continue; } string tmp = String.Format("{0}={1}", e.Key, e.Value); envv[i] = tmp; i++; } terminal.ForkCommand(Environment.GetEnvironmentVariable("SHELL"), new string[0], envv, Environment.CurrentDirectory, false, true, true); }
public DefectiveItemsReceptionView() { this.Build(); List <CullingCategory> types; using (IUnitOfWork uow = UnitOfWorkFactory.CreateWithoutRoot()) { types = uow.GetAll <CullingCategory>().OrderBy(c => c.Name).ToList(); } var colorWhite = new Gdk.Color(0xff, 0xff, 0xff); var colorLightRed = new Gdk.Color(0xff, 0x66, 0x66); ytreeReturns.ColumnsConfig = Gamma.GtkWidgets.ColumnsConfigFactory.Create <DefectiveItemNode>() .AddColumn("Номенклатура").AddTextRenderer(node => node.Name) .AddColumn("Кол-во").AddNumericRenderer(node => node.Amount) .Adjustment(new Adjustment(0, 0, 9999, 1, 100, 0)) .Editing(true) .AddColumn("Тип брака") .AddComboRenderer(x => x.TypeOfDefect) .SetDisplayFunc(x => x.Name) .FillItems(types) .AddSetter( (c, n) => { c.Editable = true; c.BackgroundGdk = n.TypeOfDefect == null ? colorLightRed : colorWhite; } ) .AddColumn("Источник\nбрака") .AddEnumRenderer(x => x.Source, true, new Enum[] { DefectSource.None }) .AddSetter( (c, n) => { c.Editable = true; c.BackgroundGdk = n.Source == DefectSource.None ? colorLightRed : colorWhite; } ) .AddColumn("") .Finish(); ytreeReturns.ItemsDataSource = defectiveList; }
protected override bool OnExposeEvent(Gdk.EventExpose evnt) { base.OnExposeEvent(evnt); Gdk.Rectangle expose = Allocation; Gdk.Color save = Gdk.Color.Zero; bool hasFgColor = false; int x = 1; col.CellSetCellData(tree.Model, iter, false, false); foreach (CellRenderer cr in col.CellRenderers) { if (!cr.Visible) { continue; } if (cr is CellRendererText) { hasFgColor = ((CellRendererText)cr).GetCellForegroundSet(); save = ((CellRendererText)cr).ForegroundGdk; ((CellRendererText)cr).ForegroundGdk = Style.Foreground(State); } int sp, wi, he, xo, yo; col.CellGetPosition(cr, out sp, out wi); Gdk.Rectangle bgrect = new Gdk.Rectangle(x, expose.Y, wi, expose.Height - 2); cr.GetSize(tree, ref bgrect, out xo, out yo, out wi, out he); int leftMargin = (int)((bgrect.Width - wi) * cr.Xalign); int topMargin = (int)((bgrect.Height - he) * cr.Yalign); Gdk.Rectangle cellrect = new Gdk.Rectangle(bgrect.X + leftMargin, bgrect.Y + topMargin + 1, wi, he); cr.Render(this.GdkWindow, this, bgrect, cellrect, expose, CellRendererState.Focused); x += bgrect.Width + col.Spacing + 1; if (cr is CellRendererText) { ((CellRendererText)cr).ForegroundGdk = save; ((CellRendererText)cr).SetCellForegroundSet(hasFgColor); } } return(true); }
static public void NewNumber(VBox pg, string numbertype, string name) { // Gui var tbox = new HBox(); var tp = new Label(numbertype); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0); var nm = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0); #if RottenBackGround tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0)); #else tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0)); #endif tbox.Add(tp); tbox.Add(nm); //var ttxt = new TextView(); ttxt.SetSizeRequest(400, 25); var ttxt = new Entry(); ttxt.SetSizeRequest(400, 25); var col1 = new Gdk.Color(); var suc1 = Gdk.Color.Parse("#00b4ff", ref col1); var col2 = new Gdk.Color(); var suc2 = Gdk.Color.Parse("#000b0f", ref col2); if (!suc1) { tbox.Add(new Label("FG color parse failure!")); // debug only } if (!suc2) { tbox.Add(new Label("BG color parse failure!")); // debug only } //ttxt.BorderWidth = 2; ttxt.ModifyBase(StateType.Normal, col2); ttxt.ModifyText(StateType.Normal, col1); ttxt.ModifyText(StateType.Insensitive, new Gdk.Color(0, 90, 127)); ttxt.ModifyBase(StateType.Insensitive, new Gdk.Color(0x02, 0x2b, 0x2f)); MainClass.DStrings[name] = ttxt; // This is only for widget storage... The types only come into play when exporting. tbox.Add(ttxt); pg.Add(tbox); // Database MyDataBase.fields[name] = numbertype; MyDataBase.defaults[name] = ""; //objlink[ttxt.Buffer] = name; objlink[ttxt] = name; //ttxt.Buffer.Changed += OnTxt; ttxt.Changed += OnTxt; }
string AdjustColors(string markup) { StringBuilder result = new StringBuilder(); int idx = markup.IndexOf("foreground=\""); int offset = 0; Gdk.Color baseColor; // This is a workaround for Bug 559804 - Strings in search result pad are near-invisible // On mac it's not possible to get the white background color with the Base or Background // methods. If this bug is fixed or a better work around is found - remove this hack. if (Platform.IsMac) { { baseColor = treeviewSearchResults.Style.Light(treeviewSearchResults.State); } } else { baseColor = treeviewSearchResults.Style.Base(treeviewSearchResults.State); } while (idx > 0) { idx += "foreground=\"".Length; result.Append(markup.Substring(offset, idx - offset)); if (idx + 7 >= markup.Length) { offset = idx; break; } offset = idx + 7; string colorStr = markup.Substring(idx, 7); Gdk.Color color = Gdk.Color.Zero; if (Gdk.Color.Parse(colorStr, ref color)) { colorStr = SyntaxMode.ColorToPangoMarkup(AdjustColor(baseColor, color)); } result.Append(colorStr); idx = markup.IndexOf("foreground=\"", idx); } result.Append(markup.Substring(offset, markup.Length - offset)); return(result.ToString()); }
private void UpdateButton() { if (calendarItem != null && calendarItem.id > 0) { this.Image = null; PangoText.SetText(calendarItem.Text); this.TooltipText = calendarItem.FullText; this.Relief = ReliefStyle.Normal; Drag.DestUnset(this); Drag.SourceSet(this, Gdk.ModifierType.Button1Mask, null, Gdk.DragAction.Move); Gdk.Color col = new Gdk.Color(); Gdk.Color.Parse(calendarItem.Color, ref col); logger.Debug("a={0} - {1} - {2}", col.Red, col.Green, col.Blue); this.ModifyBg(StateType.Normal, col); byte r = (byte)Math.Min(((double)col.Red / ushort.MaxValue) * byte.MaxValue + 30, byte.MaxValue); byte g = (byte)Math.Min(((double)col.Green / ushort.MaxValue) * byte.MaxValue + 30, byte.MaxValue); byte b = (byte)Math.Min(((double)col.Blue / ushort.MaxValue) * byte.MaxValue + 30, byte.MaxValue); col = new Gdk.Color(r, g, b); this.ModifyBg(StateType.Prelight, col); logger.Debug("b={0} - {1} - {2}", col.Red, col.Green, col.Blue); //Tag PangoTag.SetText(calendarItem.Tag); PangoMessages.SetText(calendarItem.MessageCount + "✉"); } else if (calendarItem != null && calendarItem.id == 0) { Pango.FontDescription desc = Pango.FontDescription.FromString("Serif Bold 35"); PangoText.FontDescription = desc; PangoText.SetText(calendarItem.Text); this.Relief = ReliefStyle.Normal; Gdk.Color col = new Gdk.Color(); Gdk.Color.Parse(calendarItem.Color, ref col); this.ModifyBg(StateType.Normal, col); this.ModifyBg(StateType.Prelight, col); } else { this.Image = null; this.TooltipText = null; Drag.SourceUnset(this); this.Relief = ReliefStyle.None; this.ModifyBg(StateType.Normal); } }
public void TestBoxed() { Gdk.Color color = new Gdk.Color(0, 0, 0); GLib.Value val = (GLib.Value)color; SetProperty("my_boxed", val); val.Dispose(); if (!MyBoxed.Equals(color)) { Console.Error.WriteLine("boxed Property setter did not run."); Environment.Exit(1); } GLib.Value val2 = GetProperty("my_boxed"); if (color.Equals((Gdk.Color)val2.Val)) { Console.Error.WriteLine("boxed Property set/get roundtrip failed."); Environment.Exit(1); } Console.WriteLine("boxed succeeded."); }
public TitleBox() { this.Build(); this.eventboxTitleBar.ButtonPressEvent += eventboxTitle_HandleButtonPressEvent; this.eventboxTitleBar.ButtonReleaseEvent += eventboxTitle_HandleButtonReleaseEvent; this.eventboxTitleBar.MotionNotifyEvent += eventboxTitle_HandleMotionNotifyEvent; this.buttonMinimize.Clicked += buttonMinimize_HandleClicked; this.buttonMaximize.Clicked += buttonMaximize_HandleClicked; this.buttonClose.Clicked += buttonClose_HandleClicked; this.buttonMinimize.Image = ThemingHelper.LoadImageMinBtn(); this.buttonMaximize.Image = ThemingHelper.LoadImageMaxBtn(); this.buttonClose.Image = ThemingHelper.LoadImageCloseBtn(); // Set style for title box from resource style this.StyleSet += delegate(object o, Gtk.StyleSetArgs args) { Gdk.Color bgc = this.Style.Background(Gtk.StateType.Selected); this.eventboxCaption.ModifyBg(Gtk.StateType.Normal, bgc); this.eventboxButtons.ModifyBg(Gtk.StateType.Normal, bgc); this.eventboxTitleBarBottom.ModifyBg(Gtk.StateType.Normal, bgc); Gdk.Color fgc = this.Style.Base(Gtk.StateType.Active); this.labelCaption.ModifyFg(Gtk.StateType.Normal, fgc); }; // Init moving helper with top level window this.Realized += delegate(object sender, EventArgs e) { _movingHelper = new MovingHelper(this.Toplevel); MovingHelper.Window.GdkWindow.Title = this.labelCaption.Text; }; // buttons visibility this.buttonMaximize.Realized += delegate(object sender, EventArgs e) { this.buttonMaximize.Visible = _maximize_visible; this.buttonMaximize.Sensitive = _maximize_visible; }; this.buttonMinimize.Realized += delegate(object sender, EventArgs e) { this.buttonMinimize.Visible = _minimize_visible; this.buttonMinimize.Sensitive = _minimize_visible; }; }
void HandleHeaderDrawn(object o, DrawnArgs args) { Cairo.Context cr = args.Cr; cr.Save(); int wd = Allocation.Width - 48; Cairo.Color c1 = new Gdk.Color(65, 65, 65).ToCairoColor(); Cairo.Color c2 = new Gdk.Color(255, 255, 255).ToCairoColor(); Cairo.Gradient linpat = new LinearGradient(0, 0, wd, Allocation.Height); linpat.AddColorStop(0.00, c1); linpat.AddColorStop(1.00, c2); cr.Rectangle(0, 0, wd, Allocation.Height); cr.Source = linpat; //cr.PaintWithAlpha(0.5); cr.Fill(); cr.Color = new Color(1, 1, 1); cr.SelectFontFace("Arial", FontSlant.Normal, FontWeight.Bold); cr.SetFontSize(15.2); String txt = String.Empty; if (CurrentWidget != null) { if (CurrentWidget is DockableWidget) { txt = (CurrentWidget as DockableWidget).Title; } } //TextExtents te = cr.TextExtents(txt); cr.MoveTo(4, 20); cr.ShowText(txt); cr.Restore(); cr = null; }
private TreeView MakeTreeView() { TreeView tree = new TreeView(); tree.Selection.Changed += treeSelection_Changed; tree.Mapped += delegate(object sender, EventArgs args) { // Set bg color Gdk.Color color = Gdk.Color.Zero; Gdk.Color.Parse("#CFD7E2", ref color); //tree.ModifyBase(StateType.Normal, color); }; tree.HeadersVisible = false; tree.CanFocus = false; CellRendererPixbuf pixbufCell = new CellRendererPixbuf(); CellRendererText textCell = new CellRendererText(); CellRendererText countTextCell = new CellRendererText(); countTextCell.Sensitive = false; countTextCell.Alignment = Pango.Alignment.Right; countTextCell.Xalign = 1; CellRendererPixbuf closeCell = new CellRendererPixbuf(); TreeViewColumn column = new TreeViewColumn(); column.PackStart(pixbufCell, false); column.PackStart(textCell, true); column.PackStart(countTextCell, false); column.PackStart(closeCell, false); column.SetCellDataFunc(pixbufCell, new TreeCellDataFunc(ItemPixbufCellFunc)); column.SetCellDataFunc(textCell, new TreeCellDataFunc(ItemTextCellFunc)); column.SetCellDataFunc(countTextCell, new TreeCellDataFunc(ItemCountCellFunc)); tree.AppendColumn(column); tree.ExpanderColumn = column; tree.RowSeparatorFunc = delegate(TreeModel m, TreeIter i) { return(m.GetValue(i, 0) is SeparatorItem); }; return(tree); }
static string CreateColorTable(List <Gdk.Color> colorList) { var colorTable = new StringBuilder(); colorTable.Append(@"{\colortbl ;"); for (int i = 0; i < colorList.Count; i++) { Gdk.Color color = colorList [i]; colorTable.Append(@"\red"); colorTable.Append(color.Red / 256); colorTable.Append(@"\green"); colorTable.Append(color.Green / 256); colorTable.Append(@"\blue"); colorTable.Append(color.Blue / 256); colorTable.Append(";"); } colorTable.Append("}"); return(colorTable.ToString()); }
public UndeliveredOrdersPanelView() { this.Build(); Gdk.Color wh = new Gdk.Color(255, 255, 255); Gdk.Color gr = new Gdk.Color(223, 223, 223); yTreeView.ColumnsConfig = ColumnsConfigFactory.Create <object[]>() .AddColumn("Виновный") .AddTextRenderer(n => n[0] != null ? n[0].ToString() : "") .WrapWidth(150).WrapMode(Pango.WrapMode.WordChar) .AddColumn("Кол-во") .AddTextRenderer(n => n[1].ToString()) .WrapWidth(50).WrapMode(Pango.WrapMode.WordChar) .RowCells() .AddSetter <CellRenderer>((c, n) => c.CellBackgroundGdk = (int)n[2] % 2 == 0 ? wh : gr) .Finish(); _uow = UnitOfWorkFactory.CreateWithoutRoot(); }
protected override bool OnExposeEvent(Gdk.EventExpose evnt) { if (!composited || evnt.Window != GdkWindow) { return(base.OnExposeEvent(evnt)); } Cairo.Context cr = Gdk.CairoHelper.Create(evnt.Window); Gdk.Color color = Style.Background(State); ShapeSurface(cr, new Cairo.Color(color.Red / (double)ushort.MaxValue, color.Blue / (double)ushort.MaxValue, color.Green / (double)ushort.MaxValue, 0.85)); CairoExtensions.DisposeContext(cr); return(base.OnExposeEvent(evnt)); }
public UserInterface() { application = new Application("org.sparkleshare.SparkleShare", GLib.ApplicationFlags.None); application.Register(null); application.Activated += ApplicationActivatedDelegate; Gdk.Color color = UserInterfaceHelpers.RGBAToColor(new Label().StyleContext.GetColor(StateFlags.Insensitive)); SecondaryTextColor = UserInterfaceHelpers.ColorToHex(color); var tree_view = new TreeView(); color = UserInterfaceHelpers.MixColors( UserInterfaceHelpers.RGBAToColor(tree_view.StyleContext.GetColor(StateFlags.Selected)), UserInterfaceHelpers.RGBAToColor(tree_view.StyleContext.GetBackgroundColor(StateFlags.Selected)), 0.39); SecondaryTextColorSelected = UserInterfaceHelpers.ColorToHex(color); }
public void BackGroundColorChangeMenuBar() { try { da1 = new DrawingArea (); da1.ExposeEvent += OnExposed1; Gdk.Color col = new Gdk.Color (); Gdk.Color.Parse ("#3b5998", ref col); ModifyBg (StateType.Normal, col); da1.ModifyBg (StateType.Normal, col); } catch (Exception ex) { Console.Write (ex.Message); } }
Gdk.Color AdjustColor(Gdk.Color baseColor, Gdk.Color color) { double b1 = HslColor.Brightness(color); double b2 = HslColor.Brightness(baseColor); double delta = Math.Abs(b1 - b2); if (delta < 0.1) { HslColor color1 = color; color1.L -= 0.5; if (Math.Abs(HslColor.Brightness(color1) - b2) < delta) { color1 = color; color1.L += 0.5; } return(color1); } return(color); }
public static Gdk.Color[] PaletteFromString(string str) { IntPtr parsedColors; int n_colors; IntPtr native = GLib.Marshaller.StringToPtrGStrdup (str); bool raw_ret = gtk_color_selection_palette_from_string(native, out parsedColors, out n_colors); GLib.Marshaller.Free (native); // If things failed, return silently if (!raw_ret) { return null; } System.Console.WriteLine("Raw call finished, making " + n_colors + " actual colors"); Gdk.Color[] colors = new Gdk.Color[n_colors]; for (int i=0; i < n_colors; i++) { colors[i] = Gdk.Color.New(parsedColors); parsedColors = (IntPtr) ((int)parsedColors + Marshal.SizeOf(colors[i])); } return colors; }
public DateComboBox() { MinDate = DateTime.MinValue; MaxDate = DateTime.MaxValue; ErrorColor = new Gdk.Color(255, 0, 0); NormalColor = Entry.Style.Text(Gtk.StateType.Normal); Entry.Changed += HandleChanged; PopupButton.Clicked += delegate { var dlg = new DateComboBoxDialog(selectedDate ?? DateTime.Now, this.Mode); dlg.DateChanged += delegate { selectedDate = dlg.SelectedDate; ValidateDateRange(); SetValue(); }; dlg.ShowPopup(this); }; }
public void Fill(int id) { ItemId = id; NewItem = false; MainClass.StatusMessage(String.Format ("Запрос склада №{0}...", id)); string sql = "SELECT stocks.* FROM stocks WHERE stocks.id = @id"; QSMain.CheckConnectionAlive(); try { MySqlCommand cmd = new MySqlCommand(sql, QSMain.connectionDB); cmd.Parameters.AddWithValue("@id", id); using(MySqlDataReader rdr = cmd.ExecuteReader()) { rdr.Read(); labelId.Text = rdr["id"].ToString(); entryName.Text = rdr["name"].ToString(); checkColor.Active = rdr["color"] != DBNull.Value; if(rdr["color"] != DBNull.Value) { Gdk.Color TempColor = new Gdk.Color(); Gdk.Color.Parse(rdr.GetString ("color"), ref TempColor); colorbuttonMarker.Color = TempColor; } } MainClass.StatusMessage("Ok"); this.Title = entryName.Text; } catch (Exception ex) { logger.ErrorException("Ошибка получения информации о статусе!", ex); QSMain.ErrorMessage(this,ex); } TestCanSave(); }
// constructor public TileWidget(string colorBg, string figure, string color, coord size) { string imgName; if (color != "" && figure != "" && figure.ToLower () != "empty") { if (figure.ToLower () != "knight") { imgName = color.ToLower () [0].ToString () + figure.ToUpper () [0].ToString (); } else { imgName = color.ToLower () [0].ToString () + "N"; } Image img = loadSvg (imgName, size); Fixed f = new Fixed (); f.Add (img); f.ShowAll (); this.Add (f); this.Show (); } if (colorBg != "") { Gdk.Color col = new Gdk.Color (); Gdk.Color.Parse (colorBg, ref col); this.ModifyBg (StateType.Normal, col); } this.figure = figure; this.color = color; }