Author: danw
Date: 2005-04-04 17:38:39 -0400 (Mon, 04 Apr 2005)
New Revision: 42540
Modified:
trunk/stetic/ChangeLog
trunk/stetic/libstetic/PropertyDescriptor.cs
trunk/stetic/libstetic/wrapper/Button.cs
trunk/stetic/libstetic/wrapper/Container.cs
trunk/stetic/libstetic/wrapper/OptionMenu.cs
trunk/stetic/libstetic/wrapper/Widget.cs
trunk/stetic/libstetic/wrapper/Window.cs
Log:
* libstetic/PropertyDescriptor.cs (GladeName): fix for proxied
properties so that MnemonicWidget works right.
* libstetic/wrapper/Button.cs (ConstructChild): Fix so that stock
icons always UseUnderline
* libstetic/wrapper/Container.cs (FindInternalChild): No need to
recurse upward here any more. Also, return the wrapper rather than
the child.
(GladeSetInternalChild): don't create a wrapper here, since the
widget must already have one.
(Select): add a workaround for when you select a widget that isn't
mapped.
* libstetic/wrapper/OptionMenu.cs (Wrap): create a wrapper for the
menu.
(GladeSetInternalChild): override this, since the menu (which
glade considers to be an internal child of the optionmenu) is not
actually a real child.
* libstetic/wrapper/Widget.cs (FindWrapper): don't find widgets
that aren't mapped.
(HasDefault, HierarchyChanged): Fix the logic here; a widget
always has a "Toplevel", it's just that the Toplevel is not always
actually a toplevel widget.
* libstetic/wrapper/Window.cs (Select): Show() the window when it
is selected.
Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog 2005-04-04 20:23:58 UTC (rev 42539)
+++ trunk/stetic/ChangeLog 2005-04-04 21:38:39 UTC (rev 42540)
@@ -1,3 +1,34 @@
+2005-04-04 Dan Winship <[EMAIL PROTECTED]>
+
+ * libstetic/PropertyDescriptor.cs (GladeName): fix for proxied
+ properties so that MnemonicWidget works right.
+
+ * libstetic/wrapper/Button.cs (ConstructChild): Fix so that stock
+ icons always UseUnderline
+
+ * libstetic/wrapper/Container.cs (FindInternalChild): No need to
+ recurse upward here any more. Also, return the wrapper rather than
+ the child.
+ (GladeSetInternalChild): don't create a wrapper here, since the
+ widget must already have one.
+ (Select): add a workaround for when you select a widget that isn't
+ mapped.
+
+ * libstetic/wrapper/OptionMenu.cs (Wrap): create a wrapper for the
+ menu.
+ (GladeSetInternalChild): override this, since the menu (which
+ glade considers to be an internal child of the optionmenu) is not
+ actually a real child.
+
+ * libstetic/wrapper/Widget.cs (FindWrapper): don't find widgets
+ that aren't mapped.
+ (HasDefault, HierarchyChanged): Fix the logic here; a widget
+ always has a "Toplevel", it's just that the Toplevel is not always
+ actually a toplevel widget.
+
+ * libstetic/wrapper/Window.cs (Select): Show() the window when it
+ is selected.
+
2005-03-29 Dan Winship <[EMAIL PROTECTED]>
* libstetic/HandleWindow.cs (SelectionEvent): simplify for gdk#
Modified: trunk/stetic/libstetic/PropertyDescriptor.cs
===================================================================
--- trunk/stetic/libstetic/PropertyDescriptor.cs 2005-04-04 20:23:58 UTC
(rev 42539)
+++ trunk/stetic/libstetic/PropertyDescriptor.cs 2005-04-04 21:38:39 UTC
(rev 42540)
@@ -222,7 +222,7 @@
get {
if (gladeAttribute != null &&
gladeAttribute.Name != null)
return gladeAttribute.Name;
- else if (gladeProperty != null)
+ else if (gladeProperty != null &&
gladeProperty.GladeName != null)
return gladeProperty.GladeName;
else if (pspec != null)
return pspec.Name.Replace ('-', '_');
Modified: trunk/stetic/libstetic/wrapper/Button.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Button.cs 2005-04-04 20:23:58 UTC (rev
42539)
+++ trunk/stetic/libstetic/wrapper/Button.cs 2005-04-04 21:38:39 UTC (rev
42540)
@@ -178,12 +178,14 @@
labelWidget = null;
hasLabel = true;
- if (button.UseUnderline) {
+ bool useStock = icon != null && icon.StartsWith
("stock:");
+
+ if (button.UseUnderline || useStock) {
labelWidget = new Gtk.Label (label);
labelWidget.MnemonicWidget = button;
} else
labelWidget = Gtk.Label.New (label);
- labelWidget.Show ();
+ labelWidget.Show ();
if (icon == null) {
labelWidget.Xalign = button.Xalign;
@@ -192,7 +194,7 @@
return;
}
- if (icon.StartsWith ("stock:"))
+ if (useStock)
iconWidget = new Gtk.Image (icon.Substring (6),
Gtk.IconSize.Button);
else if (icon.StartsWith ("file:"))
iconWidget = new Gtk.Image (icon.Substring (5));
Modified: trunk/stetic/libstetic/wrapper/Container.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Container.cs 2005-04-04 20:23:58 UTC (rev
42539)
+++ trunk/stetic/libstetic/wrapper/Container.cs 2005-04-04 21:38:39 UTC (rev
42540)
@@ -111,28 +111,23 @@
container.Add (child);
}
- Gtk.Widget FindInternalChild (string childId)
+ Widget FindInternalChild (string childId)
{
- Container ancestor = this;
- while (ancestor != null) {
- foreach (Gtk.Widget w in
ancestor.container.Children) {
- Widget wrapper = Lookup (w);
- if (wrapper != null &&
wrapper.InternalChildId == childId)
- return w;
- }
- ancestor = ParentWrapper;
+ foreach (Gtk.Widget w in container.Children) {
+ Widget wrapper = Lookup (w);
+ if (wrapper != null && wrapper.InternalChildId
== childId)
+ return wrapper;
}
return null;
}
public virtual Widget GladeSetInternalChild (string childId,
string className, string id, Hashtable props)
{
- Gtk.Widget widget = FindInternalChild (childId);
- if (widget == null)
+ Widget wrapper = FindInternalChild (childId);
+ if (wrapper == null)
throw new GladeException ("Unrecognized
internal child name", className, false, "internal-child", childId);
- ObjectWrapper wrapper = Stetic.ObjectWrapper.Create
(stetic, className);
- GladeUtils.ImportWidget (stetic, wrapper, widget, id,
props);
+ GladeUtils.ImportWidget (stetic, wrapper,
wrapper.Wrapped, id, props);
return (Widget) wrapper;
}
@@ -321,7 +316,11 @@
if (handles != null)
handles.Dispose ();
- if (selection != null) {
+ // FIXME: if the selection isn't mapped, we should try
to force it
+ // to be. (Eg, if you select a widget in a hidden
window, the window
+ // should map. If you select a widget on a non-current
notebook
+ // page, the notebook should switch pages, etc.)
+ if (selection != null && selection.IsDrawable) {
handles = new HandleWindow (selection,
dragHandles);
handles.Drag += HandleWindowDrag;
} else
Modified: trunk/stetic/libstetic/wrapper/OptionMenu.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/OptionMenu.cs 2005-04-04 20:23:58 UTC
(rev 42539)
+++ trunk/stetic/libstetic/wrapper/OptionMenu.cs 2005-04-04 21:38:39 UTC
(rev 42540)
@@ -21,11 +21,13 @@
public override void Wrap (object obj, bool initialized)
{
base.Wrap (obj, initialized);
+
if (optionmenu.Menu == null) {
Gtk.Menu menu = new Gtk.Menu ();
menu.Show ();
optionmenu.Menu = menu;
}
+ ObjectWrapper.Create (stetic, typeof
(Stetic.Wrapper.Menu), optionmenu.Menu);
}
protected override void GladeImport (string className, string
id, Hashtable props)
@@ -35,17 +37,14 @@
stetic.GladeImportComplete += FlattenMenu;
}
- public override Widget GladeImportChild (string className,
string id, Hashtable props, Hashtable childprops)
+ public override Widget GladeSetInternalChild (string childId,
string className, string id, Hashtable props)
{
- ObjectWrapper wrapper =
Stetic.ObjectWrapper.GladeImport (stetic, className, id, props);
- if (wrapper == null)
- return null;
+ if (childId != "menu")
+ return base.GladeSetInternalChild (childId,
className, id, props);
- Gtk.Menu menu = (Gtk.Menu)wrapper.Wrapped;
- if (menu != null)
- optionmenu.Menu = menu;
-
- return wrapper as Stetic.Wrapper.Widget;
+ Widget wrapper = Stetic.Wrapper.Widget.Lookup
(optionmenu.Menu);
+ GladeUtils.ImportWidget (stetic, wrapper,
wrapper.Wrapped, id, props);
+ return wrapper;
}
void FlattenMenu ()
Modified: trunk/stetic/libstetic/wrapper/Widget.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Widget.cs 2005-04-04 20:23:58 UTC (rev
42539)
+++ trunk/stetic/libstetic/wrapper/Widget.cs 2005-04-04 21:38:39 UTC (rev
42540)
@@ -114,6 +114,9 @@
return Lookup (top);
foreach (Gtk.Widget child in new ChildEnumerator
(container)) {
+ if (!child.IsDrawable)
+ continue;
+
Gdk.Rectangle alloc = child.Allocation;
if (alloc.Contains (x, y)) {
Widget wrapper;
@@ -218,7 +221,7 @@
set {
hasDefault = value;
- if (Wrapped.Toplevel != null)
+ if (Wrapped.Toplevel != null &&
Wrapped.Toplevel.IsTopLevel)
Wrapped.HasDefault = hasDefault;
else
Wrapped.HierarchyChanged +=
HierarchyChanged;
@@ -227,7 +230,7 @@
void HierarchyChanged (object obj, Gtk.HierarchyChangedArgs
args)
{
- if (Wrapped.Toplevel != null) {
+ if (Wrapped.Toplevel != null &&
Wrapped.Toplevel.IsTopLevel) {
Wrapped.HasDefault = hasDefault;
Wrapped.HierarchyChanged -= HierarchyChanged;
}
Modified: trunk/stetic/libstetic/wrapper/Window.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Window.cs 2005-04-04 20:23:58 UTC (rev
42539)
+++ trunk/stetic/libstetic/wrapper/Window.cs 2005-04-04 21:38:39 UTC (rev
42540)
@@ -54,13 +54,18 @@
window.DeleteEvent += DeleteEvent;
}
+ public override void Select (Stetic.Wrapper.Widget wrapper)
+ {
+ if (wrapper == this)
+ Wrapped.Show ();
+ base.Select (wrapper);
+ }
+
[ConnectBefore]
void DeleteEvent (object obj, Gtk.DeleteEventArgs args)
{
Wrapped.Hide ();
args.RetVal = true;
-
- Select (this);
}
public override bool HExpandable { get { return true; } }
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches