2 \section{Class and object hierarchies}
5 While Ion does not not have a truly object-oriented design
6 \footnote{the author doesn't like such artificial designs},
7 things that appear on the computer screen are, however, quite
8 naturally expressed as such ''objects''. Therefore Ion implements
9 a rather primitive OO system for these screen objects and some
12 It is essential for the module writer to learn this object
13 system, but also people who write their own binding configuration files
14 necessarily come into contact with the class and object hierarchies
15 -- you need to know which binding setup routines apply where,
16 and what functions can be used as handlers in which bindings.
17 It is the purpose of this section to attempt to explain these
18 hierarchies. If you do not wish the read the full section, at least
19 read the summary at the end of it, so that you understand the very
22 For simplicity we consider only the essential-for-basic-configuration
23 Ioncore, \file{mod\_tiling} and \file{mod\_query} classes.
24 See Appendix \ref{app:fullhierarchy} for the full class hierachy visible
27 \subsection{Class hierarchy}
29 One of the most important principles of object-oriented design methodology
30 is inheritance; roughly how classes (objects are instances of classes)
31 extend on others' features. Inheritance gives rise to class hierarchy.
32 In the case of single-inheritance this hierarchy can be expressed as a
33 tree where the class at the root is inherited by all others below it
34 and so on. Figure \ref{fig:classhierarchy} lists out the Ion class
35 hierarchy and below we explain what features of Ion the classes
40 \docode % latex2html kludge
51 | | |-->WInput (mod_query)
52 | | |-->WEdln (mod_query)
53 | | |-->WMessage (mod_query)
57 | |-->WTiling (mod_tiling)
58 |-->WSplit (mod_tiling)
60 \caption{Partial Ioncore, \file{mod\_tiling} and \file{mod\_query}
62 \label{fig:classhierarchy}
68 \item[\type{Obj}]\indextype{Obj}
69 Is the base of Ion's object system.
71 \item[\type{WRegion}]\indextype{WRegion}
72 is the base class for everything corresponding to something on the
73 screen. Each object of type \type{WRegion} has a size and position
74 relative to the parent \type{WRegion}. While a big part of Ion
75 operates on these instead of more specialised classes, \type{WRegion}
76 is a ''virtual'' base class in that there are no objects of ''pure''
77 type \type{WRegion}; all concrete regions are objects of some class
78 that inherits \type{WRegion}.
80 \item[\type{WClientWin}]\indextype{WClientWin} is a class for
81 client window objects, the objects that window managers are
84 \item[\type{WWindow}]\indextype{WWindow} is the base class for all
85 internal objects having an X window associated to them
86 (\type{WClientWins} also have X windows associated to them).
88 \item[\type{WRootWin}]\indextype{WRootWin} is the class for
89 root windows\index{root window} of X screens\index{screen!X}.
90 Note that an ''X screen'' or root window is not necessarily a
91 single physical screen\index{screen!physical} as a root window
92 may be split over multiple screens when multi-head extensions
93 such as Xinerama\index{Xinerama} are used. (Actually there
94 can be only one \type{WRootWin} when Xinerama is used.)
96 \item[\type{WMPlex}] is a base class for all regions that''multiplex''
97 other regions. This means that of the regions managed by the multiplexer,
98 only one can be displayed at a time. Classes that inhereit \type{WMPlex}
99 include screens and frames.
101 \item[\type{WScreen}]\indextype{WScreen} is the class for objects
102 corresponding to physical screens. Screens may share a root
103 window when Xinerama multihead extensions are used as explained
106 \item[\type{WFrame}]\indextype{WFrame} is the class for frames.
107 While most Ion's objects have no graphical presentation, frames basically
108 add to \type{WMPlex}es the decorations around client windows
111 \item[\type{WGroup}]\indextype{WGroup} is the base class for groups.
112 Particular types of groups are workspaces
113 (\type{WGroupWS}\indextype{WGroupWS})
114 and groups of client windows
115 (\type{WGroupCW}\indextype{WGroupCW}).
119 Classes implemented by the \file{mod\_tiling} module:
122 \item[\type{WTiling}]\indextype{WTiling} is the class for tilings
124 \item[\type{WSplit}]\indextype{WSplit} (or, more specifically, classes
125 that inherit it) encode the \type{WTiling} tree structure.
129 Classes implemented by the \file{mod\_query} module:
132 \item[\type{WInput}]\indextype{WInput} is a virtual base class for the
134 \item[\type{WEdln}]\indextype{WEdln} is the class for the ''queries'',
135 the text inputs that usually appear at bottoms of frames and sometimes
136 screens. Queries are the functional equivalent of ''mini buffers'' in
138 \item[\type{WMessage}]\indextype{WMessage} implements the boxes for
139 warning and other messages that Ion may wish to display to the user.
140 These also usually appear at bottoms of frames.
143 There are also some other ''proxy'' classes that do not refer
144 to objects on the screen. The only important one of these for
145 basic configuration is \type{WMoveresMode} that is used for
146 binding callbacks in the move and resize mode.
149 \subsection{Object hierarchies: \type{WRegion} parents and managers}
151 \subsubsection{Parent--child relations}
152 Each object of type \type{WRegion} has a parent and possibly a manager
153 associated to it. The parent\index{parent} for an object is always a
154 \type{WWindow} and for \type{WRegion} with an X window (\type{WClientWin},
155 \type{WWindow}) the parent \type{WWindow} is given by the same relation of
156 the X windows. For other \type{WRegion}s the relation is not as clear.
157 There is generally very few restrictions other than the above on the
158 parent---child relation but the most common is as described in
159 Figure \ref{fig:parentship}.
163 \docode % latex2html kludge
170 |-->WClientWins in full screen mode
174 |-->WFrames for transients
175 |-->a possible WEdln or WMessage
177 \caption{Most common parent--child relations}
178 \label{fig:parentship}
181 \type{WRegion}s have very little control over their children as a parent.
182 The manager\index{manager} \type{WRegion} has much more control over its
183 managed \type{WRegion}s. Managers, for example, handle resize requests,
184 focusing and displaying of the managed regions. Indeed the manager---managed
185 relationship gives a better picture of the logical ordering of objects on
186 the screen. Again, there are generally few limits, but the most common
187 hierarchy is given in Figure \ref{fig:managership}. Note that sometimes
188 the parent and manager are the same object and not all objects may have
189 a manager (e.g. the dock in the dock module at the time of writing this)
190 but all have a parent--a screen if not anything else.
192 \subsubsection{Manager--managed relations}
196 \docode % latex2html kludge
201 |-->WGroupCWs for full screen WClientWins
203 | |-->WFrames for transients (dialogs)
205 |-->WGroupWSs for workspaces
207 | | |-->possibly a WEdln, WMessage or WMenu
209 | | |-->WGroupCWs (with contents as above)
210 | |-->WFrames for floating content
211 |-->WFrames for sticky stuff, such as the scratchpad
213 \caption{Most common manager--managed relations}
214 \label{fig:managership}
217 Note that a workspace can manage another workspace. This can be
218 achieved with the \fnref{attach_new} function, and allows you to nest
219 workspaces as deep as you want.
221 %Note how the \type{WClientWin}s managed by \type{WFloatFrame}s don't have
222 %transients managed by them. This is because WFloatWSs choose to handle
223 %transients differently (transients are put in separate frames like normal
228 In the standard setup, keeping queries, messages and menus out of
232 \item The top-level objects that matter are screens and they correspond
233 to physical screens. The class for screens is \type{WScreen}.
234 \item Screens contain (multiplex) groups (\type{WGroup}) and other
235 objects, such as \type{WFrames}. Some of these are mutually exclusive
236 to be viewed at a time.
237 \item Groups of the specific kind \type{WGroupWS} often contain a
238 \type{WTiling} tiling for tiling frames (\type{WFrame}), but
239 groups may also directly contain floating frames.
240 \item Frames are the objects with decorations such as tabs and borders.
241 Frames contain (multiplex) among others (groups of) client windows,
242 to each of which corresponds a tab in the frame's decoration. Only
243 one client window (or other object) can be shown at a time in each
244 frame. The class for client windows is \type{WClientWin}.