本文整理汇总了C#中Gtk.Alignment类的典型用法代码示例。如果您正苦于以下问题:C# Alignment类的具体用法?C# Alignment怎么用?C# Alignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Alignment类属于Gtk命名空间,在下文中一共展示了Alignment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LyricsHelp
public LyricsHelp()
: base(false, 0)
{
Label title = new Label ();
Label details1 = new Label ();
Label details2 = new Label ();
title.Markup = "<b><big><big>Lyrics</big></big></b>";
details1.Markup = "This panel displays the lyrics of the currently playing song";
details2.Markup = "You can also search for an artist below which will give you a list of albums and tracks to choose from";
details1.Wrap = true;
details2.Wrap = true;
VBox box = new VBox (false, 40);
box.PackStart (details1, false, false, 0);
box.PackStart (details2, false, false, 0);
Alignment align = new Alignment (0.5f, 0.5f, 0, 0);
align.Add (box);
this.PackStart (title, false, false, 0);
this.PackStart (new HSeparator (), false, false, 5);
this.PackStart (align, true, true, 0);
this.PackStart (new Image (null, "lyricwiki-logo.png"), false, false, 0);
}
示例2: 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;
}
示例3: ThemeTestModule
public ThemeTestModule()
: base("Theme")
{
var align = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
var theme_widget = new ThemeTestWidget ();
align.Add (theme_widget);
Add (align);
ShowAll ();
int state = 0;
uint[,] borders = {
{0, 0, 0, 0},
{10, 0, 0, 0},
{0, 10, 0, 0},
{0, 0, 10, 0},
{0, 0, 0, 10},
{10, 10, 0, 0},
{10, 10, 10, 0},
{10, 10, 10, 10},
{10, 0, 0, 10},
{0, 10, 10, 0}
};
GLib.Timeout.Add (2000, delegate {
Console.WriteLine (state);
align.TopPadding = borders[state, 0];
align.RightPadding = borders[state, 1];
align.BottomPadding = borders[state, 2];
align.LeftPadding = borders[state, 3];
if (++state % borders.GetLength (0) == 0) {
state = 0;
}
return true;
});
}
示例4: EnableStartupNotesPreference
public EnableStartupNotesPreference ()
{
IPropertyEditorBool enableStartupNotes_peditor;
Gtk.CheckButton enableStartupNotesCheckbox;
Gtk.Label enableStartupNotesLabel;
// Enable Startup Notes option
enableStartupNotesLabel = new Gtk.Label (Catalog.GetString ("Enable startup notes"));
enableStartupNotesLabel.UseMarkup = true;
enableStartupNotesLabel.Justify = Gtk.Justification.Left;
enableStartupNotesLabel.SetAlignment (0.0f, 0.5f);
enableStartupNotesLabel.Show ();
enableStartupNotesCheckbox = new Gtk.CheckButton ();
enableStartupNotesCheckbox.Add (enableStartupNotesLabel);
enableStartupNotesCheckbox.Show ();
enableStartupNotes_peditor =
Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_STARTUP_NOTES, enableStartupNotesCheckbox);
Preferences.Get (enableStartupNotes_peditor.Key);
enableStartupNotes_peditor.Setup ();
align = new Gtk.Alignment (0.0f, 0.0f, 0.0f, 1.0f);
align.Show ();
align.Add (enableStartupNotesCheckbox);
}
示例5: 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;
}
示例6: AddMessage
public void AddMessage (string msg, IconId icon)
{
if (lastImage != null) {
HSeparator sep = new HSeparator ();
sep.Show ();
msgBox.PackStart (sep, false, false, 0);
lastImage.IconSize = Gtk.IconSize.Menu;
}
HBox box = new HBox ();
box.Spacing = 12;
Alignment imgBox = new Alignment (0, 0, 0, 0);
var img = new ImageView (icon, lastImage != null ? Gtk.IconSize.Menu : IconSize.Dialog);
imgBox.Add (img);
lastImage = img;
box.PackStart (imgBox, false, false, 0);
Label lab = new Label (msg);
lab.UseUnderline = false;
lab.Xalign = 0;
lab.Yalign = 0;
lab.Wrap = true;
lab.WidthRequest = 500;
box.PackStart (lab, true, true, 0);
msgBox.PackStart (box, false, false, 0);
box.ShowAll ();
}
示例7: Build
protected virtual void Build()
{
Gui.Initialize (this);
// Widget BolPatcher.MenuGameWidget
BinContainer.Attach (this);
Name = "BolPatcher.MenuGameWidget";
// Container child BolPatcher.MenuGameWidget.Gtk.Container+ContainerChild
_frame1 = new Frame ();
_frame1.Name = "frame1";
_frame1.ShadowType = 0;
// Container child frame1.Gtk.Container+ContainerChild
_gtkAlignment = new Alignment (0F, 0F, 1F, 1F);
_gtkAlignment.Name = "GtkAlignment";
_gtkAlignment.LeftPadding = 12;
// Container child GtkAlignment.Gtk.Container+ContainerChild
_button2 = new Button ();
_button2.CanFocus = true;
_button2.Name = "button2";
_button2.UseUnderline = true;
_button2.Label = Catalog.GetString ("GtkButton");
_gtkAlignment.Add (_button2);
_frame1.Add (_gtkAlignment);
_gtkLabel1 = new Label ();
_gtkLabel1.Name = "GtkLabel1";
_gtkLabel1.LabelProp = Catalog.GetString ("<b>GtkFrame</b>");
_gtkLabel1.UseMarkup = true;
_frame1.LabelWidget = _gtkLabel1;
Add (_frame1);
if ((Child != null)) {
Child.ShowAll ();
}
Hide ();
}
示例8: NotificationMessage
public NotificationMessage (string t, string m) : base (false, 5)
{
this.Style = style;
BorderWidth = 5;
icon = new Image (Stock.DialogInfo, IconSize.Dialog);
this.PackStart (icon, false, true, 5);
VBox vbox = new VBox (false, 5);
this.PackStart (vbox, true, true, 0);
title = new Label ();
title.SetAlignment (0.0f, 0.5f);
this.Title = t;
vbox.PackStart (title, false, true, 0);
message = new Label ();
message.LineWrap = true;
message.SetSizeRequest (500, -1); // ugh, no way to sanely reflow a gtk label
message.SetAlignment (0.0f, 0.0f);
this.Message = m;
vbox.PackStart (message, true, true, 0);
action_box = new HBox (false, 3);
Button hide_button = new Button (Catalog.GetString ("Hide"));
hide_button.Clicked += OnHideClicked;
action_box.PackEnd (hide_button, false, true, 0);
Alignment action_align = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
action_align.Add (action_box);
vbox.PackStart (action_align, false, true, 0);
}
示例9: 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 ();
}
示例10: DemoColorSelection
public DemoColorSelection () : base ("Color Selection")
{
BorderWidth = 8;
VBox vbox = new VBox (false,8);
vbox.BorderWidth = 8;
Add (vbox);
// Create the color swatch area
Frame frame = new Frame ();
frame.ShadowType = ShadowType.In;
vbox.PackStart (frame, true, true, 0);
drawingArea = new DrawingArea ();
drawingArea.ExposeEvent += new ExposeEventHandler (ExposeEventCallback);
// set a minimum size
drawingArea.SetSizeRequest (200,200);
// set the color
color = new Gdk.Color (0, 0, 0xff);
drawingArea.ModifyBg (StateType.Normal, color);
frame.Add (drawingArea);
Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
Button button = new Button ("_Change the above color");
button.Clicked += new EventHandler (ChangeColorCallback);
alignment.Add (button);
vbox.PackStart (alignment);
ShowAll ();
}
示例11: AddMessage
public void AddMessage (string msg, string icon)
{
if (lastImage != null) {
HSeparator sep = new HSeparator ();
sep.Show ();
msgBox.PackStart (sep);
lastImage.IconSize = (int) Gtk.IconSize.Button;
}
HBox box = new HBox ();
box.Spacing = 12;
Alignment imgBox = new Alignment (0, 0, 0, 0);
Image img = new Image (icon, lastImage != null ? Gtk.IconSize.Button : IconSize.Dialog);
imgBox.Add (img);
lastImage = img;
box.PackStart (imgBox, false, false, 0);
Label lab = new Label (msg);
lab.Xalign = 0;
lab.Yalign = 0;
lab.Wrap = true;
lab.WidthRequest = 500;
box.PackStart (lab, true, true, 0);
msgBox.PackStart (box, false, false, 0);
box.ShowAll ();
}
示例12: Construct
protected void Construct (Widget buttonWidget, Menu menu, bool showArrow)
{
WidgetFlags |= WidgetFlags.NoWindow;
button_widget = buttonWidget;
Menu = menu;
toggle_button.Parent = this;
toggle_button.FocusOnClick = false;
toggle_button.Relief = ReliefStyle.None;
toggle_button.Pressed += delegate { ShowMenu (); toggle_button.Active = true; };
toggle_button.Activated += delegate { ShowMenu (); };
box.Parent = this;
if (showArrow) {
box.PackStart (button_widget, true, true, 0);
alignment = new Alignment (0f, 0.5f, 0f, 0f);
arrow = new Arrow (ArrowType.Down, ShadowType.None);
alignment.Add (arrow);
box.PackStart (alignment, false, false, 5);
size_widget = box;
FocusChain = new Widget[] {toggle_button, box};
alignment.ShowAll ();
alignment.NoShowAll = true;
} else {
toggle_button.Add (button_widget);
size_widget = toggle_button;
}
ShowAll ();
}
示例13: MainWindow
public MainWindow()
: base(WindowType.Toplevel)
{
Name = "MainWindow";
WindowPosition = ((WindowPosition)(4));
DefaultWidth = 1280;
DefaultHeight = 800;
_north = new Alignment(0, 0, 1, 1);
_south = new Alignment(0, 0, 1, 1);
_west = new Alignment(0, 0, 1, 1);
_east = new Alignment(0, 0, 1, 1);
_center = new Alignment(0, 0, 1, 1);
_vBox = new VBox(false, 0);
_westAndRestHPaned = new HPaned();
_westAndRestHPaned.Pack1(_west, false, false);
_centerAndEastHPaned = new HPaned();
_westAndRestHPaned.Pack2(_centerAndEastHPaned, true, true);
_centerAndEastHPaned.Pack1(_center, true, true);
_centerAndEastHPaned.Pack2(_east, true, true);
_centerAndEastHPaned.Position = 1000;
_vBox.PackStart(_north, false, false, 0);
_vBox.PackStart(_westAndRestHPaned, true, true, 0);
_vBox.PackStart(_south, false, false, 0);
Add(_vBox);
ShowAll();
}
示例14: BuildContent
protected override void BuildContent (Container parent)
{
LogoImage = Xwt.Drawing.Image.FromResource ("WelcomePage_Logo.png");
TopBorderImage = Xwt.Drawing.Image.FromResource ("WelcomePage_TopBorderRepeat.png");
var mainAlignment = new Gtk.Alignment (0.5f, 0.5f, 0f, 1f);
var mainCol = new WelcomePageColumn ();
mainAlignment.Add (mainCol);
var row1 = new WelcomePageRow ();
row1.PackStart (new WelcomePageButtonBar (
new WelcomePageBarButton ("Haxe.org", "http://www.haxe.org", "link-cloud.png"),
new WelcomePageBarButton (GettextCatalog.GetString ("Documentation"), "http://www.http://haxe.org/doc", "link-info.png"),
new WelcomePageBarButton (GettextCatalog.GetString ("Support"), "https://groups.google.com/forum/#!forum/haxelang", "link-heart.png"),
new WelcomePageBarButton (GettextCatalog.GetString ("Q&A"), "https://groups.google.com/forum/#!forum/haxelang", "link-chat.png")
)
);
mainCol.PackStart (row1, false, false, 0);
var row2 = new WelcomePageRow (
new WelcomePageColumn (
new WelcomePageRecentProjectsList (GettextCatalog.GetString ("Solutions"))
),
new WelcomePageColumn (
new WelcomePageNewsFeed (GettextCatalog.GetString ("Haxe News"), "http://software.xamarin.com/Service/News", "NewsLinks")
),
new WelcomePageColumn (
new WelcomePageTipOfTheDaySection ()
)
);
mainCol.PackStart (row2, false, false, 0);
parent.Add (mainAlignment);
}
示例15: PopoverWindow
public PopoverWindow (Gtk.WindowType type) : base(type)
{
SkipTaskbarHint = true;
SkipPagerHint = true;
AppPaintable = true;
TypeHint = WindowTypeHint.Tooltip;
CheckScreenColormap ();
alignment = new Alignment (0, 0, 1f, 1f);
alignment.Show ();
Add (alignment);
disableSizeCheck = false;
SizeRequested += (object o, SizeRequestedArgs args) => {
if (this.AnimationIsRunning("Resize") && !disableSizeCheck) {
Gtk.Requisition result = new Gtk.Requisition ();
result.Width = Math.Max (args.Requisition.Width, Math.Max (Allocation.Width, targetSize.Width));
result.Height = Math.Max (args.Requisition.Height, Math.Max (Allocation.Height, targetSize.Height));
args.Requisition = result;
}
};
UpdatePadding ();
}