README 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. This file is meant to contain a little documentation about the GdlDock
  2. and related widgets. It's incomplete and probably a bit out of date.
  3. For the original C version -
  4. Please send comments to the devtools list (gnome-devtools@gnome.org)
  5. and report bugs to bugzilla (bugzilla.gnome.org). Also check the todo
  6. list at the end of this document.
  7. For the C# version -
  8. Please send comments to monodevelop-list@lists.ximian.com
  9. and report bugs to bugzilla (bugzilla.ximian.com) under monodevelop.
  10. Have fun,
  11. Gustavo
  12. Overview
  13. --------
  14. The GdlDock is a hierarchical based docking widget. It is composed of
  15. widgets derived from the abstract class GdlDockObject which defines
  16. the basic interface for docking widgets on top of others.
  17. The toplevel entries for docks are GdlDock widgets, which in turn hold
  18. a tree of GdlDockItem widgets. For the toplevel docks to be able to
  19. interact with each other (when the user drags items from one place to
  20. another) they're all kept in a user-invisible and automatic object
  21. called the master. To participate in docking operations every
  22. GdlDockObject must have the same master (the binding to the master is
  23. done automatically). The master also keeps track of the manual items
  24. (mostly those created with gdl_dock_*_new functions) which are in the
  25. dock.
  26. Layout loading/saving service is provided by a separate object called
  27. GdlDockLayout. Currently it stores information in XML format, but
  28. another backend could be easily written. To keep the external XML
  29. file in sync with the dock, monitor the "dirty" property of the layout
  30. object and call gdl_dock_layout_save_to_file when this changes to
  31. TRUE. No other action is required (the layout_changed is monitored by
  32. the layout object for you now).
  33. GdlDockObject
  34. =============
  35. A DockObject has:
  36. - a master, which manages all the objects in a dock ring ("master"
  37. property, construct only).
  38. - a name. If the object is manual the name can be used to recall the
  39. object from any other object in the ring ("name" property).
  40. - a long, descriptive name ("long_name" property).
  41. A DockObject can be:
  42. - automatic or manual. If it's automatic it means the lifecycle of
  43. the object is entirely managed by the dock master. If it's manual
  44. in general means the user specified such object, and so it's not to
  45. be destroyed automatically at any time.
  46. - frozen. In this case any call to reduce on the object has no
  47. immediate effect. When the object is later thawn, any pending
  48. reduce calls are made (maybe leading to the destruction of the
  49. object).
  50. - attached or detached. In general for dock items, being attached
  51. will mean the item has its widget->parent set. For docks it will
  52. mean they belong to some dock master's ring. In general, automatic
  53. objects which are detached will be destroyed (unless frozen).
  54. - bound to a master or free. In order to participate in dock
  55. operations, each dock object must be bound to a dock master (which
  56. is a separate, non-gui object). In general, bindings are treated
  57. automatically by the object, and this is entirely true for automatic
  58. objects. For manual objects, the master holds an additional
  59. reference and has structures to store and recall them by nick names.
  60. Normally, a manual object will only be destroyed when it's unbound
  61. from the master.
  62. - simple or compound. This actually depends on the subclass of the
  63. dock object. The difference is made so we can put restrictions in
  64. how the objects are docked on top of another (e.g. you can't dock a
  65. compound object inside a notebook). If you look at the whole
  66. docking layout as a tree, simple objects are the leaves, while all
  67. the interior nodes are compound.
  68. - reduced. This is only meaningful for compound objects. If the
  69. number of contained items has decreased to one the compound type
  70. object is no longer necessary to hold the child. In this case the
  71. child is reattached to the object's parent. If the number of
  72. contained items has reached zero, the object is detached and reduce
  73. is called on its parent. For toplevel docks, the object is only
  74. detached if it's automatic. In any case, the future of the object
  75. itself depends on whether it's automatic or manual.
  76. - requested to possibly dock another object. Depending on the
  77. type's behavior, the object can accept or reject this request. If
  78. it accepts it, it should fill in some additional information
  79. regarding how it will host the peer object.
  80. - asked to dock another object. Depending on the object's internal
  81. structure and behavior two options can be taken: to dock the object
  82. directly (e.g. a notebook docking another object); or to create an
  83. automatic compound object which will be attached in place of the
  84. actual object, and will host both the original object and the
  85. requestor (e.g. a simple item docking another simple item, which
  86. should create a paned/notebook). The type of the new object will be
  87. decided by the original objet based on the docking position.
  88. DETACHING: the action by which an object is unparented. The object is
  89. then ready to be docked in some other place. Newly created objects
  90. are always detached, except for toplevels (which are created attached
  91. by default). An automatic object which is detached gets destroyed
  92. afterwards, since its ref count drops to zero. Floating automatic
  93. toplevels never reach a zero ref count when detached, since the
  94. GtkWindow always keeps a reference to it (and the GtkWindow has a user
  95. reference). That's why floating automatic toplevels are destroyed
  96. when reduced.
  97. REDUCING: for compound objects, when the number of contained children
  98. drops to one or zero, the container is no longer necessary. In this
  99. case, the object is detached, and any remaining child is reattached to
  100. the object's former parent. The limit for toplevels is one for
  101. automatic objects and zero for manual (i.e. they can even be empty).
  102. For simple (not compound) objects reducing doesn't make sense.
  103. UNBINDING: to participate in a dock ring, every object must be bound
  104. to a master. The master connects to dock item signals and keeps a
  105. list of bound toplevels. Additionally, a reference is kept for manual
  106. objects (this is so the user doesn't need to keep track of them, but
  107. can perform operations like hiding and such).
  108. GdlDock
  109. =======
  110. - Properties:
  111. "floating" (gboolean, construct-only): whether the dock is floating in
  112. its own window or not.
  113. "default_title" (gchar, read-write): title for new floating docks.
  114. This property is proxied to the master, which truly holds it.
  115. The title for the floating docks is: the user supplied title
  116. (GdlDockObject's long_name property) if it's set, the default title
  117. (from the master) or an automatically generated title.
  118. - Signals:
  119. "layout_changed": emitted when the user changed the layout of the
  120. dock somehow.
  121. TODO LIST
  122. =========
  123. - Functionality for the item grip: provide a11y
  124. - Implement notebook tab reordering
  125. - Implement dock bands for toolbars and menus.
  126. - A dock-related thing is to build resizable toolbars (something like
  127. the ones Windows have, where the buttons are reflowed according to
  128. the space available).
  129. - Redesign paneds so they can hold more than two items and resize all
  130. of them at once by using the handle (see if gimpdock does that).
  131. - Find a way to allow the merging of menu items to the item's popup
  132. menu. Also, there should be a way for the master to insert some
  133. menu items.
  134. - Bonobo UI synchronizer.
  135. - Item behavoirs: implement the ones missing and maybe think more of
  136. them (e.g. positions where it's possible to dock the item, etc.)
  137. - Make a nicer dragbar for the items, with buttons for undocking,
  138. closing, hidding, etc. (See sodipodi, kdevelop)