[Monodevelop-patches-list] r1725 - trunk/MonoDevelop/src/Libraries/Gdl
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Wed Jun 9 14:43:47 EDT 2004
Author: jzwart
Date: 2004-06-09 14:43:47 -0400 (Wed, 09 Jun 2004)
New Revision: 1725
Modified:
trunk/MonoDevelop/src/Libraries/Gdl/Dock.cs
trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs
trunk/MonoDevelop/src/Libraries/Gdl/DockItemGrip.cs
trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs
trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs
trunk/MonoDevelop/src/Libraries/Gdl/GdlDockTest.cs
Log:
Fix some SizeRequest/SizeAllocate issues. Some other minor fixes.
Modified: trunk/MonoDevelop/src/Libraries/Gdl/Dock.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/Dock.cs 2004-06-09 18:30:01 UTC (rev 1724)
+++ trunk/MonoDevelop/src/Libraries/Gdl/Dock.cs 2004-06-09 18:43:47 UTC (rev 1725)
@@ -8,36 +8,35 @@
{
public class Dock : DockObject
{
-
+ private DockObject root = null;
+ private bool floating;
+ private Widget window;
+ private bool auto_title;
+ private int float_x;
+ private int float_y;
+ private int width = -1;
+ private int height = -1;
+ private Gdk.GC xor_gc;
+
public Dock ()
{
- this.Flags |= (int)Gtk.WidgetFlags.NoWindow;
- this.DockObjectFlags &= ~(DockObjectFlags.Automatic);
- if (this.Master == null) {
- this.Bind (new DockMaster ());
+ Flags |= (int)WidgetFlags.NoWindow;
+ DockObjectFlags &= ~(DockObjectFlags.Automatic);
+ if (Master == null) {
+ Bind (new DockMaster ());
}
- if (this.floating) {
+ if (floating) {
//Need code here to handle floating shit.
}
- this.DockObjectFlags |= DockObjectFlags.Attached;
+ DockObjectFlags |= DockObjectFlags.Attached;
}
public Dock (Dock original, bool _floating) : this ()
{
- this.Master = original.Master;
- this.floating = _floating;
+ Master = original.Master;
+ floating = _floating;
}
- private DockObject root = null;
- private bool floating;
- private Widget window;
- private bool auto_title;
- private int float_x;
- private int float_y;
- private int width = -1;
- private int height = -1;
- private Gdk.GC xor_gc;
-
public DockObject Root {
get { return root; }
set { root = value; }
@@ -50,13 +49,13 @@
public string DefaultTitle {
get {
- if (this.Master != null)
- return this.Master.DefaultTitle;
+ if (Master != null)
+ return Master.DefaultTitle;
return null;
}
set {
- if (this.Master != null)
- this.Master.DefaultTitle = value;
+ if (Master != null)
+ Master.DefaultTitle = value;
}
}
@@ -64,8 +63,8 @@
get { return width; }
set {
width = value;
- if (this.floating && this.window != null && this.window is Gtk.Window)
- ((Gtk.Window)this.window).Resize (width, height);
+ if (floating && window != null && window is Window)
+ ((Window)window).Resize (width, height);
}
}
@@ -73,8 +72,8 @@
get { return height; }
set {
height = value;
- if (this.floating && this.window != null && this.window is Gtk.Window)
- ((Gtk.Window)this.window).Resize (width, height);
+ if (floating && window != null && window is Window)
+ ((Window)window).Resize (width, height);
}
}
@@ -82,8 +81,8 @@
get { return float_x; }
set {
float_x = value;
- if (this.floating && this.window != null && this.window is Gtk.Window)
- ((Gtk.Window)this.window).Resize (width, height);
+ if (floating && window != null && window is Window)
+ ((Window)window).Resize (width, height);
}
}
@@ -91,46 +90,49 @@
get { return float_y; }
set {
float_y = value;
- if (this.floating && this.window != null && this.window is Gtk.Window)
- ((Gtk.Window)this.window).Resize (width, height);
+ if (floating && window != null && window is Window)
+ ((Window)window).Resize (width, height);
}
}
- protected override void OnSizeRequested (ref Gtk.Requisition requisition)
+ protected override void OnSizeRequested (ref Requisition requisition)
{
- int border_width = (int)this.BorderWidth;
- if (this.root != null && this.root.Visible)
- requisition = this.root.SizeRequest ();
- else {
- requisition.Width = 0;
- requisition.Height = 0;
- }
-
- requisition.Width += 2 * border_width;
- requisition.Height += 2 * border_width;
+ requisition.Width = 2 * (int)BorderWidth;
+ requisition.Height = 2 * (int)BorderWidth;
+
+ if (root != null && root.Visible) {
+ Requisition rootReq = root.SizeRequest ();
+ requisition.Width += rootReq.Width;
+ requisition.Height += rootReq.Height;
+ }
}
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
{
- int border_width = (int)this.BorderWidth;
- allocation.X += border_width;
- allocation.Y += border_width;
- allocation.Width = Math.Max (1, allocation.Width - 2 * border_width);
- allocation.Height = Math.Max (1, allocation.Height - 2 * border_width);
+ base.OnSizeAllocated (allocation);
+
+ if (root != null && root.Visible) {
+ int bw = (int)BorderWidth;
+ Gdk.Rectangle childAlloc;
- if (this.root != null && this.root.Visible)
- this.root.SizeAllocate (allocation);
+ childAlloc.X = allocation.X + bw;
+ childAlloc.Y = allocation.Y + bw;
+ childAlloc.Width = Math.Max (1, allocation.Width - 2 * bw);
+ childAlloc.Height = Math.Max (1, allocation.Height - 2 * bw);
+
+ root.SizeAllocate (childAlloc);
+ }
}
protected override void OnMapped ()
{
base.OnMapped ();
Console.WriteLine ("Mapping");
- if (this.root != null) {
- Console.WriteLine ("root.Visible = " + this.root.Visible);
- if (this.root.Visible && !this.root.IsMapped) {
+ if (root != null) {
+ Console.WriteLine ("root.Visible = " + root.Visible);
+ if (root.Visible && !root.IsMapped) {
Console.WriteLine ("Mapping root");
- this.root.Map ();
+ root.Map ();
}
}
}
@@ -138,21 +140,21 @@
protected override void OnUnmapped ()
{
base.OnUnmapped ();
- if (this.root != null) {
- if (this.root.Visible && this.root.IsMapped)
- this.root.Unmap ();
+ if (root != null) {
+ if (root.Visible && root.IsMapped)
+ root.Unmap ();
}
- if (this.window != null)
+ if (window != null)
window.Unmap ();
}
protected override void OnShown ()
{
base.OnShown ();
- if (this.floating && this.window != null)
- this.window.Show ();
- if (this.IsController) {
- foreach (DockObject item in this.Master.TopLevelDocks) {
+ if (floating && window != null)
+ window.Show ();
+ if (IsController) {
+ foreach (DockObject item in Master.TopLevelDocks) {
if (item == this)
continue;
if (item.IsAutomatic)
@@ -164,8 +166,8 @@
protected override void OnHidden ()
{
base.OnHidden ();
- if (this.floating && this.window != null)
- this.window.Hide ();
+ if (floating && window != null)
+ window.Hide ();
/*PORT:
if (GDL_DOCK_IS_CONTROLLER (dock)) {
gdl_dock_master_foreach_toplevel (GDL_DOCK_OBJECT_GET_MASTER (dock),
@@ -174,8 +176,9 @@
}*/
}
- protected override void OnAdded (Gtk.Widget widget)
+ protected override void OnAdded (Widget widget)
{
+ Console.WriteLine ("OnAdded {0}", widget);
DockItem child = widget as DockItem;
if (child == null)
return;
@@ -183,22 +186,22 @@
AddItem (child, DockPlacement.Top);
}
- protected override void OnRemoved (Gtk.Widget widget)
+ protected override void OnRemoved (Widget widget)
{
bool was_visible = widget.Visible;
- if (this.root == widget) {
- this.root = null;
+ if (root == widget) {
+ root = null;
((DockObject)widget).DockObjectFlags &= ~(DockObjectFlags.Attached);
widget.Unparent ();
- if (was_visible && this.Visible)
- this.QueueResize ();
+ if (was_visible && Visible)
+ QueueResize ();
}
}
protected override void ForAll (bool include_internals, CallbackInvoker invoker)
{
- if (this.root != null)
- invoker.Invoke (this.root);
+ if (root != null)
+ invoker.Invoke (root);
}
/*PORT THIS CODE: its an override of Container.ChildType
@@ -210,32 +213,32 @@
public override void Detach (bool recursive)
{
- if (recursive && this.root != null)
- this.root.Detach (recursive);
- this.DockObjectFlags &= ~(DockObjectFlags.Attached);
+ if (recursive && root != null)
+ root.Detach (recursive);
+ DockObjectFlags &= ~(DockObjectFlags.Attached);
}
public override void Reduce ()
{
- if (this.root != null)
+ if (root != null)
return;
- if (this.IsAutomatic)
- this.Destroy ();
- else if (!(this.IsAttached)) {
- if (this.floating)
- this.Hide ();
+ if (IsAutomatic)
+ Destroy ();
+ else if (!(IsAttached)) {
+ if (floating)
+ Hide ();
else {
- if (this.Parent != null && this.Parent is Gtk.Container)
- ((Gtk.Container)this.Parent).Remove (this);
+ if (Parent != null && Parent is Container)
+ ((Container)Parent).Remove (this);
}
}
}
public override bool DockRequest (int x, int y, DockRequest request)
{
- Gdk.Rectangle alloc = this.Allocation;
- int bw = (int)this.BorderWidth;
+ Gdk.Rectangle alloc = Allocation;
+ int bw = (int)BorderWidth;
int rel_x = x - alloc.X;
int rel_y = y - alloc.Y;
DockRequest my_request = null;
@@ -253,11 +256,11 @@
req_rect.Height = alloc.Height - 2 * bw;
my_request.Rect = req_rect;
- if (this.root == null) {
+ if (root == null) {
my_request.Position = DockPlacement.Top;
my_request.Target = this;
} else {
- my_request.Target = this.root;
+ my_request.Target = root;
if (rel_x < bw) {
my_request.Position = DockPlacement.Left;
@@ -278,7 +281,7 @@
req_rect.Height = (int)(req_rect.Height * 0.3);
my_request.Rect = req_rect;
} else {
- may_dock = this.root.DockRequest (x, y, my_request);
+ may_dock = root.DockRequest (x, y, my_request);
}
}
}
@@ -304,27 +307,27 @@
height = rect.Height;
}
AddFloatingItem (item, x, y, width, height);
- } else if (this.root != null) {
+ } else if (root != null) {
Console.WriteLine ("root was not null, docking to root");
- this.root.Docking (requestor, position, null);
+ root.Docking (requestor, position, null);
//gdl_dock_set_title (dock /*this*/);
} else {
Console.WriteLine ("root is null, setting requestor to root");
- this.root = requestor;
- this.root.DockObjectFlags &= DockObjectFlags.Attached;
- this.root.Parent = this;
- ((DockItem)this.root).ShowGrip ();
- if (this.IsRealized) {
+ root = requestor;
+ root.DockObjectFlags &= DockObjectFlags.Attached;
+ root.Parent = this;
+ ((DockItem)root).ShowGrip ();
+ if (IsRealized) {
Console.WriteLine ("realizing new root");
- this.root.Realize ();
+ root.Realize ();
}
- if (this.Visible && this.root.Visible) {
+ if (Visible && root.Visible) {
Console.WriteLine ("root is visible");
- if (this.IsMapped) {
+ if (IsMapped) {
Console.WriteLine ("mapping new root");
- this.root.Map ();
+ root.Map ();
}
- this.root.QueueResize ();
+ root.QueueResize ();
}
//gdl_dock_set_title (dock /*this*/);
}
@@ -333,11 +336,11 @@
public override bool Reorder (DockObject requestor, DockPlacement new_position, object other_data)
{
bool handled = false;
- if (this.floating && new_position == DockPlacement.Floating && this.root == requestor) {
+ if (floating && new_position == DockPlacement.Floating && root == requestor) {
if (other_data != null && other_data is Gdk.Rectangle) {
Gdk.Rectangle rect = (Gdk.Rectangle)other_data;
- if (this.window != null && this.window is Gtk.Window) {
- ((Gtk.Window)this.window).Move (rect.X, rect.Y);
+ if (window != null && window is Window) {
+ ((Window)window).Move (rect.X, rect.Y);
handled = true;
}
}
@@ -348,7 +351,7 @@
public override bool ChildPlacement (DockObject child, ref DockPlacement placement)
{
bool retval = true;
- if (this.root == child) {
+ if (root == child) {
if (placement == DockPlacement.None || placement == DockPlacement.Floating)
placement = DockPlacement.Top;
} else
@@ -359,8 +362,8 @@
public override void Present (DockObject child)
{
- if (this.floating && this.window != null && this.window is Gtk.Window)
- ((Gtk.Window)this.window).Present ();
+ if (floating && window != null && window is Window)
+ ((Window)window).Present ();
}
public void AddItem (DockItem item, DockPlacement placement)
@@ -371,7 +374,7 @@
AddFloatingItem (item, 0, 0, -1, -1);
else {
Console.WriteLine ("about to dock");
- this.Docking (item, placement, null);
+ Docking (item, placement, null);
}
}
@@ -382,9 +385,9 @@
new_dock.Height = height;
new_dock.FloatX = x;
new_dock.FloatY = y;
- if (this.Visible) {
+ if (Visible) {
new_dock.Show ();
- if (this.IsMapped)
+ if (IsMapped)
new_dock.Map ();
new_dock.QueueResize ();
}
@@ -395,7 +398,7 @@
{
if (name == null)
return null;
- DockObject found = this.Master.GetObject (name);
+ DockObject found = Master.GetObject (name);
if (found != null && found is DockItem)
return (DockItem)found;
return null;
@@ -405,7 +408,7 @@
{
if (name == null)
return null;
- DockObject found = this.Master.GetObject (name);
+ DockObject found = Master.GetObject (name);
if (found != null && found is DockPlaceholder)
return (DockPlaceholder)found;
return null;
@@ -432,32 +435,32 @@
public void XorRect (Gdk.Rectangle rect)
{
- if (this.xor_gc == null) {
- if (this.IsRealized) {
+ if (xor_gc == null) {
+ if (IsRealized) {
Gdk.GCValues values = new Gdk.GCValues ();
values.Function = Gdk.Function.Invert;
values.SubwindowMode = Gdk.SubwindowMode.IncludeInferiors;
- this.xor_gc = new Gdk.GC (this.GdkWindow);
- this.xor_gc.SetValues (values, Gdk.GCValuesMask.Function | Gdk.GCValuesMask.Subwindow);
+ xor_gc = new Gdk.GC (GdkWindow);
+ xor_gc.SetValues (values, Gdk.GCValuesMask.Function | Gdk.GCValuesMask.Subwindow);
} else
return;
}
xor_gc.SetLineAttributes (1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Bevel);
xor_gc.SetDashes (1, new sbyte[] { 1, 1}, 2);
- this.GdkWindow.DrawRectangle (xor_gc, false, rect.X, rect.Y, rect.Width, rect.Height);
+ GdkWindow.DrawRectangle (xor_gc, false, rect.X, rect.Y, rect.Width, rect.Height);
xor_gc.SetDashes (0, new sbyte[] { 1, 1}, 2);
- this.GdkWindow.DrawRectangle (xor_gc, false, rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
+ GdkWindow.DrawRectangle (xor_gc, false, rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
}
private bool IsController {
get {
- if (this.Master == null) {
+ if (Master == null) {
Console.WriteLine ("Master is null");
return false;
}
- if (this.Master.Controller == null)
+ if (Master.Controller == null)
Console.WriteLine ("Master.Controller is null");
- return (this.Master.Controller == this);
+ return (Master.Controller == this);
}
}
}
Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs 2004-06-09 18:30:01 UTC (rev 1724)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockItem.cs 2004-06-09 18:43:47 UTC (rev 1725)
@@ -6,17 +6,17 @@
{
public class DockItem : DockObject
{
- private Gtk.Widget child = null;
+ private Widget child = null;
private DockItemBehavior behavior = DockItemBehavior.Normal;
- private Gtk.Orientation orientation = Gtk.Orientation.Horizontal;
+ private Orientation orientation = Orientation.Vertical;
private bool resize = false;
private int dragoff_x = 0;
private int dragoff_y = 0;
- private Gtk.Menu menu = null;
+ private Menu menu = null;
private bool grip_shown;
private DockItemGrip grip;
private uint grip_size;
- private Gtk.Widget tab_label = null;
+ private Widget tab_label = null;
private int preferred_width = -1;
private int preferred_height = -1;
private DockPlaceholder ph = null;
@@ -25,7 +25,7 @@
static DockItem ()
{
- Gtk.Rc.ParseString ("style \"gdl-dock-item-default\" {\n" +
+ Rc.ParseString ("style \"gdl-dock-item-default\" {\n" +
"xthickness = 0\n" +
"ythickness = 0\n" +
"}\n" +
@@ -35,22 +35,22 @@
public DockItem ()
{
- if (this.HasGrip) {
- this.grip_shown = true;
- this.grip = new DockItemGrip (this);
- this.grip.Parent = this;
- this.grip.Show ();
+ if (HasGrip) {
+ grip_shown = true;
+ grip = new DockItemGrip (this);
+ grip.Parent = this;
+ grip.Show ();
} else {
- this.grip_shown = false;
+ grip_shown = false;
}
- this.DockObjectFlags &= ~(DockObjectFlags.Automatic);
+ DockObjectFlags &= ~(DockObjectFlags.Automatic);
}
public DockItem (string name, string long_name, DockItemBehavior behavior) : this ()
{
- this.Name = name;
- this.LongName = long_name;
- this.Behavior = behavior;
+ Name = name;
+ LongName = long_name;
+ Behavior = behavior;
//FIXME: Set the tab label here, should it just be an hbox or that
//strange DockTabLabel with what looks like a lot of dead code
//from gdl-dock
@@ -58,17 +58,17 @@
public DockItem (string name, string long_name, string stock_id, DockItemBehavior behavior) : this (name, long_name, behavior)
{
- this.StockId = stock_id;
+ StockId = stock_id;
}
- public Gtk.Widget TabLabel {
- get { return this.tab_label; }
- set { this.tab_label = value; }
+ public Widget TabLabel {
+ get { return tab_label; }
+ set { tab_label = value; }
}
- public new Gtk.Widget Child {
- get { return this.child; }
- set { this.child = value; }
+ public new Widget Child {
+ get { return child; }
+ set { child = value; }
}
public virtual bool HasGrip {
@@ -76,38 +76,38 @@
}
public int DragOffX {
- get { return this.dragoff_x; }
- set { this.dragoff_x = value; }
+ get { return dragoff_x; }
+ set { dragoff_x = value; }
}
public int DragOffY {
- get { return this.dragoff_y; }
- set { this.dragoff_y = value; }
+ get { return dragoff_y; }
+ set { dragoff_y = value; }
}
public override bool IsCompound {
get { return false; }
}
- public Gtk.Orientation Orientation {
+ public Orientation Orientation {
get { return orientation; }
set { SetOrientation (value); }
}
public bool Resize {
- get { return this.resize; }
+ get { return resize; }
set {
- this.resize = value;
- this.QueueResize ();
+ resize = value;
+ QueueResize ();
}
}
public DockItemBehavior Behavior {
get { return behavior; }
set {
- DockItemBehavior old_beh = this.behavior;
- this.behavior = value;
- if (((old_beh ^ this.behavior) & DockItemBehavior.Locked) != 0) {
+ DockItemBehavior old_beh = behavior;
+ behavior = value;
+ if (((old_beh ^ behavior) & DockItemBehavior.Locked) != 0) {
/* PORT THIS:
if (GDL_DOCK_OBJECT_GET_MASTER (item))
g_signal_emit_by_name (GDL_DOCK_OBJECT_GET_MASTER (item),
@@ -120,14 +120,14 @@
}
public bool Locked {
- get { return ((this.behavior & DockItemBehavior.Locked) != 0); }
+ get { return ((behavior & DockItemBehavior.Locked) != 0); }
set {
- DockItemBehavior old_beh = this.behavior;
+ DockItemBehavior old_beh = behavior;
if (value)
- this.behavior |= DockItemBehavior.Locked;
+ behavior |= DockItemBehavior.Locked;
else
- this.behavior &= ~(DockItemBehavior.Locked);
- if ((old_beh ^ this.behavior) != 0) {
+ behavior &= ~(DockItemBehavior.Locked);
+ if ((old_beh ^ behavior) != 0) {
//PORT THIS:
//gdl_dock_item_showhide_grip (item /*this*/);
//g_object_notify (g_object, "behavior");
@@ -138,229 +138,243 @@
}
public int PreferredWidth {
- get { return this.preferred_width; }
- set { this.preferred_width = value; }
+ get { return preferred_width; }
+ set { preferred_width = value; }
}
public int PreferredHeight {
- get { return this.preferred_height; }
- set { this.preferred_height = value; }
+ get { return preferred_height; }
+ set { preferred_height = value; }
}
public bool InDrag {
- get { return ((this.DockObjectFlags & DockObjectFlags.InDrag) != 0); }
+ get { return ((DockObjectFlags & DockObjectFlags.InDrag) != 0); }
}
public bool InPreDrag {
- get { return ((this.DockObjectFlags & DockObjectFlags.InPreDrag) != 0); }
+ get { return ((DockObjectFlags & DockObjectFlags.InPreDrag) != 0); }
}
public bool Iconified {
- get { return ((this.DockObjectFlags & DockObjectFlags.Iconified) != 0); }
+ get { return ((DockObjectFlags & DockObjectFlags.Iconified) != 0); }
}
public bool UserAction {
- get { return ((this.DockObjectFlags & DockObjectFlags.UserAction) != 0); }
+ get { return ((DockObjectFlags & DockObjectFlags.UserAction) != 0); }
}
public bool GripShown {
get {
- return (this.HasGrip && !this.Locked && this.grip_shown);
+ return (HasGrip && !Locked && grip_shown);
}
}
public bool CantClose {
- get { return ((this.Behavior & DockItemBehavior.CantClose) != 0); }
+ get { return ((Behavior & DockItemBehavior.CantClose) != 0); }
}
public bool CantIconify {
- get { return ((this.Behavior & DockItemBehavior.CantIconify) != 0); }
+ get { return ((Behavior & DockItemBehavior.CantIconify) != 0); }
}
- protected override void OnAdded (Gtk.Widget widget)
+ protected override void OnAdded (Widget widget)
{
if (widget is DockObject) {
Console.WriteLine ("You can't add a DockObject to a DockItem");
return;
}
- if (this.Child != null) {
+ if (Child != null) {
Console.WriteLine ("This DockItem already has a child");
return;
}
widget.Parent = this;
- this.Child = widget;
+ Child = widget;
}
- protected override void OnRemoved (Gtk.Widget widget)
+ protected override void OnRemoved (Widget widget)
{
- if (this.grip == widget) {
+ if (grip == widget) {
bool grip_was_visible = widget.Visible;
widget.Unparent ();
- this.grip = null;
+ grip = null;
if (grip_was_visible)
- this.QueueResize ();
+ QueueResize ();
return;
}
- if (this.InDrag) {
- this.DockDragEnd ();
+ if (InDrag) {
+ DockDragEnd ();
}
- if (widget != this.Child)
+ if (widget != Child)
return;
bool was_visible = widget.Visible;
widget.Unparent ();
- this.Child = null;
+ Child = null;
if (was_visible)
- this.QueueResize ();
+ QueueResize ();
}
protected override void ForAll (bool include_internals, CallbackInvoker invoker)
{
- if (include_internals && this.grip != null)
- invoker.Invoke (this.grip);
- if (this.Child != null)
- invoker.Invoke (this.Child);
+ if (include_internals && grip != null)
+ invoker.Invoke (grip);
+ if (Child != null)
+ invoker.Invoke (Child);
}
- protected override void OnSizeRequested (ref Gtk.Requisition requisition)
+ protected override void OnSizeRequested (ref Requisition requisition)
{
- Gtk.Requisition child_requisition = new Gtk.Requisition ();
- Gtk.Requisition grip_requisition = new Gtk.Requisition ();
-
- if (this.Child != null)
- child_requisition = this.Child.SizeRequest ();
- else {
- child_requisition.Width = 0;
- child_requisition.Height = 0;
+ requisition.Width = ((int)BorderWidth + Style.XThickness) * 2;
+ requisition.Height = ((int)BorderWidth + Style.YThickness) * 2;
+
+ Requisition childReq;
+ if (Child != null && Child.Visible) {
+ childReq = Child.SizeRequest ();
+ } else {
+ childReq.Width = 0;
+ childReq.Height = 0;
}
- if (this.Orientation == Gtk.Orientation.Horizontal) {
- if (this.GripShown) {
- grip_requisition = this.grip.SizeRequest ();
- requisition.Width = grip_requisition.Width;
- } else {
- requisition.Width = 0;
+
+ Requisition gripReq;
+ gripReq.Width = gripReq.Height = 0;
+
+ if (Orientation == Orientation.Horizontal) {
+ if (GripShown) {
+ gripReq = grip.SizeRequest ();
+ requisition.Width += gripReq.Width;
}
- if (this.Child != null) {
- requisition.Width += child_requisition.Width;
- requisition.Height = child_requisition.Height;
- } else {
- requisition.Height = 0;
+ if (Child != null) {
+ requisition.Width += childReq.Width;
+ requisition.Height += Math.Max (childReq.Height,
+ gripReq.Height);
}
} else {
- if (this.GripShown) {
- grip_requisition = this.grip.SizeRequest ();
- requisition.Height = grip_requisition.Height;
- } else {
- requisition.Height = 0;
+ if (GripShown) {
+ gripReq = grip.SizeRequest ();
+ requisition.Height += gripReq.Height;
}
- if (this.Child != null) {
- requisition.Width = child_requisition.Width;
- requisition.Height += child_requisition.Height;
- } else {
- requisition.Width = 0;
+ if (Child != null) {
+ requisition.Width += Math.Max (childReq.Width,
+ gripReq.Width);
+ requisition.Height += childReq.Height;
}
}
- requisition.Width += ((int)this.BorderWidth + this.Style.XThickness) * 2;
- requisition.Width += ((int)this.BorderWidth + this.Style.YThickness) * 2;
- this.SetSizeRequest (requisition.Width, requisition.Height);
}
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
{
- this.Allocation = allocation;
+ base.OnSizeAllocated (allocation);
- if (this.IsRealized) {
- this.GdkWindow.MoveResize (allocation.X, allocation.Y, allocation.Width, allocation.Height);
+ if (IsRealized) {
+ GdkWindow.MoveResize (allocation.X, allocation.Y,
+ allocation.Width, allocation.Height);
}
- if (this.Child != null && this.Child.Visible) {
- int border_width = (int)this.BorderWidth;
- Gdk.Rectangle child_allocation = new Gdk.Rectangle ();
- child_allocation.X = border_width + this.Style.XThickness;
- child_allocation.Y = border_width + this.Style.YThickness;
- child_allocation.Width = allocation.Width - 2 * (border_width + this.Style.XThickness);
- child_allocation.Height = allocation.Height - 2 * (border_width + this.Style.YThickness);
+
+ if (Child != null && Child.Visible) {
+ int bw = (int)BorderWidth;
+ Gdk.Rectangle childAlloc;
- if (this.GripShown) {
- Gdk.Rectangle grip_alloc = child_allocation;
- Gtk.Requisition grip_req = this.grip.SizeRequest ();
- if (this.Orientation == Gtk.Orientation.Horizontal) {
- child_allocation.X += grip_req.Width;
- child_allocation.Width -= grip_req.Width;
- //grip_alloc.Width = grip_req.Width;
+ childAlloc.X = bw + Style.XThickness;
+ childAlloc.Y = bw + Style.YThickness;
+ childAlloc.Width = allocation.Width - 2 * (bw + Style.XThickness);
+ childAlloc.Height = allocation.Height - 2 * (bw + Style.YThickness);
+
+ if (GripShown) {
+ Gdk.Rectangle gripAlloc = childAlloc;
+ Requisition gripReq = grip.SizeRequest ();
+
+ if (Orientation == Orientation.Horizontal) {
+ childAlloc.X += gripReq.Width;
+ childAlloc.Width -= gripReq.Width;
+ gripAlloc.Width = gripReq.Width;
} else {
- child_allocation.Y += grip_req.Height;
- child_allocation.Height -= grip_req.Height;
- //grip_alloc.Height = grip_req.Height;
+ childAlloc.Y += gripReq.Height;
+ childAlloc.Height -= gripReq.Height;
+ gripAlloc.Height = gripReq.Height;
}
- if (this.grip != null) {
- this.grip.SizeAllocate (grip_alloc);
- }
+
+ grip.SizeAllocate (gripAlloc);
}
- this.Child.SizeAllocate (child_allocation);
+
+ Child.SizeAllocate (childAlloc);
}
}
protected override void OnMapped ()
{
- this.Flags |= (int)Gtk.WidgetFlags.Mapped;
- this.GdkWindow.Show ();
- if (this.Child != null && this.Child.Visible && !this.Child.IsMapped)
- this.Child.Map ();
- if (this.grip != null && this.grip.Visible && !this.grip.IsMapped)
- this.grip.Map ();
+ Flags |= (int)WidgetFlags.Mapped;
+ GdkWindow.Show ();
+ if (Child != null && Child.Visible && !Child.IsMapped)
+ Child.Map ();
+ if (grip != null && grip.Visible && !grip.IsMapped)
+ grip.Map ();
}
protected override void OnUnmapped ()
{
- this.Flags &= ~((int)Gtk.WidgetFlags.Mapped);
- this.GdkWindow.Hide ();
- if (this.grip != null)
- this.grip.Unmap ();
+ Flags &= ~((int)WidgetFlags.Mapped);
+ GdkWindow.Hide ();
+ if (grip != null)
+ grip.Unmap ();
}
protected override void OnRealized ()
{
- this.Flags |= (int)Gtk.WidgetFlags.Realized;
+ Flags |= (int)WidgetFlags.Realized;
+
Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
- attributes.X = this.Allocation.X;
- attributes.Y = this.Allocation.Y;
- attributes.Height = this.Allocation.Height;
- attributes.Width = this.Allocation.Width;
+ attributes.X = Allocation.X;
+ attributes.Y = Allocation.Y;
+ attributes.Height = Allocation.Height;
+ attributes.Width = Allocation.Width;
attributes.WindowType = Gdk.WindowType.Child;
attributes.Wclass = Gdk.WindowClass.InputOutput;
- attributes.visual = this.Visual;
- attributes.colormap = this.Colormap;
- attributes.EventMask = (int)(this.Events | Gdk.EventMask.ExposureMask | Gdk.EventMask.Button1MotionMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask);
- Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Colormap | Gdk.WindowAttributesType.Visual;
- this.GdkWindow = new Gdk.Window (this.ParentWindow, attributes, (int)attributes_mask);
- this.GdkWindow.UserData = this.Handle;
- this.Style = this.Style.Attach (this.GdkWindow);
- this.Style.SetBackground (this.GdkWindow, this.State);
- this.GdkWindow.SetBackPixmap (null, true);
- if (this.Child != null)
- this.Child.ParentWindow = this.GdkWindow;
- if (this.grip != null)
- this.grip.ParentWindow = this.GdkWindow;
+ attributes.visual = Visual;
+ attributes.colormap = Colormap;
+ attributes.EventMask = (int)(Events |
+ Gdk.EventMask.ExposureMask |
+ Gdk.EventMask.Button1MotionMask |
+ Gdk.EventMask.ButtonPressMask |
+ Gdk.EventMask.ButtonReleaseMask);
+
+ Gdk.WindowAttributesType attributes_mask =
+ Gdk.WindowAttributesType.X |
+ Gdk.WindowAttributesType.Y |
+ Gdk.WindowAttributesType.Colormap |
+ Gdk.WindowAttributesType.Visual;
+ GdkWindow = new Gdk.Window (ParentWindow, attributes, (int)attributes_mask);
+ GdkWindow.UserData = Handle;
+
+ Style = Style.Attach (GdkWindow);
+ Style.SetBackground (GdkWindow, State);
+
+ // FIXME: Throws NullReferenceException.
+ //GdkWindow.SetBackPixmap (null, true);
+
+ if (Child != null)
+ Child.ParentWindow = GdkWindow;
+ if (grip != null)
+ grip.ParentWindow = GdkWindow;
}
- /*protected override void OnStyleSet (Gtk.Style previous_style)
+ /*protected override void OnStyleSet (Style previous_style)
{
- if (this.IsRealized && !this.NoWindow) {
- this.Style.SetBackground (this.GdkWindow, this.State);
- if (this.Drawable) {
- this.GdkWindow.Clear ();
+ if (IsRealized && !NoWindow) {
+ Style.SetBackground (GdkWindow, State);
+ if (Drawable) {
+ GdkWindow.Clear ();
}
}
}*/
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
- if (this.Drawable && evnt.Window == this.GdkWindow) {
- Gtk.Style.PaintBox (this.Style, this.GdkWindow, this.State, Gtk.ShadowType.None, evnt.Area, this, "dockitem", 0, 0, -1, -1);
+ if (Drawable && evnt.Window == GdkWindow) {
+ Style.PaintBox (Style, GdkWindow, State, ShadowType.None, evnt.Area, this, "dockitem", 0, 0, -1, -1);
base.OnExposeEvent (evnt);
}
return false;
@@ -368,7 +382,7 @@
private bool EventInGripWindow (Gdk.Event evnt)
{
- if (this.grip != null && this.grip.TitleWindow == evnt.Window)
+ if (grip != null && grip.TitleWindow == evnt.Window)
return true;
return false;
}
@@ -377,19 +391,19 @@
{
if (!EventInGripWindow (evnt))
return false;
- if (this.Locked)
+ if (Locked)
return false;
bool event_handled = false;
bool in_handle;
Gdk.Cursor cursor = null;
- switch (this.Orientation) {
- case Gtk.Orientation.Horizontal:
- in_handle = evnt.X < this.grip.Allocation.Width;
+ switch (Orientation) {
+ case Orientation.Horizontal:
+ in_handle = evnt.X < grip.Allocation.Width;
break;
- case Gtk.Orientation.Vertical:
- in_handle = evnt.Y < this.grip.Allocation.Height;
+ case Orientation.Vertical:
+ in_handle = evnt.Y < grip.Allocation.Height;
break;
default:
in_handle = false;
@@ -398,28 +412,28 @@
if (evnt.Button == 1 && evnt.Type == Gdk.EventType.ButtonPress) {
if (in_handle) {
- this.start_x = (int)evnt.X;
- this.start_y = (int)evnt.Y;
- this.DockObjectFlags |= DockObjectFlags.InPreDrag;
- cursor = new Gdk.Cursor (this.Display, Gdk.CursorType.Fleur);
- this.grip.TitleWindow.Cursor = cursor;
+ start_x = (int)evnt.X;
+ start_y = (int)evnt.Y;
+ DockObjectFlags |= DockObjectFlags.InPreDrag;
+ cursor = new Gdk.Cursor (Display, Gdk.CursorType.Fleur);
+ grip.TitleWindow.Cursor = cursor;
event_handled = true;
}
} else if (evnt.Type == Gdk.EventType.ButtonRelease && evnt.Button == 1) {
- if (this.InDrag) {
- this.DockDragEnd ();
+ if (InDrag) {
+ DockDragEnd ();
event_handled = true;
- } else if (this.InPreDrag) {
- this.DockObjectFlags &= ~(DockObjectFlags.InPreDrag);
+ } else if (InPreDrag) {
+ DockObjectFlags &= ~(DockObjectFlags.InPreDrag);
event_handled = true;
}
- if (this.grip.TitleWindow != null) {
- cursor = new Gdk.Cursor (this.Display, Gdk.CursorType.Hand2);
- this.grip.TitleWindow.Cursor = cursor;
+ if (grip.TitleWindow != null) {
+ cursor = new Gdk.Cursor (Display, Gdk.CursorType.Hand2);
+ grip.TitleWindow.Cursor = cursor;
}
} else if (evnt.Button == 3 && evnt.Type == Gdk.EventType.ButtonPress && in_handle) {
- this.DockPopupMenu (evnt.Button, evnt.Time);
+ DockPopupMenu (evnt.Button, evnt.Time);
event_handled = true;
}
return event_handled;
@@ -434,16 +448,16 @@
{
if (!EventInGripWindow (evnt))
return false;
- if (this.InPreDrag) {
- if (Gtk.Drag.CheckThreshold (this, this.start_x, this.start_y, (int)evnt.X, (int)evnt.Y)) {
- this.DockObjectFlags &= ~(DockObjectFlags.InPreDrag);
- this.dragoff_x = this.start_x;
- this.dragoff_y = this.start_y;
- this.DockDragStart ();
+ if (InPreDrag) {
+ if (Drag.CheckThreshold (this, start_x, start_y, (int)evnt.X, (int)evnt.Y)) {
+ DockObjectFlags &= ~(DockObjectFlags.InPreDrag);
+ dragoff_x = start_x;
+ dragoff_y = start_y;
+ DockDragStart ();
}
}
- if (!this.InDrag)
+ if (!InDrag)
return false;
int new_x = (int)evnt.XRoot;
@@ -456,16 +470,16 @@
protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
{
- if (this.InDrag && evnt.Key == Gdk.Key.Escape) {
- this.DockDragEnd ();
+ if (InDrag && evnt.Key == Gdk.Key.Escape) {
+ DockDragEnd ();
return true;
}
return base.OnKeyPressEvent (evnt);
}
- public static Gtk.Requisition PreferredSize (DockItem item)
+ public static Requisition PreferredSize (DockItem item)
{
- Gtk.Requisition req;
+ Requisition req;
req.Width = Math.Max (item.preferred_width, item.Allocation.Width);
req.Height = Math.Max (item.preferred_height, item.Allocation.Height);
return req;
@@ -473,14 +487,13 @@
public override bool DockRequest (int x, int y, DockRequest request)
{
- Console.WriteLine ("Inside DockItem.DockRequest");
- Gdk.Rectangle alloc = this.Allocation;
+ Gdk.Rectangle alloc = Allocation;
int rel_x = x - alloc.X;
int rel_y = y - alloc.Y;
if (rel_x > 0 && rel_x < alloc.Width && rel_y > 0 && rel_y < alloc.Width) {
- Gtk.Requisition other = DockItem.PreferredSize ((DockItem)request.Applicant);
- Gtk.Requisition my = DockItem.PreferredSize (this);
+ Requisition other = DockItem.PreferredSize ((DockItem)request.Applicant);
+ Requisition my = DockItem.PreferredSize (this);
int divider = 0;
float rx = (float) rel_x / alloc.Width;
float ry = (float) rel_y / alloc.Height;
@@ -547,74 +560,67 @@
public override void Docking (DockObject requestor, DockPlacement position, object other_data)
{
- DockObject new_parent = null;
- bool add_ourselves_first;
+ DockObject parent = ParentObject;
+ DockObject newParent = null;
+ bool addOurselvesFirst;
DockObject parentObj = this.ParentObject;
switch (position) {
case DockPlacement.Top:
case DockPlacement.Bottom:
- new_parent = new DockPaned (Gtk.Orientation.Vertical);
- add_ourselves_first = (position == DockPlacement.Bottom);
+ newParent = new DockPaned (Orientation.Vertical);
+ addOurselvesFirst = (position == DockPlacement.Bottom);
break;
case DockPlacement.Left:
case DockPlacement.Right:
- new_parent = new DockPaned (Gtk.Orientation.Horizontal);
- add_ourselves_first = (position == DockPlacement.Right);
+ newParent = new DockPaned (Orientation.Horizontal);
+ addOurselvesFirst = (position == DockPlacement.Right);
break;
case DockPlacement.Center:
- new_parent = new DockNotebook ();
- add_ourselves_first = true;
+ newParent = new DockNotebook ();
+ addOurselvesFirst = true;
break;
default:
Console.WriteLine ("Unsupported docking strategy");
return;
}
- Console.WriteLine ("new_parent is of type: " + new_parent);
+ if (parent != null)
+ parent.Freeze ();
+
+ DockObjectFlags |= DockObjectFlags.InReflow;
+ Detach (false);
+ newParent.Freeze ();
+ newParent.Bind (Master);
- if (parentObj != null)
- parentObj.Freeze ();
- this.DockObjectFlags |= DockObjectFlags.InReflow;
- this.Detach (false);
- new_parent.Freeze ();
- new_parent.Bind (this.Master);
-
- Console.WriteLine ("About to add");
- if (add_ourselves_first) {
- Console.WriteLine ("Adding this");
- new_parent.Add (this);
- Console.WriteLine ("Adding new object");
- new_parent.Add (requestor);
+ if (addOurselvesFirst) {
+ newParent.Add (this);
+ newParent.Add (requestor);
} else {
- Console.WriteLine ("Adding new object");
- new_parent.Add (requestor);
- Console.WriteLine ("Adding this");
- new_parent.Add (this);
+ newParent.Add (requestor);
+ newParent.Add (this);
}
Console.WriteLine ("Done Adding");
- if (parentObj != null) {
- Console.WriteLine ("About to add new_parent to ParentObject");
- parentObj.Add (new_parent);
- Console.WriteLine ("Done with the second add");
- }
+ if (parent != null)
+ parent.Add (newParent);
- if (this.Visible)
- new_parent.Show ();
+ if (Visible)
+ newParent.Show ();
if (position != DockPlacement.Center && other_data != null && other_data is System.Int32) {
//PORT THIS:
- //g_object_set (G_OBJECT (new_parent), "position", g_value_get_uint (other_data), NULL);
+ //g_object_set (G_OBJECT (newParent), "position", g_value_get_uint (other_data), NULL);
}
- this.DockObjectFlags &= ~(DockObjectFlags.InReflow);
- new_parent.Thaw ();
- if (parentObj != null)
- parentObj.Thaw ();
+ DockObjectFlags &= ~(DockObjectFlags.InReflow);
+ newParent.Thaw ();
+
+ if (parent != null)
+ parent.Thaw ();
}
- private void DetachMenu (Gtk.Widget item, Gtk.Menu menu)
+ private void DetachMenu (Widget item, Menu menu)
{
if (item is DockItem)
((DockItem)item).menu = null;
@@ -622,34 +628,34 @@
public void DockPopupMenu (uint button, uint time)
{
- if (this.menu == null) {
- this.menu = new Gtk.Menu ();
- this.menu.AttachToWidget (this, new MenuDetachFunc (DetachMenu));
+ if (menu == null) {
+ menu = new Menu ();
+ menu.AttachToWidget (this, new MenuDetachFunc (DetachMenu));
- Gtk.MenuItem mitem = new Gtk.MenuItem ("Hide");
+ MenuItem mitem = new MenuItem ("Hide");
mitem.Activated += new EventHandler (ItemHideCb);
- this.menu.Append (mitem);
+ menu.Append (mitem);
}
- this.menu.ShowAll ();
- this.menu.Popup (null, null, null, IntPtr.Zero, button, time);
+ menu.ShowAll ();
+ menu.Popup (null, null, null, IntPtr.Zero, button, time);
}
private void ItemHideCb (object o, EventArgs e)
{
- this.HideItem ();
+ HideItem ();
}
public void DockDragStart ()
{
Gdk.Cursor fleur = new Gdk.Cursor (Gdk.CursorType.Fleur);
- if (!this.IsRealized)
- this.Realize ();
+ if (!IsRealized)
+ Realize ();
- this.DockObjectFlags |= DockObjectFlags.InDrag;
+ DockObjectFlags |= DockObjectFlags.InDrag;
- Gtk.Grab.Add (this);
+ Grab.Add (this);
//PORT THIS:
//g_signal_emit (item, gdl_dock_item_signals [DOCK_DRAG_BEGIN], 0);
@@ -657,23 +663,23 @@
public void DockDragEnd ()
{
- Gtk.Grab.Remove (Gtk.Grab.Current);
+ Grab.Remove (Grab.Current);
//PORT THIS:
//g_signal_emit (item, gdl_dock_item_signals [DOCK_DRAG_END], 0);
- this.DockObjectFlags &= ~(DockObjectFlags.InDrag);
+ DockObjectFlags &= ~(DockObjectFlags.InDrag);
}
private void ShowHideGrip ()
{
- if (this.grip != null) {
- if (this.GripShown)
- this.grip.Show ();
+ if (grip != null) {
+ if (GripShown)
+ grip.Show ();
else
- this.grip.Hide ();
+ grip.Hide ();
}
- this.QueueResize ();
+ QueueResize ();
}
public void DockTo (DockItem target, DockPlacement position, int docking_param)
@@ -681,20 +687,20 @@
if (target == null || position == DockPlacement.Floating)
return;
if (position == DockPlacement.Floating || target == null) {
- if (!this.IsBound) {
+ if (!IsBound) {
Console.WriteLine ("Attempting to bind an unbound object");
return;
}
- this.dragoff_x = this.dragoff_y = 0;
- ((Dock)this.Master.Controller).AddFloatingItem (this, 0, 0, -1, -1);
+ dragoff_x = dragoff_y = 0;
+ ((Dock)Master.Controller).AddFloatingItem (this, 0, 0, -1, -1);
} else
target.Docking (this, position, null);
}
- public virtual void SetOrientation (Gtk.Orientation orientation)
+ public virtual void SetOrientation (Orientation orientation)
{
- if (this.Orientation != orientation) {
- if (this.Child != null) {
+ if (Orientation != orientation) {
+ if (Child != null) {
//FIXME: Port this, prolly w/ reflection
/*pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (item->child), "orientation");
@@ -710,17 +716,17 @@
public void HideGrip ()
{
- if (this.grip_shown) {
- this.grip_shown = false;
- this.ShowHideGrip ();
+ if (grip_shown) {
+ grip_shown = false;
+ ShowHideGrip ();
}
}
public void ShowGrip ()
{
- if (!this.grip_shown) {
- this.grip_shown = true;
- this.ShowHideGrip ();
+ if (!grip_shown) {
+ grip_shown = true;
+ ShowHideGrip ();
}
}
@@ -729,28 +735,28 @@
if (dock == null)
return;
- this.Bind (dock.Master);
+ Bind (dock.Master);
}
public void HideItem ()
{
- if (!this.IsAttached)
+ if (!IsAttached)
return;
- if (!this.IsAutomatic) {
- this.ph = new DockPlaceholder (this, false);
+ if (!IsAutomatic) {
+ ph = new DockPlaceholder (this, false);
}
- this.Freeze ();
- if (this.IsCompound) {
- this.Foreach (new Gtk.Callback (HideItem));
+ Freeze ();
+ if (IsCompound) {
+ Foreach (new Callback (HideItem));
}
- this.Detach (true);
- this.Thaw ();
+ Detach (true);
+ Thaw ();
}
- public void HideItem (Gtk.Widget widget)
+ public void HideItem (Widget widget)
{
if (!(widget is DockItem))
return;
@@ -762,7 +768,7 @@
item.Freeze ();
if (item.IsCompound) {
- item.Foreach (new Gtk.Callback (HideItem));
+ item.Foreach (new Callback (HideItem));
}
item.Detach (true);
@@ -771,35 +777,35 @@
public void IconifyItem ()
{
- this.DockObjectFlags |= DockObjectFlags.Iconified;
- this.HideItem ();
+ DockObjectFlags |= DockObjectFlags.Iconified;
+ HideItem ();
}
public void ShowItem ()
{
- this.DockObjectFlags &= ~(DockObjectFlags.Iconified);
+ DockObjectFlags &= ~(DockObjectFlags.Iconified);
- if (this.ph != null) {
- this.ph.Add (this);
- this.ph = null;
- } else if (this.IsBound) {
- if (this.Master.Controller != null) {
- this.Master.Controller.Docking (this, DockPlacement.Floating, null);
+ if (ph != null) {
+ ph.Add (this);
+ ph = null;
+ } else if (IsBound) {
+ if (Master.Controller != null) {
+ Master.Controller.Docking (this, DockPlacement.Floating, null);
}
}
}
public virtual void SetDefaultPosition (DockObject reference)
{
- this.ph = null;
+ ph = null;
if (reference != null && reference.IsAttached) {
if (reference is DockPlaceholder) {
- this.ph = (DockPlaceholder)reference;
+ ph = (DockPlaceholder)reference;
} else {
- this.ph = new DockPlaceholder (reference, true);
+ ph = new DockPlaceholder (reference, true);
}
}
}
}
-}
\ No newline at end of file
+}
Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockItemGrip.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockItemGrip.cs 2004-06-09 18:30:01 UTC (rev 1724)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockItemGrip.cs 2004-06-09 18:43:47 UTC (rev 1725)
@@ -7,13 +7,13 @@
namespace Gdl
{
- public class DockItemGrip : Gtk.Container
+ public class DockItemGrip : Container
{
private DockItem item;
private Gdk.Window title_window;
- private Gtk.Button close_button;
- private Gtk.Button iconify_button;
- private Gtk.Tooltips tooltips;
+ private Button close_button;
+ private Button iconify_button;
+ private Tooltips tooltips;
private bool icon_pixbuf_valid = false;
private Gdk.Pixbuf icon_pixbuf = null;
private string title;
@@ -21,46 +21,46 @@
public DockItemGrip ()
{
- this.Flags |= (int)Gtk.WidgetFlags.NoWindow;
+ Flags |= (int)WidgetFlags.NoWindow;
Widget.PushCompositeChild ();
- this.close_button = new Gtk.Button ();
+ close_button = new Button ();
Widget.PopCompositeChild ();
- this.close_button.Flags &= ~(int)Gtk.WidgetFlags.CanFocus;
- this.close_button.Parent = this;
- this.close_button.Relief = Gtk.ReliefStyle.None;
- this.close_button.Show ();
+ close_button.Flags &= ~(int)WidgetFlags.CanFocus;
+ close_button.Parent = this;
+ close_button.Relief = ReliefStyle.None;
+ close_button.Show ();
- Gtk.Image image = new Gtk.Image (Gdl.Stock.Close, Gtk.IconSize.Menu);
- this.close_button.Add (image);
+ Image image = new Image (Gdl.Stock.Close, IconSize.Menu);
+ close_button.Add (image);
image.Show ();
- this.close_button.Clicked += new EventHandler (CloseClicked);
+ close_button.Clicked += new EventHandler (CloseClicked);
Widget.PushCompositeChild ();
- this.iconify_button = new Gtk.Button ();
+ iconify_button = new Button ();
Widget.PopCompositeChild ();
- this.iconify_button.Flags &= ~(int)(Gtk.WidgetFlags.CanFocus);
- this.iconify_button.Parent = this;
- this.iconify_button.Relief = Gtk.ReliefStyle.None;
- this.iconify_button.Show ();
+ iconify_button.Flags &= ~(int)(WidgetFlags.CanFocus);
+ iconify_button.Parent = this;
+ iconify_button.Relief = ReliefStyle.None;
+ iconify_button.Show ();
- image = new Gtk.Image (Gdl.Stock.MenuLeft, Gtk.IconSize.Menu);
- this.iconify_button.Add (image);
+ image = new Image (Gdl.Stock.MenuLeft, IconSize.Menu);
+ iconify_button.Add (image);
image.Show ();
- this.iconify_button.Clicked += new EventHandler (IconifyClicked);
+ iconify_button.Clicked += new EventHandler (IconifyClicked);
- this.tooltips = new Gtk.Tooltips ();
- this.tooltips.SetTip (this.iconify_button, "Iconify", "Iconify this dock");
- this.tooltips.SetTip (this.close_button, "Close", "Close this dock");
+ tooltips = new Tooltips ();
+ tooltips.SetTip (iconify_button, "Iconify", "Iconify this dock");
+ tooltips.SetTip (close_button, "Close", "Close this dock");
}
public DockItemGrip (DockItem item) : this ()
{
- this.Item = item;
+ Item = item;
}
public DockItem Item {
@@ -68,10 +68,10 @@
set {
//hookup notify stuff here
item = value;
- if (!(item.CantClose) && this.close_button != null)
- this.close_button.Show ();
- if (!(item.CantIconify) && this.iconify_button != null)
- this.iconify_button.Show ();
+ if (!(item.CantClose) && close_button != null)
+ close_button.Show ();
+ if (!(item.CantIconify) && iconify_button != null)
+ iconify_button.Show ();
}
}
@@ -83,64 +83,64 @@
public Gdk.Rectangle GetTitleArea ()
{
Gdk.Rectangle area;
- int border = (int)this.BorderWidth;
+ int border = (int)BorderWidth;
int alloc_height, alloc_width;
- area.Width = (this.Allocation.Width - 2 * border);
+ area.Width = (Allocation.Width - 2 * border);
title_layout.GetPixelSize (out alloc_width, out alloc_height);
- if (this.close_button.Visible) {
- alloc_height = Math.Max (alloc_height, this.close_button.Allocation.Height);
- area.Width -= this.close_button.Allocation.Width;
+ if (close_button.Visible) {
+ alloc_height = Math.Max (alloc_height, close_button.Allocation.Height);
+ area.Width -= close_button.Allocation.Width;
}
- if (this.iconify_button.Visible) {
- alloc_height = Math.Max (alloc_height, this.iconify_button.Allocation.Height);
- area.Width -= this.close_button.Allocation.Width;
+ if (iconify_button.Visible) {
+ alloc_height = Math.Max (alloc_height, iconify_button.Allocation.Height);
+ area.Width -= close_button.Allocation.Width;
}
- area.X = this.Allocation.X + border;
- area.Y = this.Allocation.Y + border;
+ area.X = Allocation.X + border;
+ area.Y = Allocation.Y + border;
area.Height = alloc_height;
- if (this.Direction == Gtk.TextDirection.Rtl)
- area.X += (this.Allocation.Width - 2 * border) - area.Width;
+ if (Direction == TextDirection.Rtl)
+ area.X += (Allocation.Width - 2 * border) - area.Width;
return area;
}
private void EnsureTitleAndIconPixbuf ()
{
- if (this.title == null) {
- this.title = this.item.LongName;
- if (this.title == null)
- this.title = "";
+ if (title == null) {
+ title = item.LongName;
+ if (title == null)
+ title = "";
}
- if (!this.icon_pixbuf_valid) {
- if (this.item.StockId != null) {
- this.icon_pixbuf = this.RenderIcon (this.item.StockId, Gtk.IconSize.Menu, "");
+ if (!icon_pixbuf_valid) {
+ if (item.StockId != null) {
+ icon_pixbuf = RenderIcon (item.StockId, IconSize.Menu, "");
}
- this.icon_pixbuf_valid = true;
+ icon_pixbuf_valid = true;
}
- if (this.title_layout == null) {
- this.title_layout = this.CreatePangoLayout (this.title);
- this.title_layout.SingleParagraphMode = true;
+ if (title_layout == null) {
+ title_layout = CreatePangoLayout (title);
+ title_layout.SingleParagraphMode = true;
}
}
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
- Gdk.Rectangle title_area = this.GetTitleArea ();
+ Gdk.Rectangle title_area = GetTitleArea ();
Gdk.Rectangle expose_area;
- if (this.icon_pixbuf != null) {
+ if (icon_pixbuf != null) {
Gdk.Rectangle pixbuf_rect;
- pixbuf_rect.Width = this.icon_pixbuf.Width;
- pixbuf_rect.Height = this.icon_pixbuf.Height;
+ pixbuf_rect.Width = icon_pixbuf.Width;
+ pixbuf_rect.Height = icon_pixbuf.Height;
- if (this.Direction == Gtk.TextDirection.Rtl) {
+ if (Direction == TextDirection.Rtl) {
pixbuf_rect.X = title_area.X + title_area.Width - pixbuf_rect.Width;
} else {
pixbuf_rect.X = title_area.X;
@@ -150,20 +150,20 @@
title_area.Width -= pixbuf_rect.Width - 1;
pixbuf_rect.Y = title_area.Y + (title_area.Height - pixbuf_rect.Height) / 2;
if (evnt.Area.Intersect (pixbuf_rect, out expose_area)) {
- Gdk.GC gc = this.Style.BackgroundGC (this.State);
- this.GdkWindow.DrawPixbuf (gc, this.icon_pixbuf, 0, 0, pixbuf_rect.X, pixbuf_rect.Y, pixbuf_rect.Width, pixbuf_rect.Height, Gdk.RgbDither.None, 0, 0);
+ Gdk.GC gc = Style.BackgroundGC (State);
+ GdkWindow.DrawPixbuf (gc, icon_pixbuf, 0, 0, pixbuf_rect.X, pixbuf_rect.Y, pixbuf_rect.Width, pixbuf_rect.Height, Gdk.RgbDither.None, 0, 0);
}
}
if (title_area.Intersect (evnt.Area, out expose_area)) {
int layout_width, layout_height, text_x, text_y;
- this.title_layout.GetPixelSize (out layout_width, out layout_height);
- if (this.Direction == Gtk.TextDirection.Rtl)
+ title_layout.GetPixelSize (out layout_width, out layout_height);
+ if (Direction == TextDirection.Rtl)
text_x = title_area.X + title_area.Width - layout_width;
else
text_x = title_area.X;
text_y = title_area.Y + (title_area.Height - layout_height) / 2;
- Gtk.Style.PaintLayout (this.Style, this.GdkWindow, this.State, true, expose_area, this, null, text_x, text_y, this.title_layout);
+ Style.PaintLayout (Style, GdkWindow, State, true, expose_area, this, null, text_x, text_y, title_layout);
}
return base.OnExposeEvent (evnt);
@@ -171,25 +171,25 @@
private void CloseClicked (object o, EventArgs e)
{
- this.item.HideItem ();
+ item.HideItem ();
}
private void IconifyClicked (object o, EventArgs e)
{
- this.item.IconifyItem ();
- this.iconify_button.InButton = false;
- this.iconify_button.Leave ();
+ item.IconifyItem ();
+ iconify_button.InButton = false;
+ iconify_button.Leave ();
}
protected override void OnRealized ()
{
base.OnRealized ();
- if (this.title_window == null) {
+ if (title_window == null) {
Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
- this.EnsureTitleAndIconPixbuf ();
+ EnsureTitleAndIconPixbuf ();
- Gdk.Rectangle area = this.GetTitleArea ();
+ Gdk.Rectangle area = GetTitleArea ();
attributes.X = area.X;
attributes.Y = area.Y;
@@ -198,19 +198,19 @@
attributes.WindowType = Gdk.WindowType.Temp;
attributes.Wclass = Gdk.WindowClass.InputOnly;
attributes.OverrideRedirect = true;
- attributes.EventMask = (int) (this.Events | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.ButtonMotionMask);
- this.title_window = new Gdk.Window (this.ParentWindow, attributes, (int) (Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Noredir));
- this.title_window.UserData = this.Handle;
- this.title_window.Cursor = new Gdk.Cursor (this.Display, Gdk.CursorType.Hand2);
+ attributes.EventMask = (int) (Events | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.ButtonMotionMask);
+ title_window = new Gdk.Window (ParentWindow, attributes, (int) (Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Noredir));
+ title_window.UserData = Handle;
+ title_window.Cursor = new Gdk.Cursor (Display, Gdk.CursorType.Hand2);
}
}
protected override void OnUnrealized ()
{
- if (this.title_window != null) {
- this.title_window.UserData = IntPtr.Zero;
- this.title_window.Destroy ();
- this.title_window = null;
+ if (title_window != null) {
+ title_window.UserData = IntPtr.Zero;
+ title_window.Destroy ();
+ title_window = null;
}
base.OnUnrealized ();
}
@@ -218,69 +218,71 @@
protected override void OnMapped ()
{
base.OnMapped ();
- if (this.title_window != null) {
- this.title_window.Show ();
+ if (title_window != null) {
+ title_window.Show ();
}
}
protected override void OnUnmapped ()
{
- if (this.title_window != null) {
- this.title_window.Hide ();
+ if (title_window != null) {
+ title_window.Hide ();
}
base.OnUnmapped ();
}
- protected override void OnSizeRequested (ref Gtk.Requisition requisition)
+ protected override void OnSizeRequested (ref Requisition requisition)
{
- requisition.Width = (int)this.BorderWidth * 2;
- requisition.Height = (int)this.BorderWidth * 2;
+ requisition.Width = (int)BorderWidth * 2;
+ requisition.Height = (int)BorderWidth * 2;
+
+ EnsureTitleAndIconPixbuf ();
- this.EnsureTitleAndIconPixbuf ();
+ if (close_button.Visible) {
+ Requisition childReq = close_button.SizeRequest ();
+ requisition.Width += childReq.Width;
+ requisition.Height = Math.Max (requisition.Height,
+ childReq.Height);
+ }
- int layout_height, layout_width;
- this.title_layout.GetPixelSize (out layout_height, out layout_width);
+ if (iconify_button.Visible) {
+ Requisition childReq = iconify_button.SizeRequest ();
+ requisition.Width += childReq.Width;
+ requisition.Height = Math.Max (requisition.Height,
+ childReq.Height);
+ }
- if (this.close_button.Visible) {
- Gtk.Requisition child_req = this.close_button.SizeRequest ();
- requisition.Width += child_req.Width;
- layout_height = Math.Max (layout_height, child_req.Height);
+ if (icon_pixbuf != null) {
+ requisition.Width += icon_pixbuf.Width + 1;
+ requisition.Height = Math.Max (requisition.Height,
+ icon_pixbuf.Height);
}
- if (this.iconify_button.Visible) {
- Gtk.Requisition child_req = this.iconify_button.SizeRequest ();
- requisition.Width += child_req.Width;
- layout_height = Math.Max (layout_height, child_req.Height);
- }
- requisition.Height += layout_height;
- if (this.icon_pixbuf != null) {
- requisition.Width += this.icon_pixbuf.Width + 1;
- }
}
private void EllipsizeLayout (int width)
{
if (width <= 0) {
- this.title_layout.SetText ("");
+ title_layout.SetText ("");
return;
}
int w, h, ell_w, ell_h, x, empty;
- this.title_layout.GetPixelSize (out w, out h);
+ title_layout.GetPixelSize (out w, out h);
if (w <= width) return;
- Pango.Layout ell = this.title_layout.Copy ();
+ Pango.Layout ell = title_layout.Copy ();
ell.SetText ("...");
ell.GetPixelSize (out ell_w, out ell_h);
if (width < ell_w) {
- this.title_layout.SetText ("");
+ title_layout.SetText ("");
return;
}
width -= ell_w;
- Pango.LayoutLine line = this.title_layout.GetLine (0);
- string text = this.title_layout.Text;
+ Pango.LayoutLine line = title_layout.GetLine (0);
+ string text = title_layout.Text;
if (line.XToIndex (width * 1024, out x, out empty)) {
- this.title_layout.SetText (text.Substring (0, x) + "...");
+ title_layout.SetText (text.Substring (0, x) + "...");
}
}
@@ -289,58 +291,58 @@
base.OnSizeAllocated (allocation);
Gdk.Rectangle child_allocation;
- if (this.Direction == Gtk.TextDirection.Rtl)
- child_allocation.X = allocation.X + (int)this.BorderWidth;
+ if (Direction == TextDirection.Rtl)
+ child_allocation.X = allocation.X + (int)BorderWidth;
else
- child_allocation.X = allocation.X + allocation.Width - (int)this.BorderWidth;
- child_allocation.Y = allocation.Y + (int)this.BorderWidth;
+ child_allocation.X = allocation.X + allocation.Width - (int)BorderWidth;
+ child_allocation.Y = allocation.Y + (int)BorderWidth;
- if (this.close_button.Visible) {
- Gtk.Requisition button_requisition = this.close_button.SizeRequest ();
- if (this.Direction != Gtk.TextDirection.Rtl)
+ if (close_button.Visible) {
+ Requisition button_requisition = close_button.SizeRequest ();
+ if (Direction != TextDirection.Rtl)
child_allocation.X -= button_requisition.Width;
child_allocation.Width = button_requisition.Width;
child_allocation.Height = button_requisition.Height;
- this.close_button.SizeAllocate (child_allocation);
+ close_button.SizeAllocate (child_allocation);
- if (this.Direction == Gtk.TextDirection.Rtl)
+ if (Direction == TextDirection.Rtl)
child_allocation.X += button_requisition.Width;
}
- if (this.iconify_button.Visible) {
- Gtk.Requisition button_requisition = this.iconify_button.SizeRequest ();
- if (this.Direction != Gtk.TextDirection.Rtl)
+ if (iconify_button.Visible) {
+ Requisition button_requisition = iconify_button.SizeRequest ();
+ if (Direction != TextDirection.Rtl)
child_allocation.X -= button_requisition.Width;
child_allocation.Width = button_requisition.Width;
child_allocation.Height = button_requisition.Height;
- this.iconify_button.SizeAllocate (child_allocation);
+ iconify_button.SizeAllocate (child_allocation);
- if (this.Direction == Gtk.TextDirection.Rtl)
+ if (Direction == TextDirection.Rtl)
child_allocation.X += button_requisition.Width;
}
- if (this.title_window != null) {
- this.EnsureTitleAndIconPixbuf ();
- this.title_layout.SetText (this.title);
- Gdk.Rectangle area = this.GetTitleArea ();
- this.title_window.MoveResize (area.X, area.Y, area.Width, area.Height);
- if (this.icon_pixbuf != null) {
- area.Width -= this.icon_pixbuf.Width + 1;
+ if (title_window != null) {
+ EnsureTitleAndIconPixbuf ();
+ title_layout.SetText (title);
+ Gdk.Rectangle area = GetTitleArea ();
+ title_window.MoveResize (area.X, area.Y, area.Width, area.Height);
+ if (icon_pixbuf != null) {
+ area.Width -= icon_pixbuf.Width + 1;
}
- this.EllipsizeLayout (area.Width);
+ EllipsizeLayout (area.Width);
}
}
- protected override void OnAdded (Gtk.Widget widget)
+ protected override void OnAdded (Widget widget)
{
Console.WriteLine ("You can't add a widget to DockItemGrip directly");
}
- protected override void OnRemoved (Gtk.Widget widget)
+ protected override void OnRemoved (Widget widget)
{
Console.WriteLine ("You can't remove a widget from DockItemGrip directly");
}
@@ -348,9 +350,9 @@
protected override void ForAll (bool include_internals, CallbackInvoker invoker)
{
if (include_internals) {
- invoker.Invoke (this.close_button);
- invoker.Invoke (this.iconify_button);
+ invoker.Invoke (close_button);
+ invoker.Invoke (iconify_button);
}
}
}
-}
\ No newline at end of file
+}
Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs 2004-06-09 18:30:01 UTC (rev 1724)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs 2004-06-09 18:43:47 UTC (rev 1725)
@@ -8,9 +8,10 @@
//FIXME: Event emitting doesnt happen, and it needs to.
namespace Gdl
{
- public class DockObject : Gtk.Container
+ public class DockObject : Container
{
- private Gdl.DockObjectFlags flags;
+ private Container container;
+ private DockObjectFlags flags;
private int freeze_count;
private DockMaster master;
private string name;
@@ -37,16 +38,16 @@
get { return master; }
set {
if (value != null)
- this.Bind (master);
+ Bind (master);
else
- this.Unbind ();
+ Unbind ();
}
}
protected override void OnShown ()
{
- if (this.IsCompound) {
- foreach (Gtk.Widget child in this.Children) {
+ if (IsCompound) {
+ foreach (Widget child in Children) {
child.Show ();
}
}
@@ -55,8 +56,8 @@
protected override void OnHidden ()
{
- if (this.IsCompound) {
- foreach (Gtk.Widget child in this.Children) {
+ if (IsCompound) {
+ foreach (Widget child in Children) {
child.Hide ();
}
}
@@ -66,16 +67,16 @@
public virtual void Detach (bool recursive)
{
//Detach children
- if (recursive && this.IsCompound) {
- foreach (DockObject child in this.Children) {
+ if (recursive && IsCompound) {
+ foreach (DockObject child in Children) {
child.Detach (recursive);
}
}
//Detach object itself.
- this.flags &= ~(DockObjectFlags.Attached);
- DockObject parent = this.ParentObject;
- if (this.Parent != null && this.Parent is Gtk.Container) {
- ((Gtk.Container)this.Parent).Remove (this);
+ flags &= ~(DockObjectFlags.Attached);
+ DockObject parent = ParentObject;
+ if (Parent != null && Parent is Container) {
+ ((Container)Parent).Remove (this);
}
if (parent != null)
parent.Reduce ();
@@ -84,27 +85,27 @@
public virtual void Reduce ()
{
- if (!this.IsCompound)
+ if (!IsCompound)
return;
- Gdl.DockObject parent = this.ParentObject;
- Gtk.Widget[] children = this.Children;
+ DockObject parent = ParentObject;
+ Widget[] children = Children;
if (children.Length <= 1) {
if (parent != null)
parent.Freeze ();
- this.Freeze ();
- this.Detach (false);
- foreach (Gtk.Widget widget in children) {
- Gdl.DockObject child = widget as Gdl.DockObject;
+ Freeze ();
+ Detach (false);
+ foreach (Widget widget in children) {
+ DockObject child = widget as DockObject;
if (child == null) continue;
- child.flags |= Gdl.DockObjectFlags.InReflow;
+ child.flags |= DockObjectFlags.InReflow;
child.Detach (false);
if (parent != null)
parent.Add (child);
- child.flags &= ~(Gdl.DockObjectFlags.InReflow);
+ child.flags &= ~(DockObjectFlags.InReflow);
}
reduce_pending = false;
- this.Thaw ();
+ Thaw ();
if (parent != null)
parent.Thaw ();
}
@@ -115,40 +116,40 @@
return false;
}
- public virtual void Docking (Gdl.DockObject requestor, DockPlacement position, object other_data)
+ public virtual void Docking (DockObject requestor, DockPlacement position, object other_data)
{
- Gdl.DockObject parent;
+ DockObject parent;
if (requestor == null)
return;
if (requestor == this)
return;
- if (this.master == null) {
+ if (master == null) {
Console.WriteLine ("Dock operation requested in a non-bound object.");
Console.WriteLine ("This might break.");
}
if (!requestor.IsBound)
- requestor.Bind (this.master);
- if (requestor.Master != this.master) {
+ requestor.Bind (master);
+ if (requestor.Master != master) {
Console.WriteLine ("Cannot complete dock as they belong to different masters.");
return;
}
//Attempt to optimize the placement with reordering (heh)
if (position != DockPlacement.None) {
- if (this.Reorder (requestor, position, other_data) || (this.ParentObject != null && this.ParentObject.Reorder (requestor, position, other_data)))
+ if (Reorder (requestor, position, other_data) || (ParentObject != null && ParentObject.Reorder (requestor, position, other_data)))
return;
}
- this.Freeze ();
+ Freeze ();
if (requestor.IsAttached)
requestor.Detach (false);
- if (position != Gdl.DockPlacement.None) {
+ if (position != DockPlacement.None) {
/*FIXME: port this code:
g_signal_emit (object, gdl_dock_object_signals [DOCK], 0,
requestor, position, other_data);
*/
}
- this.Thaw ();
+ Thaw ();
}
public virtual bool Reorder (DockObject child, DockPlacement new_position, object other_data)
@@ -158,7 +159,7 @@
public virtual void Present (DockObject child)
{
- this.Show ();
+ Show ();
}
public virtual bool ChildPlacement (DockObject child, ref DockPlacement placement)
@@ -174,7 +175,7 @@
public DockObject ParentObject {
get {
- Widget parent = this.Parent;
+ Widget parent = Parent;
while (parent != null && !(parent is DockObject)) {
parent = parent.Parent;
}
@@ -184,19 +185,19 @@
public bool IsAttached {
get {
- return ((this.flags & Gdl.DockObjectFlags.Attached) != 0);
+ return ((flags & DockObjectFlags.Attached) != 0);
}
}
public bool IsAutomatic {
get {
- return ((this.flags & Gdl.DockObjectFlags.Automatic) != 0);
+ return ((flags & DockObjectFlags.Automatic) != 0);
}
}
public bool InReflow {
get {
- return ((this.flags & Gdl.DockObjectFlags.InReflow) != 0);
+ return ((flags & DockObjectFlags.InReflow) != 0);
}
}
@@ -210,7 +211,7 @@
freeze_count--;
if (freeze_count == 0 && reduce_pending) {
reduce_pending = false;
- this.Reduce ();
+ Reduce ();
}
}
@@ -218,24 +219,24 @@
{
if (_master == null)
return;
- if (this.master == _master)
+ if (master == _master)
return;
- if (this.master != null) {
+ if (master != null) {
Console.WriteLine ("Attempt to bind an already bound object");
return;
}
_master.Add (this);
- this.master = _master;
+ master = _master;
//g_object_notify (G_OBJECT (object) /*this*/, "master");
}
public void Unbind ()
{
- if (this.IsAttached)
- this.Detach (true);
- if (this.master != null) {
- DockMaster _master = this.master;
- this.master = null;
+ if (IsAttached)
+ Detach (true);
+ if (master != null) {
+ DockMaster _master = master;
+ master = null;
_master.Remove (this);
//g_object_notify (G_OBJECT (object) /*this*/, "master");
}
@@ -243,13 +244,13 @@
public bool IsBound {
get {
- return this.master != null;
+ return master != null;
}
}
public DockObjectFlags DockObjectFlags {
- get { return this.flags; }
- set { this.flags = value; }
+ get { return flags; }
+ set { flags = value; }
}
}
}
Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs 2004-06-09 18:30:01 UTC (rev 1724)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs 2004-06-09 18:43:47 UTC (rev 1725)
@@ -5,11 +5,11 @@
namespace Gdl
{
- public class DockPaned : Gdl.DockItem
+ public class DockPaned : DockItem
{
private bool position_changed = false;
- public DockPaned (Gtk.Orientation orientation)
+ public DockPaned (Orientation orientation)
{
CreateChild (orientation);
}
@@ -24,55 +24,55 @@
public int Position {
get {
- if (this.Child != null && this.Child is Gtk.Paned) {
- return ((Gtk.Paned)this.Child).Position;
+ if (Child != null && Child is Paned) {
+ return ((Paned)Child).Position;
}
return 0;
}
set {
- if (this.Child != null && this.Child is Gtk.Paned) {
- ((Gtk.Paned)this.Child).Position = value;
+ if (Child != null && Child is Paned) {
+ ((Paned)Child).Position = value;
}
}
}
- private void CreateChild (Gtk.Orientation orientation)
+ private void CreateChild (Orientation orientation)
{
- if (this.Child != null)
- this.Child.Unparent ();
+ Console.WriteLine ("DockPaned.CreateChild");
+ if (Child != null)
+ Child.Unparent ();
- if (orientation == Gtk.Orientation.Horizontal)
- this.Child = new Gtk.HPaned ();
+ if (orientation == Orientation.Horizontal)
+ Child = new HPaned ();
else
- this.Child = new Gtk.VPaned ();
+ Child = new VPaned ();
//Signal connects?
- this.Child.Parent = this;
- this.Child.Show ();
+ Child.Parent = this;
+ Child.Show ();
}
- protected override void OnAdded (Gtk.Widget widget)
+ protected override void OnAdded (Widget widget)
{
- DockItem item = widget as Gdl.DockItem;
- if (item == null)
+ if (widget == null)
return;
Gtk.Paned paned = (Gtk.Paned)this.Child;
if (paned.Child1 != null && paned.Child2 != null) {
return;
}
- DockPlacement pos = DockPlacement.None;
-
+ DockItem item = widget as DockItem;
+ DockPlacement pos = DockPlacement.None;
if (paned.Child1 == null)
pos = (this.Orientation == Gtk.Orientation.Horizontal ? DockPlacement.Left : DockPlacement.Top);
else
pos = (this.Orientation == Gtk.Orientation.Horizontal ? DockPlacement.Right : DockPlacement.Bottom);
if (pos != DockPlacement.None)
- this.Docking (item, pos, null);
+ Docking (item, pos, null);
}
- private void childForAll (Gtk.Widget widget)
+ private void childForAll (Widget widget)
{
stored_invoker.Invoke (widget);
}
@@ -83,18 +83,20 @@
if (include_internals) {
base.ForAll (include_internals, invoker);
} else {
- if (this.Child != null) {
+ if (Child != null) {
stored_invoker = invoker;
- ((Gtk.Paned)this.Child).Foreach (new Gtk.Callback (childForAll));
+ ((Paned)Child).Foreach (new Callback (childForAll));
}
}
}
public override void Docking (DockObject requestor, DockPlacement position, object other_data)
{
- if (this.Child == null)
+ Console.WriteLine ("DockPaned.Docking");
+
+ if (Child == null)
return;
- Gtk.Paned paned = (Gtk.Paned)this.Child;
+ Paned paned = (Paned)Child;
bool hresize = false;
bool wresize = false;
bool done = false;
@@ -104,8 +106,8 @@
wresize = ((DockItem)requestor).PreferredWidth == -2 ? true : false;
}
- switch (this.Orientation) {
- case Gtk.Orientation.Horizontal:
+ switch (Orientation) {
+ case Orientation.Horizontal:
if (paned.Child1 == null && position == DockPlacement.Left) {
paned.Pack1 (requestor, wresize, false);
done = true;
@@ -114,7 +116,7 @@
done = true;
}
break;
- case Gtk.Orientation.Vertical:
+ case Orientation.Vertical:
if (paned.Child1 == null && position == DockPlacement.Top) {
paned.Pack1 (requestor, hresize, false);
done = true;
@@ -124,6 +126,7 @@
}
break;
}
+ Console.WriteLine ("DONE: {0}", done);
if (!done) {
base.Docking (requestor, position, other_data);
} else {
Modified: trunk/MonoDevelop/src/Libraries/Gdl/GdlDockTest.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/GdlDockTest.cs 2004-06-09 18:30:01 UTC (rev 1724)
+++ trunk/MonoDevelop/src/Libraries/Gdl/GdlDockTest.cs 2004-06-09 18:43:47 UTC (rev 1725)
@@ -27,14 +27,14 @@
//DockLayout layout = new DockLayout (dock);
DockItem di = new DockItem ("item1", "Item #1", Gtk.Stock.Execute, DockItemBehavior.Normal);
- di.Add (new Label ("test"));
+ di.Add (new Button ("test"));
dock.AddItem (di, DockPlacement.Center);
DockItem di2 = new DockItem ("item2", "Item #2", DockItemBehavior.Normal);
di2.Add (new Label ("test2"));
dock.AddItem (di2, DockPlacement.Center);
- DockItem di3 = new DockItem ("item3", "Item #3", DockItemBehavior.Normal);
+ /*DockItem di3 = new DockItem ("item3", "Item #3", DockItemBehavior.Normal);
di3.Add (new Label ("test3"));
dock.AddItem (di3, DockPlacement.Top);
More information about the Monodevelop-patches-list
mailing list