public DataBookTabLabel(DataView dv, CloseViewDelegate deleg, string str) { dataView = dv; doCloseFile = deleg; dataView.NotificationChanged += OnNotificationChanged; label = new Gtk.Label(str); label.UseMarkup = true; label.UseUnderline = false; Gtk.Image img = new Gtk.Image(Gtk.Stock.Close, Gtk.IconSize.Menu); img.SetSizeRequest(8, 8); // This doesn't compile in 1.0.2 and older, // keep it for later eg gtk# 2.0 closeButton = new Gtk.Button(img); closeButton.Relief = Gtk.ReliefStyle.None; closeButton.Clicked += OnCloseClicked; closeButton.CanFocus = false; this.Spacing = 2; this.PackStart(label, false, false, 0); this.PackStart(closeButton, false, false, 0); this.ShowAll(); }
public void Notification(Pixbuf pixbuf, string stripUrl, string name, string author) { var screen = win.Screen; const int diviser = 2; int desiredWidth = pixbuf.Width; int desiredHeight = pixbuf.Height; if (pixbuf.Width > screen.Width / diviser) { desiredWidth = screen.Width / diviser; desiredHeight = desiredHeight * desiredWidth / pixbuf.Width; } if (pixbuf.Height > screen.Height / diviser) { desiredHeight = screen.Height / diviser; desiredWidth = desiredWidth * desiredHeight / pixbuf.Height; } if (pixbuf.Width != desiredWidth || pixbuf.Height != desiredHeight) { pixbuf = pixbuf.ScaleSimple(desiredWidth, desiredHeight, InterpType.Bilinear); } image.Pixbuf = pixbuf; label.Markup = string.Format("<b>{0}</b> of {1}", GLib.Markup.EscapeText(name), GLib.Markup.EscapeText(author)); urlLabel.UriString = stripUrl; urlLabel.Text = "View original strip"; image.SetSizeRequest(image.Pixbuf.Width, image.Pixbuf.Height); label.SetSizeRequest(-1, -1); int text_w, text_h; label.Layout.GetPixelSize(out text_w, out text_h); if (image.Pixbuf.Width < text_w) { label.SetSizeRequest(image.Pixbuf.Width, -1); } win.Resize(1, 1); win.ShowAll(); #if USE_GLIB_TIMEOUT_SECONDS GLib.Timeout.AddSeconds(((uint)popupDelay), HideAllCallback); #else GLib.Timeout.Add(((uint)popupDelay) * 1000, HideAllCallback); #endif }
// Constructor /// <summary> /// Create a new <see cref="CoverImage" />. /// </summary> public CoverImage() : base() { image = new Gtk.Image(); image.SetSizeRequest(CoverDatabase.CoverSize, CoverDatabase.CoverSize); Add(image); DragDataReceived += OnDragDataReceived; Global.CoverDB.DoneLoading += OnCoversDoneLoading; }
protected virtual void Build() { Alignment label_align; caption = ""; highlight = ""; vbox = new VBox(false, 4); vbox.BorderWidth = 6; Add(vbox); vbox.Show(); empty_pixbuf = new Pixbuf(Colorspace.Rgb, true, 8, icon_size, icon_size); empty_pixbuf.Fill(uint.MinValue); image = new Gtk.Image(); vbox.PackStart(image, false, false, 0); image.Show(); label = new Label(); label.Ellipsize = Pango.EllipsizeMode.End; label.ModifyFg(StateType.Normal, Style.White); label_align = new Alignment(1.0F, 0.0F, 0, 0); label_align.SetPadding(0, 2, 2, 2); label_align.Add(label); vbox.PackStart(label_align, false, false, 0); label.Show(); label_align.Show(); image.SetSizeRequest(icon_size, icon_size); label.SetSizeRequest(icon_size / 4 * 5, -1); // SetSizeRequest (icon_size * 2, icon_size * 2); DrawFrame = DrawFill = true; FrameColor = FillColor = new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue); Realized += OnRealized; UpdateFocus(); }
Gtk.Label addtabwithicon(string filename,string label,Gtk.Widget contents) { Gtk.Image image=new Gtk.Image(MainClass.GetResource(""+filename)); image.SetSizeRequest(16,16); Gtk.Label lable=new Gtk.Label(label); Gtk.HBox box=new Gtk.HBox(); box.PackStart(image); box.PackStart(lable); box.SetChildPacking(image,false,false,0,PackType.Start); box.ShowAll(); notebook1.InsertPage(contents,box,-1); notebook1.ShowAll(); return lable; }
void makeimwindow(string name,ChatConsole cs,bool group,UUID target) { Gtk.Image image=new Gtk.Image(MainClass.GetResource("closebox.png")); image.HeightRequest=16; image.WidthRequest=16; Gtk.Image icon; if(group) icon=new Gtk.Image(MainClass.GetResource("icon_group.png")); else icon=new Gtk.Image(MainClass.GetResource("icn_voice-groupfocus.png")); image.SetSizeRequest(16,16); Gtk.Label lable=new Gtk.Label(name); Gtk.Button button=new Gtk.Button(image); button.SetSizeRequest(16,16); Gtk.HBox box=new Gtk.HBox(); box.PackStart(icon); box.PackStart(lable); box.PackStart(button); box.SetChildPacking(image,false,false,0,PackType.Start); box.ShowAll(); notebook.InsertPage(cs,box,-1); notebook.ShowAll(); cs.tabLabel=lable; AsyncNameUpdate ud; if(target!=UUID.Zero) { if(group) ud=new AsyncNameUpdate(target,true); else ud=new AsyncNameUpdate(target,false); ud.onNameCallBack += delegate(string namex,object [] values){cs.tabLabel.Text=namex;}; ud.go(); } button.Clicked += new EventHandler(cs.clickclosed); this.notebook.SwitchPage += new SwitchPageHandler(cs.onSwitchPage); }