Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
* ApplicationMenu.cs: hide container when windows is hidden
Browse files Browse the repository at this point in the history
* ApplicationButton.cs: keep the app menu pressed while the app menu is
  opened

svn path=/trunk/gtk-sharp-ribbon/; revision=108192
  • Loading branch information
Laurent Debacker committed Jul 17, 2008
1 parent e44247a commit abfc9a1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Ribbons/ApplicationButton.cs
Expand Up @@ -9,6 +9,7 @@ public class ApplicationButton : BaseButton
protected const double lineWidth = 1.0;

private ApplicationMenu appMenu;
private bool menuOpened;

/// <summary>Fired when the button is clicked.</summary>
[GLib.Signal("clicked")]
Expand All @@ -25,7 +26,10 @@ public ApplicationButton()

this.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));

menuOpened = false;

appMenu = new ApplicationMenu (this);
appMenu.Hidden += appMenu_Hidden;

HeightRequest = 36;
WidthRequest = 36;
Expand All @@ -44,6 +48,14 @@ public void Click ()
y += Allocation.Bottom;

appMenu.ShowAt (x, y);
menuOpened = true;
QueueDraw ();
}

private void appMenu_Hidden (object sender, EventArgs args)
{
menuOpened = false;
QueueDraw ();
}

protected override void BindedWidget_ButtonPressEvent (object sender, ButtonPressEventArgs evnt)
Expand Down Expand Up @@ -73,6 +85,8 @@ protected override bool OnExposeEvent (Gdk.EventExpose evnt)

protected void Draw (Context cr)
{
Theme.ButtonState state = this.state;
if(menuOpened) state = Theme.ButtonState.Pressed;
theme.DrawApplicationButton (cr, Allocation, state, lineWidth, this);
}

Expand Down
1 change: 1 addition & 0 deletions Ribbons/ApplicationMenu.cs
Expand Up @@ -236,6 +236,7 @@ private void KillMenu (bool Ungrab)
Gdk.Keyboard.Ungrab (0);
}
win.Hide ();
this.Hide ();
//win.Destroy ();
}

Expand Down
6 changes: 6 additions & 0 deletions Ribbons/ChangeLog
@@ -1,3 +1,9 @@
2008-06-30 Laurent Debacker <debackerl@gmail.com>

* ApplicationMenu.cs: hide container when windows is hidden
* ApplicationButton.cs: keep the app menu pressed while the app menu is
opened

2008-06-29 Laurent Debacker <debackerl@gmail.com>

* ApplicationMenuItem.cs: Text align fix, and delayed menu opening.
Expand Down

0 comments on commit abfc9a1

Please sign in to comment.