1WinBorder class : public Layer
2##############################
3
4WinBorder objects provide window management functionality and ensure
5that the border for each window is drawn.
6
7Member Functions
8================
9
10WinBorder(BRect r, const char \*name, int32 resize, int32 flags, ServerWindow \*win)
11------------------------------------------------------------------------------------
12
131. Pass parameters to Layer constructor
142. Instantiate a decorator
153. Initialize visible and full regions via Decorator::GetFootprint()
16
17~WinBorder(void)
18----------------
19
201. Delete decorator instance
21
22void RequestDraw(void)
23----------------------
24
25Reimplements Layer::RequestDraw() because it has no corresponding BView
26
271. if IsDirty()==false, return
282. Iterate through each BRect in the invalid region and call Decorator::Draw(BRect) for each invalid rectangle
293. Perform recursive child calls as in Layer::RequestDraw()
30
31void MoveBy(BPoint pt), void MoveBy(float x, float y)
32-----------------------------------------------------
33
34Moves the WinBorder's position on screen - reimplements Layer::MoveBy()
35
361. Call the decorator's MoveBy()
372. Call Layer::MoveBy()
38
39void ResizeBy(BPoint pt), void ResizeBy(float x, float y)
40---------------------------------------------------------
41
42Resizes the WinBorder - reimplements Layer::MoveBy()
43
441. Call the decorator's ResizeBy()
452. Call Layer::ResizeBy()
46
47void MouseDown(int8 \*buffer)
48-----------------------------
49
50Figures out what to do with B_MOUSE_DOWN messages sent to the window's border.
51
521. Extract data from the buffer
532. Call the decorator's Clicked() function
543. Feed return value to a switch() function (table below)
554. Call the ServerWindow's Activate() function
56
57+-----------------------------------+-----------------------------------+
58| CLICK_MOVETOBACK                  | call MoveToBack()                 |
59+-----------------------------------+-----------------------------------+
60| CLICK_MOVETOFRONT                 | call MoveToFront()                |
61+-----------------------------------+-----------------------------------+
62| CLICK_CLOSE                       | 1) call SetCloseButton(true)      |
63|                                   |                                   |
64|                                   | 2) call decorator->DrawClose      |
65+-----------------------------------+-----------------------------------+
66| CLICK_ZOOM                        | 1) call SetZoomButton(true)       |
67|                                   |                                   |
68|                                   | 2) call decorator->DrawZoom       |
69+-----------------------------------+-----------------------------------+
70| CLICK_MINIMIZE                    | 1) call SetMinimizeButton(true)   |
71|                                   |                                   |
72|                                   | 2) call decorator->DrawMinimize   |
73+-----------------------------------+-----------------------------------+
74| CLICK_DRAG                        | 1) call MoveToFront()             |
75|                                   |                                   |
76|                                   | 2) call set_is_win_moving(true)   |
77|                                   |                                   |
78|                                   | 3) Save the mouse position        |
79+-----------------------------------+-----------------------------------+
80| CLICK_RESIZE                      | 1) call MoveToFront()             |
81|                                   |                                   |
82|                                   | 2) call set_is_win_resizing(true) |
83+-----------------------------------+-----------------------------------+
84| CLICK_NONE                        | do nothing                        |
85+-----------------------------------+-----------------------------------+
86| default:                          | Spew an error to stderr and       |
87|                                   | return                            |
88+-----------------------------------+-----------------------------------+
89
90void MouseUp(int8 \*buffer)
91---------------------------
92
93Figures out what to do with B_MOUSE_UP messages sent to the window's border.
94
951. Extract data from the buffer
962. Call the decorator's Clicked() function
973. Feed return value to a switch() function (table below)
984. if is_resizing_window, call set_is_resizing_window(false)
995. if is_moving_window, call set_is_moving_window(false)
100
101+-----------------------------------+-----------------------------------+
102| CLICK_MOVETOBACK                  | call MoveToBack()                 |
103+-----------------------------------+-----------------------------------+
104| CLICK_MOVETOFRONT                 | call MoveToFront()                |
105+-----------------------------------+-----------------------------------+
106| CLICK_CLOSE                       | 1) call SetCloseButton(false)     |
107|                                   |                                   |
108|                                   | 2) call decorator->DrawClose      |
109|                                   |                                   |
110|                                   | 3) send B_QUIT_REQUESTED to the   |
111|                                   | target BWindow                    |
112+-----------------------------------+-----------------------------------+
113| CLICK_ZOOM                        | 1) call SetZoomButton(false)      |
114|                                   |                                   |
115|                                   | 2) call decorator->DrawZoom       |
116|                                   |                                   |
117|                                   | 3) send B_ZOOM to the target      |
118|                                   | BWindow                           |
119+-----------------------------------+-----------------------------------+
120| CLICK_MINIMIZE                    | 1) call SetMinimizeButton(false)  |
121|                                   |                                   |
122|                                   | 2) call decorator->DrawMinimize   |
123|                                   |                                   |
124|                                   | 3) send B_MINIMIZE to the target  |
125|                                   | BWindow                           |
126+-----------------------------------+-----------------------------------+
127| CLICK_DRAG                        | call set_is_win_moving(false)     |
128+-----------------------------------+-----------------------------------+
129| CLICK_RESIZE                      | call set_is_win_resizing(false)   |
130+-----------------------------------+-----------------------------------+
131| CLICK_NONE                        | do nothing                        |
132+-----------------------------------+-----------------------------------+
133| default:                          | Spew an error to stderr           |
134+-----------------------------------+-----------------------------------+
135
136void MouseMoved(int8 \*buffer)
137------------------------------
138
139Figures out what to do with B_MOUSE_MOVED messages sent to the window's border.
140
1411. Extract data from the buffer
1422. Call the decorator's Clicked() function
1433. If not CLICK_CLOSE and decorator->GetClose is true, call SetClose(false) and DrawClose()
1444. If not CLICK_ZOOM and decorator->GetZoom is true, call SetZoom(false) and DrawZoom()
1455. If not CLICK_MINIMIZE and decorator->GetMinimize is true, call SetMinimize(false) and DrawMinimize()
1466. if CLICK_RESIZE or its variants, call CursorManager::SetCursor() with the appropriate system cursor.
1477. if is_moving_window() is true, calculate the amount the mouse has moved and call decorator->MoveBy() followed by Layer::MoveBy()
1488. if is_resizing_window() is true, calculate the amount the mouse has moved and call decorator->ResizeBy() followed by Layer::ResizeBy()
149
150void UpdateDecorator(void)
151--------------------------
152
153Hook function called by the WinBorder's ServerWindow when the decorator used is changed.
154
1551. Delete the current decorator
1562. Call instantiate_decorator
1573. Get the new decorator's footprint region and assign it to the full and visible regions
1584. Call RebuildRegions and then RequestDraw
159
160void UpdateColors(void)
161-----------------------
162
163Hook function called by the WinBorder's ServerWindow when system colors change
164
1651. Call the decorator's SetColors(), passing the SystemPalette's GetGUIColors() value
166
167void UpdateFont(void)
168---------------------
169
170Hook function called by the WinBorder's ServerWindow when system fonts change
171
172| TODO: implementation details
173
174void UpdateScreen(void)
175-----------------------
176
177Hook function called by the WinBorder's ServerWindow when screen
178attributes change
179
1801. Call the decorator's UpdateScreen and then RequestDraw
181
182void RebuildRegions(bool recursive=true)
183----------------------------------------
184
185Reimplementation of Layer::RebuildRegions which changes it such that
186lower siblings are clipped to the footprint instead of the frame.
187
188void Activate(bool state)
189-------------------------
190
191This function is never directly called except from within
192set_active_winborder. It exists to force redraw and set the internal
193state information to the proper values for when a window receives or
194loses focus.
195
1961. call the decorator's SetFocus(state)
1972. set the internal is_active flag to state
1983. iterate through each rectangle in the visible region and call the decorator's Draw on it.
199
200Global Functions
201================
202
203
204bool is_moving_window(void), void set_is_moving_window(bool state)
205------------------------------------------------------------------
206
207
208These two functions set and return the variable
209winborder_private::is_moving_a_window.
210
211
212bool is_resizing_window(void), void set_is_resizing_window(bool state)
213----------------------------------------------------------------------
214
215
216These two functions set and return the variable
217winborder_private::is_resizing_a_window.
218
219
220void set_active_winborder(WinBorder \*win), WinBorder \* get_active_winborder(void)
221-----------------------------------------------------------------------------------
222
223
224These two functions set and return the variable winborder_private::active_winborder
225
226Namespaces
227==========
228
229.. code-block:: cpp
230
231    winborder_private {
232        bool is_moving_a_window
233        bool is_resizing_a_window
234        WinBorder *active_winborder
235    }
236
237