本文整理汇总了C#中EventBox.ModifyBase方法的典型用法代码示例。如果您正苦于以下问题:C# EventBox.ModifyBase方法的具体用法?C# EventBox.ModifyBase怎么用?C# EventBox.ModifyBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventBox
的用法示例。
在下文中一共展示了EventBox.ModifyBase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
private void Init()
{
Logger.Debug("Called Init");
this.Icon = Utilities.GetIcon ("giver-48", 48);
// Update the window title
this.Title = string.Format ("Giver Preferences");
//this.DefaultSize = new Gdk.Size (300, 500);
this.VBox.Spacing = 0;
this.VBox.BorderWidth = 0;
this.SetDefaultSize (450, 100);
this.AddButton(Stock.Close, Gtk.ResponseType.Ok);
this.DefaultResponse = ResponseType.Ok;
// Start with an event box to paint the background white
EventBox eb = new EventBox();
eb.Show();
eb.BorderWidth = 0;
eb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
eb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255));
VBox mainVBox = new VBox();
mainVBox.BorderWidth = 10;
mainVBox.Spacing = 5;
mainVBox.Show ();
eb.Add(mainVBox);
this.VBox.PackStart(eb);
Label label = new Label();
label.Show();
label.Justify = Gtk.Justification.Left;
label.SetAlignment (0.0f, 0.5f);
label.LineWrap = false;
label.UseMarkup = true;
label.UseUnderline = false;
label.Markup = "<span weight=\"bold\" size=\"large\">Your Name</span>";
mainVBox.PackStart(label, true, true, 0);
// Name Box at the top of the Widget
HBox nameBox = new HBox();
nameBox.Show();
nameEntry = new Entry();
nameEntry.Show();
nameBox.PackStart(nameEntry, true, true, 0);
nameBox.Spacing = 10;
mainVBox.PackStart(nameBox, false, false, 0);
label = new Label();
label.Show();
label.Justify = Gtk.Justification.Left;
label.SetAlignment (0.0f, 0.5f);
label.LineWrap = false;
label.UseMarkup = true;
label.UseUnderline = false;
label.Markup = "<span weight=\"bold\" size=\"large\">Your Picture</span>";
mainVBox.PackStart(label, true, true, 0);
Gtk.Table table = new Table(4, 3, false);
table.Show();
// None Entry
noneButton = new RadioButton((Gtk.RadioButton)null);
noneButton.Show();
table.Attach(noneButton, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
VBox vbox = new VBox();
vbox.Show();
Gtk.Image image = new Image(Utilities.GetIcon("computer", 48));
image.Show();
vbox.PackStart(image, false, false, 0);
label = new Label("None");
label.Show();
vbox.PackStart(label, false, false, 0);
table.Attach(vbox, 1, 2, 0 ,1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
vbox = new VBox();
vbox.Show();
table.Attach(vbox, 2,3,1,2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);
// Local Entry
localButton = new RadioButton(noneButton);
localButton.Show();
table.Attach(localButton, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
vbox = new VBox();
vbox.Show();
localImage = new Image(Utilities.GetIcon("stock_person", 48));
localImage.Show();
vbox.PackStart(localImage, false, false, 0);
label = new Label("File");
label.Show();
vbox.PackStart(label, false, false, 0);
table.Attach(vbox, 1, 2, 1 ,2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
photoButton = new Button("Change Photo");
photoButton.Show();
table.Attach(photoButton, 2,3,1,2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
// Web Entry
webButton = new RadioButton(noneButton);
webButton.Show();
table.Attach(webButton, 0, 1, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
//.........这里部分代码省略.........
示例2: 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);
}
示例3: InitWindow
//.........这里部分代码省略.........
// Space the addTaskButton and the categoryComboBox
// far apart by using a blank label that expands
Label spacer = new Label (string.Empty);
spacer.Show ();
topHBox.PackStart (spacer, true, true, 0);
// The new task entry widget
addTaskEntry = new Entry (Catalog.GetString ("New task..."));
addTaskEntry.Sensitive = false;
addTaskEntry.Focused += OnAddTaskEntryFocused;
addTaskEntry.Changed += OnAddTaskEntryChanged;
addTaskEntry.Activated += OnAddTaskEntryActivated;
addTaskEntry.FocusInEvent += OnAddTaskEntryFocused;
addTaskEntry.FocusOutEvent += OnAddTaskEntryUnfocused;
addTaskEntry.DragDataReceived += OnAddTaskEntryDragDataReceived;
addTaskEntry.Show ();
topHBox.PackStart (addTaskEntry, true, true, 0);
// Use a small add icon so the button isn't mammoth-sized
HBox buttonHBox = new HBox (false, 6);
Gtk.Image addImage = new Gtk.Image (Gtk.Stock.Add, IconSize.Menu);
addImage.Show ();
buttonHBox.PackStart (addImage, false, false, 0);
Label l = new Label (Catalog.GetString ("_Add"));
l.Show ();
buttonHBox.PackStart (l, true, true, 0);
buttonHBox.Show ();
addTaskButton =
new MenuToolButton (buttonHBox, Catalog.GetString ("_Add Task"));
addTaskButton.UseUnderline = true;
// Disactivate the button until the backend is initialized
addTaskButton.Sensitive = false;
Gtk.Menu addTaskMenu = new Gtk.Menu ();
addTaskButton.Menu = addTaskMenu;
addTaskButton.Clicked += OnAddTask;
addTaskButton.Show ();
topHBox.PackStart (addTaskButton, false, false, 0);
globalKeys.AddAccelerator (OnGrabEntryFocus,
(uint) Gdk.Key.n,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
globalKeys.AddAccelerator (delegate (object sender, EventArgs e) {
GtkApplication.Instance.Quit (); },
(uint) Gdk.Key.q,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
this.KeyPressEvent += KeyPressed;
topHBox.Show ();
mainVBox.PackStart (topHBox, false, false, 0);
scrolledWindow = new ScrolledWindow ();
scrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
scrolledWindow.HscrollbarPolicy = PolicyType.Never;
scrolledWindow.BorderWidth = 0;
scrolledWindow.CanFocus = true;
scrolledWindow.Show ();
mainVBox.PackStart (scrolledWindow, true, true, 0);
innerEb = new EventBox();
innerEb.BorderWidth = 0;
Gdk.Color backgroundColor = GetBackgroundColor ();
innerEb.ModifyBg (StateType.Normal, backgroundColor);
innerEb.ModifyBase (StateType.Normal, backgroundColor);
targetVBox = new VBox();
targetVBox.BorderWidth = 5;
targetVBox.Show ();
innerEb.Add(targetVBox);
scrolledWindow.AddWithViewport(innerEb);
statusbar = new Gtk.Statusbar ();
statusbar.HasResizeGrip = true;
statusbar.Show ();
mainVBox.PackEnd (statusbar, false, false, 0);
//
// Delay adding in the TaskGroups until the backend is initialized
//
Shown += OnWindowShown;
DeleteEvent += WindowDeleted;
backend.BackendInitialized += OnBackendInitialized;
backend.BackendSyncStarted += OnBackendSyncStarted;
backend.BackendSyncFinished += OnBackendSyncFinished;
// if the backend is already initialized, go ahead... initialize
if(backend.Initialized) {
OnBackendInitialized(null, null);
}
GtkApplication.Instance.Preferences.SettingChanged += OnSettingChanged;
}
示例4: InitWindow
///<summary>
/// InitWindow
/// Sets up the widgets and events in the chat window
///</summary>
void InitWindow()
{
this.Icon = Utilities.GetIcon ("giver-48", 48);
// Update the window title
Title = string.Format ("Giver Recipients");
this.DefaultSize = new Gdk.Size (300, 500);
// Start with an event box to paint the background white
EventBox eb = new EventBox();
eb.BorderWidth = 0;
eb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
eb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255));
VBox mainVBox = new VBox();
mainVBox.BorderWidth = 0;
mainVBox.Show ();
eb.Add(mainVBox);
this.Add (eb);
scrolledWindow = new ScrolledWindow ();
scrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
scrolledWindow.HscrollbarPolicy = PolicyType.Never;
//scrolledWindow.ShadowType = ShadowType.None;
scrolledWindow.BorderWidth = 0;
scrolledWindow.CanFocus = true;
scrolledWindow.Show ();
mainVBox.PackStart (scrolledWindow, true, true, 0);
// Add a second Event box in the scrolled window so it will also be white
EventBox innerEb = new EventBox();
innerEb.BorderWidth = 0;
innerEb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
innerEb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255));
targetVBox = new VBox();
targetVBox.BorderWidth = 0;
targetVBox.Show ();
innerEb.Add(targetVBox);
scrolledWindow.AddWithViewport(innerEb);
//mainVBox.PackStart (targetVBox, false, false, 0);
manualTarget = new TargetService();
manualTarget.Show ();
mainVBox.PackStart(manualTarget, false, false, 0);
Shown += OnWindowShown;
DeleteEvent += WindowDeleted;
Application.Instance.TransferStarted += TransferStartedHandler;
}
示例5: ForumView
//.........这里部分代码省略.........
textviewbtn.Active = true;
textviewbtn.Toggled += textviewbtn_Toggled;
SeparatorToolItem sepSpacer = new SeparatorToolItem ();
sepSpacer.Expand = true;
sepSpacer.Draw = false;
sepFullsize = new SeparatorToolItem ();
imageSortAscending = new ToggleToolButton (Stock.SortAscending);
imageSortAscending.TooltipText = "Show earliest images first";
imageSortAscending.Active = true;
imageSortAscending.Toggled += imageSortAscending_Toggled;
imageSortDescending = new ToggleToolButton (Stock.SortDescending);
imageSortDescending.TooltipText = "Show latest images first";
imageSortDescending.Toggled += imageSortDescending_Toggled;
imageLoadingProgress = new ProgressBar ();
ToolItem progressItem = new ToolItem ();
progressItem.Expand = false;
progressItem.Add (imageLoadingProgress);
imageLoadingProgress.Fraction = 0;
toolbar.Add (imageSortAscending);
toolbar.Add (imageSortDescending);
toolbar.Add (progressItem);
toolbar.Add (firstbtn);
toolbar.Add (prevbtn);
toolbar.Add (textItem);
toolbar.Add (nextbtn);
toolbar.Add (lastbtn);
toolbar.Add (sepFullsize);
toolbar.Add (savebtn);
toolbar.Add (rotatebtn);
toolbar.Add (sepSpacer);
toolbar.Add (imageviewbtn);
toolbar.Add (textviewbtn);
toolbar.Add (closebtn);
toolbar.Add (upbtn);
toolbar.Add (downbtn);
threadwindow = new ScrolledWindow ();
threadbrowser = new WebView ();
threadbrowser.Editable = false;
threadbrowser.NavigationRequested += threadbrowser_NavigationRequested;
threadwindow.Add (threadbrowser);
iconStore = new ListStore (typeof(string), typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(int), typeof(int));
iconview = new IconView (iconStore);
iconview.Margin = 1;
iconview.Spacing = 1;
iconview.BorderWidth = 0;
iconview.ColumnSpacing = 1;
iconview.RowSpacing = 1;
iconview.PixbufColumn = 1;
iconview.TooltipColumn = 2;
iconview.SelectionMode = SelectionMode.Multiple;
iconview.ItemActivated += iconview_ItemActivated;
iconview.ButtonPressEvent += iconView_ButtonPress;
iconview.Model = iconStore;
iconview.ModifyBase (StateType.Normal, new Gdk.Color (0x66, 0x66, 0x66));
iconwindow = new ScrolledWindow ();
iconwindow.ShadowType = ShadowType.EtchedIn;
iconwindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
iconwindow.Add (iconview);
imagewindow = new EventBox ();
fullSizeImage = new Image ();
// JICE TEST
fullsizeLayout = new Layout (null, null);
fullsizeLayout.Add (fullSizeImage);
fullsizeLayout.SizeRequested += fullsizeLayout_SizeRequested;
imagewindow.ModifyBase (StateType.Normal, new Gdk.Color (0x66, 0x66, 0x66));
imagewindow.Add (fullsizeLayout);
imagewindow.CanFocus = true;
imagewindow.KeyPressEvent += imagewindow_keyPressEvent;
imagewindow.SizeRequested += imagewindow_sizeAllocated;
// imagewindow.Add(fullSizeImage);
contentBox.PackStart (toolbar, false, false, 0);
contentBox.PackStart (iconwindow);
contentBox.PackStart (imagewindow);
contentBox.PackStart (threadwindow);
this.Add2 (contentBox);
this.ShowAll ();
imageSortAscending.Hide ();
imageSortDescending.Hide ();
iconwindow.Hide ();
imagewindow.Hide ();
closebtn.Hide ();
rotatebtn.Hide ();
savebtn.Hide ();
sepFullsize.Hide ();
downbtn.Hide ();
imageLoadingProgress.Hide ();
String favouriteThreads = UserSettings.getValue ("Site" + site.forumName + ".Forum" + forum + ".Favourites");
favThreads = favouriteThreads.Split (';');
treestoreTopics = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Gdk.Pixbuf));
topicsLoaded = 0;
loadTopics ();
treeviewTopics.Model = treestoreTopics;
}