This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Button.cs: Make Click method virtual
* ToggleButton.cs: Allow toggle buttons to display an arrow * VariantsCombinaisonSwitcher.cs: Introduction of variants combinaisons switcher. * ToolBox.cs: Bugfix for size requests * VariantsCombinaison.cs: Bugfix for size requests, and hierachy * Ribbon.cs: Revert to previous version of Ribbon (I have opted for another solution for variants combinaisons) * DropdownRibbonGroup.cs: Introduction of Drop down ribbon group svn path=/trunk/gtk-sharp-ribbon/; revision=110153
- Loading branch information
Laurent Debacker
committed
Aug 11, 2008
1 parent
bf0a41a
commit d1600e5
Showing
9 changed files
with
394 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using System; | ||
using Gtk; | ||
|
||
namespace Ribbons | ||
{ | ||
public class DropdownRibbonGroup : ToggleButton | ||
{ | ||
private RibbonGroup group; | ||
private SyntheticWindow win; | ||
|
||
public RibbonGroup Group | ||
{ | ||
get { return group; } | ||
set { group = value; } | ||
} | ||
|
||
public DropdownRibbonGroup () | ||
{ | ||
DrawBackground = true; | ||
ImagePosition = PositionType.Top; | ||
isSmall = false; | ||
DisplayArrow = true; | ||
} | ||
|
||
protected override void BindedWidget_ButtonReleaseEvent (object sender, ButtonReleaseEventArgs evnt) | ||
{ | ||
base.BindedWidget_ButtonReleaseEvent (sender, evnt); | ||
|
||
if(Value) | ||
{ | ||
int x, y; | ||
ParentWindow.GetOrigin (out x, out y); | ||
x += Allocation.X; | ||
y += Allocation.Bottom; | ||
|
||
ShowAt (x, y); | ||
} | ||
else | ||
{ | ||
KillMenu (true); | ||
} | ||
} | ||
|
||
private void ShowAt (int x, int y) | ||
{ | ||
if(win != null) return; | ||
|
||
win = new SyntheticWindow (WindowType.Popup); | ||
win.Child = group; | ||
|
||
win.Hidden += delegate { KillMenu (true); }; | ||
|
||
win.ShowAll (); | ||
win.GdkWindow.Move (x, y); | ||
|
||
win.ButtonPressEvent += delegate { KillMenu (true); }; | ||
win.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask)); | ||
|
||
Grab.Add (win); | ||
Gdk.GrabStatus grabbed = Gdk.Pointer.Grab (win.GdkWindow, true, Gdk.EventMask.ButtonPressMask, null, null, 0); | ||
if(grabbed != Gdk.GrabStatus.Success) | ||
{ | ||
KillMenu (false); | ||
return; | ||
} | ||
|
||
grabbed = Gdk.Keyboard.Grab (win.GdkWindow, true, 0); | ||
if(grabbed != Gdk.GrabStatus.Success) | ||
{ | ||
KillMenu (false); | ||
return; | ||
} | ||
} | ||
|
||
private void KillMenu (bool Ungrab) | ||
{ | ||
if(win == null) return; | ||
|
||
Grab.Remove (win); | ||
if(Ungrab) | ||
{ | ||
Gdk.Pointer.Ungrab (0); | ||
Gdk.Keyboard.Ungrab (0); | ||
} | ||
win.Hide (); | ||
group.Unparent (); | ||
win = null; | ||
|
||
Value = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.