Permalink
Browse files

* MainWindow.cs: Updated sample for key tips.

svn path=/trunk/gtk-sharp-ribbon/; revision=110886
  • Loading branch information...
1 parent dcbd740 commit 24c4ac41a61e22b13d526ddc8fc9675058f342fb Laurent Debacker committed Aug 18, 2008
Showing with 34 additions and 2 deletions.
  1. +4 −0 Sample/ChangeLog
  2. +30 −2 Sample/MainWindow.cs
View
@@ -1,3 +1,7 @@
+2008-08-18 Laurent Debacker <debackerl@gmail.com>
+
+ * MainWindow.cs: Updated sample for key tips.
+
2008-08-15 Laurent Debacker <debackerl@gmail.com>
* MainWindow.cs: Updated the main sample to integrate the sample developed
View
@@ -83,8 +83,9 @@ public MainWindow() : base (WindowType.Toplevel)
};
QuickAccessToolbar qat = new QuickAccessToolbar ();
- qat.Append (Ribbons.Button.FromStockIcon (Gtk.Stock.New, false));
- qat.Append (Ribbons.Button.FromStockIcon (Gtk.Stock.Save, false));
+ Ribbons.Button qatNew, qatSave;
+ qat.Append (qatNew = Ribbons.Button.FromStockIcon (Gtk.Stock.New, false));
+ qat.Append (qatSave = Ribbons.Button.FromStockIcon (Gtk.Stock.Save, false));
ribbon = new Ribbon ();
ribbon.ApplicationButton = new ApplicationButton ();
@@ -131,6 +132,13 @@ public MainWindow() : base (WindowType.Toplevel)
Add (master);
+ ribbon.ApplicationButton.KeyTip = new KeyTip (appMenu, "A");
+ qat.AddKeyTip (new KeyTip (qatNew, "B"));
+ qat.AddKeyTip (new KeyTip (qatSave, "C"));
+ ribbon.AddTabKeyTip (new KeyTip (pageLabel0, "D"));
+ ribbon.AddTabKeyTip (new KeyTip (pageLabel1, "E"));
+ ribbon.AddTabKeyTip (new KeyTip (pageLabel2, "F"));
+
ScreenChanged += Window_OnScreenChanged;
Window_OnScreenChanged (this, null);
ExposeEvent += Window_OnExpose;
@@ -256,6 +264,26 @@ private void onClick (object Sender, EventArgs e)
d.Destroy ();
}
+ protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
+ {
+ if(evnt.Key.ToString() == "Alt_L" || evnt.Key.ToString() == "ISO_Level3_Shift")
+ {
+ ribbon.ShowTopLevelKeyTips ();
+ }
+
+ return base.OnKeyPressEvent (evnt);
+ }
+
+ protected override bool OnKeyReleaseEvent (Gdk.EventKey evnt)
+ {
+ if(evnt.Key.ToString() == "Alt_L" || evnt.Key.ToString() == "ISO_Level3_Shift")
+ {
+ ribbon.HideKeyTips ();
+ }
+
+ return base.OnKeyReleaseEvent (evnt);
+ }
+
[GLib.ConnectBefore]
private void Window_OnExpose (object sender, ExposeEventArgs args)
{

0 comments on commit 24c4ac4

Please sign in to comment.