}
+#if NET_2_0
+ public MainMenu (IContainer container) : this ()
+ {
+ container.Add (this);
+ }
+#endif
+
#region Public Properties
[Localizable(true)]
+#if NET_2_0
+ [AmbientValue (RightToLeft.Inherit)]
+#endif
public virtual RightToLeft RightToLeft {
get { return right_to_left;}
set { right_to_left = value; }
#region Private Methods
internal void Draw () {
+ Draw (Rect);
+ }
+
+ internal void Draw (Rectangle clip_rect) {
PaintEventArgs pe;
if (Wnd.IsHandleCreated) {
pe = XplatUI.PaintEventStart(Wnd.window.Handle, false);
+ pe.Graphics.Clip = new Region (clip_rect);
Draw (pe, Rect);
XplatUI.PaintEventEnd(Wnd.window.Handle, false);
}
ThemeEngine.Current.DrawMenuBar (pe.Graphics, this, rect);
- if (Paint != null)
- Paint (this, pe);
+ PaintEventHandler eh = (PaintEventHandler)(Events [PaintEvent]);
+ if (eh != null)
+ eh (this, pe);
+ }
+
+ internal override void InvalidateItem (MenuItem item)
+ {
+ Draw (item.bounds);
}
internal void SetForm (Form form)
if (form == null)
return;
- Height = 0;
-
- Draw ();
+ Rectangle clip = Rect;
+ Height = 0; /* need this so the theme code will re-layout the menu items
+ (why is the theme code doing the layout? argh) */
+ Draw (clip);
}
/* Mouse events from the form */
internal void OnMouseDown (object window, MouseEventArgs args)
{
- tracker.OnClick (args);
+ tracker.OnMouseDown (args);
}
internal void OnMouseMove (object window, MouseEventArgs e)
tracker.OnMotion (args);
}
- internal event PaintEventHandler Paint;
+ static object PaintEvent = new object ();
+
+ internal event PaintEventHandler Paint {
+ add { Events.AddHandler (PaintEvent, value); }
+ remove { Events.RemoveHandler (PaintEvent, value); }
+ }
#endregion Private Methods
}