void BuildEntryGroup () { entryGroup = new GroupCanvasElement (); searchEntry = new EntryCanvasElement (); searchEntry.SetPreEditLabel ("Type to search..."); entryGroup.Add (searchEntry); replaceEntry = new EntryCanvasElement (); replaceEntry.SetPreEditLabel ("Replace with..."); entryGroup.Add (replaceEntry); nextButton = new ButtonCanvasElement (new ImageCanvasElement (Gdk.Pixbuf.LoadFromResource ("go-next-ltr.png"))); prevButton = new ButtonCanvasElement (new ImageCanvasElement (Gdk.Pixbuf.LoadFromResource ("go-previous-ltr.png"))); PrepButton (nextButton); PrepButton (prevButton); entryGroup.Add (nextButton); entryGroup.Add (prevButton); replaceButton = new ButtonCanvasElement (new LabelCanvasElement ("Replace")); replaceAllButton = new ButtonCanvasElement (new LabelCanvasElement ("Replace All")); PrepButton (replaceButton); PrepButton (replaceAllButton); entryGroup.Add (replaceButton); entryGroup.Add (replaceAllButton); Add (entryGroup); }
void Build () { box = new HBoxCanvasElement (); image = new ImageCanvasElement (Gdk.Pixbuf.LoadFromResource ("searchbox-search-16.png")); image.WidthRequest = 24; image.XAlign = 0; image.NoChainOpacity = true; box.Add (image); searchLabel = new LabelCanvasElement ("Search"); searchLabel.XAlign = 0; searchLabel.YAlign = 0.5; box.Add (searchLabel); var upDownArrows = new CanvasElement (); upDownArrows.WidthRequest = 12; upDownArrows.HeightRequest = 24; upDownArrows.RenderEvent += (sender, e) => { var context = e.Context; double centerX = upDownArrows.Width - 3; double centerY = upDownArrows.Height / 2; context.MoveTo (centerX, centerY - 6); context.LineTo (centerX - 3, centerY - 2); context.LineTo (centerX + 3, centerY - 2); context.ClosePath (); context.MoveTo (centerX, centerY + 6); context.LineTo (centerX - 3, centerY + 2); context.LineTo (centerX + 3, centerY + 2); context.ClosePath (); context.Color = new Cairo.Color (0, 0, 0, 0.35 * upDownArrows.Opacity); context.Fill (); }; image.SizeChanged += (object sender, EventArgs e) => { image.AnchorX = 8; image.AnchorY = image.Height / 2; }; box.Add (upDownArrows); SetChild (box); }