本文整理汇总了C#中Gtk.Alignment.SetPadding方法的典型用法代码示例。如果您正苦于以下问题:C# Alignment.SetPadding方法的具体用法?C# Alignment.SetPadding怎么用?C# Alignment.SetPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Alignment
的用法示例。
在下文中一共展示了Alignment.SetPadding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoginDialog
public LoginDialog(Window parent, string errorMsg)
: base("Login", parent)
{
XML gxml = new XML(null, "MultiMC.GTKGUI.LoginDialog.glade",
"loginTable", null);
gxml.Autoconnect(this);
labelErrorMsg.Text = errorMsg;
Alignment loginAlign = new Alignment(0.5f, 0.5f, 1, 1);
loginAlign.Add(loginTable);
loginAlign.SetPadding(4, 4, 4, 4);
this.VBox.Add(loginAlign);
loginAlign.ShowAll();
okButton = this.AddButton("_OK", ResponseType.Ok) as Button;
cancelButton = this.AddButton("_Cancel", ResponseType.Cancel) as Button;
this.Default = okButton;
this.WidthRequest = 420;
labelErrorMsg.Visible = !string.IsNullOrEmpty(labelErrorMsg.Text);
entryPassword.Visibility = false;
}
示例2: BuildInterface
private void BuildInterface ()
{
NoShowAll = true;
Alignment matchesAlignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
matchesAlignment.SetPadding (5, 5, 5, 5);
matchesAlignment.Add (terms_box);
matchesFrame = new Frame (null);
matchesFrame.Add (matchesAlignment);
matchesFrame.LabelWidget = BuildMatchHeader ();
matchesFrame.ShowAll ();
terms_entry_box = new HBox ();
terms_entry_box.Spacing = 8;
terms_entry_box.PackStart (new Label (Catalog.GetString ("Condition:")), false, false, 0);
terms_entry = new Entry ();
terms_entry_box.PackStart (terms_entry, true, true, 0);
limit_box.ShowAll ();
PackStart(matchesFrame, true, true, 0);
PackStart(terms_entry_box, false, false, 0);
PackStart(limit_box, false, false, 0);
//ShowAll ();
}
示例3: GetDisplayWidget
public override Gtk.Widget GetDisplayWidget()
{
DrawingArea colorPreview = new DrawingArea ();
colorPreview.ModifyBg(StateType.Normal, GetColor ());
colorPreview.WidthRequest = 15;
Alignment colorPreviewAlign = new Alignment (0, 0, 0, 1);
colorPreviewAlign.SetPadding (2, 2, 2, 2);
colorPreviewAlign.Add (colorPreview);
string labelText;
System.Drawing.Color color = (System.Drawing.Color) parentRow.PropertyValue;
//TODO: dropdown known color selector so this does something
if (color.IsKnownColor)
labelText = color.Name;
else if (color.IsEmpty)
labelText = "[empty]";
else
labelText = String.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B);
//we use StringValue as it auto-bolds the text for non-default values
Label theLabel = (Label) base.StringValue (labelText);
theLabel.Xalign = 0;
theLabel.Xpad = 3;
HBox hbox = new HBox ();
hbox.PackStart (colorPreviewAlign, false, false, 0);
hbox.PackStart (theLabel, true, true, 0);
return hbox;
}
示例4: WelcomePageSection
public WelcomePageSection(string title = null)
{
this.title = title;
VisibleWindow = false;
Add (root);
root.Show ();
uint p = Styles.WelcomeScreen.Pad.ShadowSize * 2;
root.SetPadding (p, p, p, p);
TitleAlignment = new Alignment (0f, 0f, 1f, 1f);
p = Styles.WelcomeScreen.Pad.Padding;
TitleAlignment.SetPadding (p, Styles.WelcomeScreen.Pad.LargeTitleMarginBottom, p, p);
ContentAlignment = new Alignment (0f, 0f, 1f, 1f);
ContentAlignment.SetPadding (0, p, p, p);
}
示例5: WelcomePageWidget
public WelcomePageWidget ()
{
logoPixbuf = WelcomePageBranding.GetLogoImage ();
bgPixbuf = WelcomePageBranding.GetTopBorderImage ();
Gdk.Color color = Gdk.Color.Zero;
if (!Gdk.Color.Parse (WelcomePageBranding.BackgroundColor, ref color))
color = Style.White;
ModifyBg (StateType.Normal, color);
var mainAlignment = new Gtk.Alignment (0f, 0f, 1f, 1f);
mainAlignment.SetPadding ((uint) (WelcomePageBranding.LogoHeight + WelcomePageBranding.Spacing), 0, (uint) WelcomePageBranding.Spacing, 0);
this.Add (mainAlignment);
colBox = new Gtk.HBox (false, WelcomePageBranding.Spacing);
mainAlignment.Add (colBox);
BuildContent ();
ShowAll ();
IdeApp.Workbench.GuiLocked += OnLock;
IdeApp.Workbench.GuiUnlocked += OnUnlock;
}
示例6: ShowCalendar
private void ShowCalendar()
{
popup = new Window(WindowType.Popup);
popup.Screen = tree.Screen;
Frame frame = new Frame();
frame.Shadow = ShadowType.Out;
frame.Show();
popup.Add(frame);
VBox box = new VBox(false, 0);
box.Show();
frame.Add(box);
cal = new Calendar();
cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
| CalendarDisplayOptions.ShowDayNames
| CalendarDisplayOptions.ShowWeekNumbers;
cal.KeyPressEvent += OnCalendarKeyPressed;
popup.ButtonPressEvent += OnButtonPressed;
cal.Show();
Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
calAlignment.Show();
calAlignment.SetPadding(4, 4, 4, 4);
calAlignment.Add(cal);
box.PackStart(calAlignment, false, false, 0);
// FIXME: Make the popup appear directly below the date
Gdk.Rectangle allocation = tree.Allocation;
// Gtk.Requisition req = tree.SizeRequest ();
int x = 0, y = 0;
tree.GdkWindow.GetOrigin(out x, out y);
// popup.Move(x + allocation.X, y + allocation.Y + req.Height + 3);
popup.Move(x + allocation.X, y + allocation.Y);
popup.Show();
popup.GrabFocus();
Grab.Add(popup);
Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
Gdk.EventMask.ButtonPressMask
| Gdk.EventMask.ButtonReleaseMask
| Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);
if (grabbed == Gdk.GrabStatus.Success) {
grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
true, CURRENT_TIME);
if (grabbed != Gdk.GrabStatus.Success) {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
} else {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
cal.DaySelectedDoubleClick += OnCalendarDaySelected;
cal.ButtonPressEvent += OnCalendarButtonPressed;
cal.Date = date == DateTime.MinValue ? DateTime.Now : date;
}
示例7: PreviewVisualizerWindow
public PreviewVisualizerWindow (ObjectValue val, Gtk.Widget invokingWidget) : base (Gtk.WindowType.Toplevel)
{
this.TypeHint = WindowTypeHint.PopupMenu;
this.Decorated = false;
if (((Gtk.Window)invokingWidget.Toplevel).Modal)
this.Modal = true;
TransientFor = (Gtk.Window) invokingWidget.Toplevel;
Theme.SetFlatColor (new Cairo.Color (245 / 256.0, 245 / 256.0, 245 / 256.0));
Theme.Padding = 3;
ShowArrow = true;
var mainBox = new VBox ();
var headerTable = new Table (1, 3, false);
headerTable.ColumnSpacing = 5;
var closeButton = new ImageButton () {
InactiveImage = ImageService.GetIcon ("md-popup-close", IconSize.Menu),
Image = ImageService.GetIcon ("md-popup-close-hover", IconSize.Menu)
};
closeButton.Clicked += delegate {
this.Destroy ();
};
var hb = new HBox ();
var vb = new VBox ();
hb.PackStart (vb, false, false, 0);
vb.PackStart (closeButton, false, false, 0);
headerTable.Attach (hb, 0, 1, 0, 1);
var headerTitle = new Label ();
headerTitle.ModifyFg (StateType.Normal, new Color (36, 36, 36));
var font = headerTitle.Style.FontDescription.Copy ();
font.Weight = Pango.Weight.Bold;
headerTitle.ModifyFont (font);
headerTitle.Text = val.TypeName;
var vbTitle = new VBox ();
vbTitle.PackStart (headerTitle, false, false, 3);
headerTable.Attach (vbTitle, 1, 2, 0, 1);
if (DebuggingService.HasValueVisualizers (val)) {
var openButton = new Button ();
openButton.Label = "Open";
openButton.Relief = ReliefStyle.Half;
openButton.Clicked += delegate {
PreviewWindowManager.DestroyWindow ();
DebuggingService.ShowValueVisualizer (val);
};
var hbox = new HBox ();
hbox.PackEnd (openButton, false, false, 2);
headerTable.Attach (hbox, 2, 3, 0, 1);
} else {
headerTable.Attach (new Label (), 2, 3, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 10, 0);
}
mainBox.PackStart (headerTable);
mainBox.ShowAll ();
var previewVisualizer = DebuggingService.GetPreviewVisualizer (val);
if (previewVisualizer == null)
previewVisualizer = new GenericPreviewVisualizer ();
Control widget = null;
try {
widget = previewVisualizer.GetVisualizerWidget (val);
} catch (Exception e) {
DebuggingService.DebuggerSession.LogWriter (true, "Exception during preview widget creation: " + e.Message);
}
if (widget == null) {
widget = new GenericPreviewVisualizer ().GetVisualizerWidget (val);
}
var alignment = new Alignment (0, 0, 1, 1);
alignment.SetPadding (3, 5, 5, 5);
alignment.Show ();
alignment.Add (widget);
mainBox.PackStart (alignment);
ContentBox.Add (mainBox);
}
示例8: WelcomePageWidget
public WelcomePageWidget ()
{
ShowScrollbars = true;
VisibleWindow = false;
BackgroundColor = "white";
LogoHeight = 90;
var background = new WelcomePageWidgetBackground ();
Background = background;
background.Owner = this;
var mainAlignment = new Gtk.Alignment (0f, 0f, 1f, 1f);
background.Add (mainAlignment);
BuildContent (mainAlignment);
if (ShowScrollbars) {
var scroller = new ScrolledWindow ();
scroller.AddWithViewport (background);
((Gtk.Viewport)scroller.Child).ShadowType = ShadowType.None;
scroller.ShadowType = ShadowType.None;
scroller.FocusChain = new Widget[] { background };
scroller.Show ();
Add (scroller);
} else
this.Add (background);
if (LogoImage != null) {
var logoHeight = LogoHeight;
mainAlignment.SetPadding ((uint)(logoHeight + Styles.WelcomeScreen.Spacing), 0, (uint)Styles.WelcomeScreen.Spacing, 0);
}
ShowAll ();
IdeApp.Workbench.GuiLocked += OnLock;
IdeApp.Workbench.GuiUnlocked += OnUnlock;
}
示例9: MainToolbar
public MainToolbar ()
{
WidgetFlags |= Gtk.WidgetFlags.AppPaintable;
AddWidget (button);
AddSpace (8);
configurationCombo = new Gtk.ComboBox ();
configurationCombo.Model = configurationStore;
var ctx = new Gtk.CellRendererText ();
configurationCombo.PackStart (ctx, true);
configurationCombo.AddAttribute (ctx, "text", 0);
configurationCombosBox = new HBox (false, 8);
var configurationComboVBox = new VBox ();
configurationComboVBox.PackStart (configurationCombo, true, false, 0);
configurationCombosBox.PackStart (configurationComboVBox, false, false, 0);
// bold attributes for running runtime targets / (emulators)
boldAttributes.Insert (new Pango.AttrWeight (Pango.Weight.Bold));
runtimeCombo = new Gtk.ComboBox ();
runtimeCombo.Model = runtimeStore;
ctx = new Gtk.CellRendererText ();
if (Platform.IsWindows)
ctx.Ellipsize = Pango.EllipsizeMode.Middle;
runtimeCombo.PackStart (ctx, true);
runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell);
runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator;
var runtimeComboVBox = new VBox ();
runtimeComboVBox.PackStart (runtimeCombo, true, false, 0);
configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0);
AddWidget (configurationCombosBox);
buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0);
buttonBarBox.LeftPadding = (uint) 7;
buttonBarBox.Add (buttonBar);
buttonBarBox.NoShowAll = true;
AddWidget (buttonBarBox);
AddSpace (24);
statusArea = new StatusArea ();
statusArea.ShowMessage (BrandingService.ApplicationName);
var statusAreaAlign = new Alignment (0, 0, 1, 1);
statusAreaAlign.Add (statusArea);
contentBox.PackStart (statusAreaAlign, true, true, 0);
AddSpace (24);
statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => {
Gtk.Widget toplevel = this.Toplevel;
if (toplevel == null)
return;
int windowWidth = toplevel.Allocation.Width;
int center = windowWidth / 2;
int left = Math.Max (center - 300, args.Allocation.Left);
int right = Math.Min (left + 600, args.Allocation.Right);
uint left_padding = (uint) (left - args.Allocation.Left);
uint right_padding = (uint) (args.Allocation.Right - right);
if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding)
statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding);
};
matchEntry = new SearchEntry ();
matchEntry.ForceFilterButtonVisible = true;
matchEntry.Entry.FocusOutEvent += (o, e) => {
if (SearchEntryLostFocus != null)
SearchEntryLostFocus (o, e);
};
matchEntry.Ready = true;
matchEntry.Visible = true;
matchEntry.IsCheckMenu = true;
matchEntry.WidthRequest = 240;
if (!Platform.IsMac && !Platform.IsWindows)
matchEntry.Entry.ModifyFont (Pango.FontDescription.FromString ("Sans 9")); // TODO: VV: "Segoe UI 9"
matchEntry.RoundedShape = true;
matchEntry.Entry.Changed += HandleSearchEntryChanged;
matchEntry.Activated += HandleSearchEntryActivated;
matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed;
SizeAllocated += (o, e) => {
if (SearchEntryResized != null)
SearchEntryResized (o, e);
};
contentBox.PackStart (matchEntry, false, false, 0);
var align = new Gtk.Alignment (0, 0, 1f, 1f);
align.Show ();
align.TopPadding = (uint) 5;
align.LeftPadding = (uint) 9;
align.RightPadding = (uint) 18;
align.BottomPadding = (uint) 10;
align.Add (contentBox);
//.........这里部分代码省略.........
示例10: UpdateTab
public void UpdateTab ()
{
if (Child != null) {
Widget w = Child;
Remove (w);
w.Destroy ();
}
mainBox = new Alignment (0,0,1,1);
if (bar.Orientation == Gtk.Orientation.Horizontal) {
box = new HBox ();
if (bar.AlignToEnd)
mainBox.SetPadding (3, 3, 11, 9);
else
mainBox.SetPadding (3, 3, 9, 11);
}
else {
box = new VBox ();
if (bar.AlignToEnd)
mainBox.SetPadding (11, 9, 3, 3);
else
mainBox.SetPadding (9, 11, 3, 3);
}
Gtk.Widget customLabel = null;
if (it.DockLabelProvider != null)
customLabel = it.DockLabelProvider.CreateLabel (bar.Orientation);
if (customLabel != null) {
customLabel.ShowAll ();
box.PackStart (customLabel, true, true, 0);
}
else {
if (it.Icon != null) {
var desat = it.Icon.WithAlpha (0.5);
crossfade = new CrossfadeIcon (desat, it.Icon);
box.PackStart (crossfade, false, false, 0);
desat.Dispose ();
}
if (!string.IsNullOrEmpty (it.Label)) {
label = new Gtk.Label (it.Label);
label.UseMarkup = true;
if (bar.Orientation == Gtk.Orientation.Vertical)
label.Angle = 270;
box.PackStart (label, true, true, 0);
} else
label = null;
}
box.Spacing = 2;
mainBox.Add (box);
mainBox.ShowAll ();
Add (mainBox);
QueueDraw ();
}
示例11: BuildWidget
private void BuildWidget ()
{
alignment = new Alignment (0.5f, 0.5f, 1f, 0f);
alignment.SetPadding (1, 1, 3, 3);
VisibleWindow = false;
box = new HBox ();
entry = new FramelessEntry (this);
filter_button = new HoverImageButton (IconSize.Menu, "md-searchbox-search");
clear_button = new HoverImageButton (IconSize.Menu, "md-searchbox-clear");
entryAlignment = new Gtk.Alignment (0.5f, 0.5f, 1f, 1f);
alignment.SetPadding (0, 0, 3, 3);
entryAlignment.Add (entry);
box.PackStart (filter_button, false, false, 0);
box.PackStart (entryAlignment, true, true, 0);
box.PackStart (clear_button, false, false, 0);
alignment.Add (box);
Add (alignment);
alignment.ShowAll ();
entry.StyleSet += OnInnerEntryStyleSet;
entry.StateChanged += OnInnerEntryStateChanged;
entry.FocusInEvent += OnInnerEntryFocusEvent;
entry.FocusOutEvent += OnInnerEntryFocusEvent;
entry.Changed += OnInnerEntryChanged;
entry.Activated += delegate {
NotifyActivated ();
};
filter_button.Image.Xpad = 0;
clear_button.Image.Xpad = 0;
filter_button.CanFocus = false;
clear_button.CanFocus = false;
filter_button.ButtonReleaseEvent += OnButtonReleaseEvent;
clear_button.ButtonReleaseEvent += OnButtonReleaseEvent;
clear_button.Clicked += OnClearButtonClicked;
ShowHideButtons ();
}
示例12: PaletteGroup
public PaletteGroup (string name) : base ("<b>" + name + "</b>")
{
vbox = new VBox (false, 0);
emptyLabel = new Gtk.Label ();
emptyLabel.Markup = "<small><i><span foreground='darkgrey'> " + Catalog.GetString ("Empty") + "</span></i></small>";
vbox.PackStart (emptyLabel, false, false, 0);
align = new Gtk.Alignment (0, 0, 0, 0);
align.SetPadding (0, 0, 20, 0);
align.Child = vbox;
UseMarkup = true;
Expanded = true;
Child = align;
}
示例13: MonoGameContentEditorViewContent
public MonoGameContentEditorViewContent (MonoDevelop.Core.FilePath filename, MonoDevelop.Projects.Project project)
{
this.ContentName = Path.GetFileName (filename.ToString());
this.Project = project;
control = new Alignment (0, 0, 1, 1);
control.SetPadding (5, 5, 5, 5);
view = new Pipeline.MacOS.MainView (null);
if (filename != null) {
view.OpenProjectPath = filename.ToString();
}
Pipeline.MacOS.MainView.CreateControllers (view);
view.BuildUI ();
control.Add (view);
control.ShowAll ();
}
示例14: ShowCalendar
public void ShowCalendar()
{
popup = new Window(WindowType.Popup);
popup.Screen = parent.Screen;
Frame frame = new Frame();
frame.Shadow = ShadowType.Out;
frame.Show();
popup.Add(frame);
VBox box = new VBox(false, 0);
box.Show();
frame.Add(box);
cal = new Calendar();
cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
| CalendarDisplayOptions.ShowDayNames
| CalendarDisplayOptions.ShowWeekNumbers;
cal.KeyPressEvent += OnCalendarKeyPressed;
popup.ButtonPressEvent += OnButtonPressed;
cal.Show();
Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
calAlignment.Show();
calAlignment.SetPadding(4, 4, 4, 4);
calAlignment.Add(cal);
box.PackStart(calAlignment, false, false, 0);
//Requisition req = SizeRequest();
parent.GdkWindow.GetOrigin(out xPos, out yPos);
// popup.Move(x + Allocation.X, y + Allocation.Y + req.Height + 3);
popup.Move(xPos, yPos);
popup.Show();
popup.GrabFocus();
Grab.Add(popup);
Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
Gdk.EventMask.ButtonPressMask
| Gdk.EventMask.ButtonReleaseMask
| Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);
if (grabbed == Gdk.GrabStatus.Success) {
grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
true, CURRENT_TIME);
if (grabbed != Gdk.GrabStatus.Success) {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
} else {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
cal.DaySelected += OnCalendarDaySelected;
cal.MonthChanged += OnCalendarMonthChanged;
cal.Date = date;
}
示例15: RtmPreferencesWidget
public RtmPreferencesWidget(RtmBackend backend, IPreferences preferences)
: base()
{
if (backend == null)
throw new ArgumentNullException ("backend");
if (preferences == null)
throw new ArgumentNullException ("preferences");
this.backend = backend;
this.preferences = preferences;
LoadPreferences ();
BorderWidth = 0;
// We're using an event box so we can paint the background white
EventBox imageEb = new EventBox ();
imageEb.BorderWidth = 0;
imageEb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
imageEb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255));
imageEb.Show ();
VBox mainVBox = new VBox(false, 0);
mainVBox.BorderWidth = 10;
mainVBox.Show();
Add(mainVBox);
// Add the rtm logo
image = new Gtk.Image (normalPixbuf);
image.Show();
//make the dialog box look pretty without hard coding total size and
//therefore clipping displays with large fonts.
Alignment spacer = new Alignment((float)0.5, 0, 0, 0);
spacer.SetPadding(0, 0, 125, 125);
spacer.Add(image);
spacer.Show();
imageEb.Add (spacer);
mainVBox.PackStart(imageEb, true, true, 0);
// Status message label
statusLabel = new Label();
statusLabel.Justify = Gtk.Justification.Center;
statusLabel.Wrap = true;
statusLabel.LineWrap = true;
statusLabel.Show();
statusLabel.UseMarkup = true;
statusLabel.UseUnderline = false;
authButton = new LinkButton (
#if GETTEXT
Catalog.GetString ("Click Here to Connect"));
#elif ANDROID
#endif
authButton.Clicked += OnAuthButtonClicked;
if ( isAuthorized ) {
statusLabel.Text = "\n\n" +
#if GETTEXT
Catalog.GetString ("You are currently connected");
#elif ANDROID
#endif
string userName = preferences.Get (PreferencesKeys.UserNameKey);
if (userName != null && userName.Trim () != string.Empty)
statusLabel.Text = "\n\n" +
#if GETTEXT
Catalog.GetString ("You are currently connected as") +
#elif ANDROID
#endif
"\n" + userName.Trim();
} else {
statusLabel.Text = "\n\n" +
#if GETTEXT
Catalog.GetString ("You are not connected");
#elif ANDROID
#endif
authButton.Show();
}
mainVBox.PackStart(statusLabel, false, false, 0);
mainVBox.PackStart(authButton, false, false, 0);
Label blankLabel = new Label("\n");
blankLabel.Show();
mainVBox.PackStart(blankLabel, false, false, 0);
}