WinBorder class : public Layer¶
WinBorder objects provide window management functionality and ensure that the border for each window is drawn.
Member Functions¶
WinBorder(BRect r, const char *name, int32 resize, int32 flags, ServerWindow *win)¶
Pass parameters to Layer constructor
Instantiate a decorator
Initialize visible and full regions via Decorator::GetFootprint()
~WinBorder(void)¶
Delete decorator instance
void RequestDraw(void)¶
Reimplements Layer::RequestDraw() because it has no corresponding BView
if IsDirty()==false, return
Iterate through each BRect in the invalid region and call Decorator::Draw(BRect) for each invalid rectangle
Perform recursive child calls as in Layer::RequestDraw()
void MoveBy(BPoint pt), void MoveBy(float x, float y)¶
Moves the WinBorder’s position on screen - reimplements Layer::MoveBy()
Call the decorator’s MoveBy()
Call Layer::MoveBy()
void ResizeBy(BPoint pt), void ResizeBy(float x, float y)¶
Resizes the WinBorder - reimplements Layer::MoveBy()
Call the decorator’s ResizeBy()
Call Layer::ResizeBy()
void MouseDown(int8 *buffer)¶
Figures out what to do with B_MOUSE_DOWN messages sent to the window’s border.
Extract data from the buffer
Call the decorator’s Clicked() function
Feed return value to a switch() function (table below)
Call the ServerWindow’s Activate() function
CLICK_MOVETOBACK |
call MoveToBack() |
CLICK_MOVETOFRONT |
call MoveToFront() |
CLICK_CLOSE |
|
CLICK_ZOOM |
|
CLICK_MINIMIZE |
|
CLICK_DRAG |
|
CLICK_RESIZE |
|
CLICK_NONE |
do nothing |
default: |
Spew an error to stderr and return |
void MouseUp(int8 *buffer)¶
Figures out what to do with B_MOUSE_UP messages sent to the window’s border.
Extract data from the buffer
Call the decorator’s Clicked() function
Feed return value to a switch() function (table below)
if is_resizing_window, call set_is_resizing_window(false)
if is_moving_window, call set_is_moving_window(false)
CLICK_MOVETOBACK |
call MoveToBack() |
CLICK_MOVETOFRONT |
call MoveToFront() |
CLICK_CLOSE |
3) send B_QUIT_REQUESTED to the target BWindow |
CLICK_ZOOM |
3) send B_ZOOM to the target BWindow |
CLICK_MINIMIZE |
3) send B_MINIMIZE to the target BWindow |
CLICK_DRAG |
call set_is_win_moving(false) |
CLICK_RESIZE |
call set_is_win_resizing(false) |
CLICK_NONE |
do nothing |
default: |
Spew an error to stderr |
void MouseMoved(int8 *buffer)¶
Figures out what to do with B_MOUSE_MOVED messages sent to the window’s border.
Extract data from the buffer
Call the decorator’s Clicked() function
If not CLICK_CLOSE and decorator->GetClose is true, call SetClose(false) and DrawClose()
If not CLICK_ZOOM and decorator->GetZoom is true, call SetZoom(false) and DrawZoom()
If not CLICK_MINIMIZE and decorator->GetMinimize is true, call SetMinimize(false) and DrawMinimize()
if CLICK_RESIZE or its variants, call CursorManager::SetCursor() with the appropriate system cursor.
if is_moving_window() is true, calculate the amount the mouse has moved and call decorator->MoveBy() followed by Layer::MoveBy()
if is_resizing_window() is true, calculate the amount the mouse has moved and call decorator->ResizeBy() followed by Layer::ResizeBy()
void UpdateDecorator(void)¶
Hook function called by the WinBorder’s ServerWindow when the decorator used is changed.
Delete the current decorator
Call instantiate_decorator
Get the new decorator’s footprint region and assign it to the full and visible regions
Call RebuildRegions and then RequestDraw
void UpdateColors(void)¶
Hook function called by the WinBorder’s ServerWindow when system colors change
Call the decorator’s SetColors(), passing the SystemPalette’s GetGUIColors() value
void UpdateFont(void)¶
Hook function called by the WinBorder’s ServerWindow when system fonts change
void UpdateScreen(void)¶
Hook function called by the WinBorder’s ServerWindow when screen attributes change
Call the decorator’s UpdateScreen and then RequestDraw
void RebuildRegions(bool recursive=true)¶
Reimplementation of Layer::RebuildRegions which changes it such that lower siblings are clipped to the footprint instead of the frame.
void Activate(bool state)¶
This function is never directly called except from within set_active_winborder. It exists to force redraw and set the internal state information to the proper values for when a window receives or loses focus.
call the decorator’s SetFocus(state)
set the internal is_active flag to state
iterate through each rectangle in the visible region and call the decorator’s Draw on it.
Global Functions¶
bool is_moving_window(void), void set_is_moving_window(bool state)¶
These two functions set and return the variable winborder_private::is_moving_a_window.
bool is_resizing_window(void), void set_is_resizing_window(bool state)¶
These two functions set and return the variable winborder_private::is_resizing_a_window.
void set_active_winborder(WinBorder *win), WinBorder * get_active_winborder(void)¶
These two functions set and return the variable winborder_private::active_winborder
Namespaces¶
winborder_private {
bool is_moving_a_window
bool is_resizing_a_window
WinBorder *active_winborder
}