FDOSTUI
FreeDOS Text User Interface
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Attributes | Private Member Functions | List of all members
wmhelper Class Reference

window manager helper class More...

#include <wmhelper.hpp>

Public Member Functions

 wmhelper ()
 constructor More...
 
virtual ~wmhelper ()
 destructor More...
 
enum event_response event_key (struct event_key const &i_event)
 handle key event More...
 
enum event_response event_key (window *const i_window, struct event_key const &i_event)
 handle key event More...
 
enum event_response event_mouse (struct event_mouse const &i_event)
 handle mouse event More...
 
enum event_response event_mouse (window *const i_window, struct event_mouse const &i_event)
 handle mouse event More...
 
void close ()
 closes the window More...
 
void maximize ()
 maximizes the window More...
 
void minimize ()
 minimizes the window More...
 
bool capture () const
 gets whether or not the window is in capture mode More...
 
void capture_resize ()
 sets capture state to ::CAPTURE_KEYBOARD and event state to ::EVENT_RESIZE More...
 
void capture_move ()
 sets capture state to ::CAPTURE_KEYBOARD and event state to ::EVENT_MOVE More...
 

Static Public Member Functions

static void draw_decorate (struct box const &i_box, enum window::attributes const i_attr, unsigned char const *i_title)
 adorns a rectangular area More...
 
static void draw_frame (struct box const &i_box, struct skin_frame const &i_skin, enum foreground const i_fcolor, enum background const i_bcolor)
 draw a rectangular frame More...
 
static void draw_title (unsigned char const *i_title, struct box const &i_box)
 draw title on the window More...
 

Static Public Attributes

static unsigned int const MIN_WIDTH = 6
 
static unsigned int const MIN_HEIGHT = 2
 

Protected Types

enum  wm_event { EVENT_NONE, EVENT_RESIZE, EVENT_MOVE }
 current event state More...
 
enum  wm_capture { CAPTURE_NONE, CAPTURE_MOUSE, CAPTURE_KEYBOARD }
 capture state More...
 

Protected Attributes

windowm_window
 
unsigned int m_mouse_x
 
unsigned int m_mouse_y
 
enum wm_event m_event
 
enum wm_capture m_capture
 

Private Member Functions

 wmhelper (const wmhelper &)
 
wmhelperoperator= (wmhelper const &)
 
void event_system_menu ()
 pop-up the system menu More...
 

Detailed Description

window manager helper class

This class should be a singleon. However, it is assumed that only one instance will be instantiated, and that is in the window manager.

The class wraps up a window and takes control of specific events that can occur. These events include the system menu, minimize or maximize buttons, and moving or resizing the widget.

Member Enumeration Documentation

◆ wm_capture

enum wmhelper::wm_capture
protected

capture state

Enumerator
CAPTURE_NONE 

clear state

CAPTURE_MOUSE 

mouse capture state

CAPTURE_KEYBOARD 

keyboard capture state

◆ wm_event

enum wmhelper::wm_event
protected

current event state

Enumerator
EVENT_NONE 

clear state

EVENT_RESIZE 

resize state

EVENT_MOVE 

move state

Constructor & Destructor Documentation

◆ wmhelper()

wmhelper::wmhelper ( )

constructor

Returns
none

◆ ~wmhelper()

wmhelper::~wmhelper ( )
virtual

destructor

Returns
none

Member Function Documentation

◆ capture()

bool wmhelper::capture ( ) const
inline

gets whether or not the window is in capture mode

Returns
true capture is on
false capture is off

◆ capture_move()

void wmhelper::capture_move ( )
inline

sets capture state to ::CAPTURE_KEYBOARD and event state to ::EVENT_MOVE

Returns
none

◆ capture_resize()

void wmhelper::capture_resize ( )
inline

sets capture state to ::CAPTURE_KEYBOARD and event state to ::EVENT_RESIZE

Returns
none

◆ close()

void wmhelper::close ( )

closes the window

Returns
none

◆ draw_decorate()

void wmhelper::draw_decorate ( struct box const &  i_box,
enum window::attributes const  i_attr,
unsigned char const *  i_title 
)
static

adorns a rectangular area

Parameters
[in]i_boxrectangular region to paint
[in]i_attrdrawing attributes
[in]i_titleoptional title
Returns
none

Coordinates are relative to the screen. Clipping is not in affect.

This method will draw a frame, and depending on the attributes, it will draw a title, system button, minimize and maximize buttons and a resize button.

◆ draw_frame()

void wmhelper::draw_frame ( struct box const &  i_box,
struct skin_frame const &  i_skin,
enum foreground const  i_fcolor,
enum background const  i_bcolor 
)
static

draw a rectangular frame

Parameters
[in]i_boxrectangular region to paint
[in]i_skinhow to draw the frame
[in]i_fcolorforeground color
[in]i_bcolorbackground color
Returns
none

◆ draw_title()

void wmhelper::draw_title ( unsigned char const *  i_title,
struct box const &  i_box 
)
static

draw title on the window

Parameters
[in]i_titlevalid title to draw
[in]i_boxrectangular region
Returns
none

◆ event_key() [1/2]

enum event_response wmhelper::event_key ( struct event_key const &  i_event)

handle key event

Parameters
[in]i_eventkey event to handle
Returns
response how event was handled

◆ event_key() [2/2]

enum event_response wmhelper::event_key ( window *const  i_window,
struct event_key const &  i_event 
)

handle key event

Parameters
[in]i_windowwindow that will receive events
[in]i_eventkey event to handle
Returns
RESPONSE_NONE

Currently, this method does nothing. In the future, it may be used to activate the system menu with a key combination.

◆ event_mouse() [1/2]

enum event_response wmhelper::event_mouse ( window *const  i_window,
struct event_mouse const &  i_event 
)

handle mouse event

Parameters
[in]i_windowwindow to receive events
[in]i_eventmouse event to handle
Returns
response

◆ event_mouse() [2/2]

enum event_response wmhelper::event_mouse ( struct event_mouse const &  i_event)

handle mouse event

Parameters
[in]i_eventmouse event to handle
Returns
response how event was handled

◆ event_system_menu()

void wmhelper::event_system_menu ( )
private

pop-up the system menu

Returns
none

◆ maximize()

void wmhelper::maximize ( )

maximizes the window

Returns
none

◆ minimize()

void wmhelper::minimize ( )

minimizes the window

Returns
none

Member Data Documentation

◆ m_capture

wmhelper::m_capture
protected

capture state

◆ m_event

wmhelper::m_event
protected

event state

◆ m_mouse_x

wmhelper::m_mouse_x
protected

previous mouse x position

◆ m_mouse_y

wmhelper::m_mouse_y
protected

previous mouse y position

◆ m_window

wmhelper::m_window
protected

reference to window being manipulated

◆ MIN_HEIGHT

unsigned int const wmhelper::MIN_HEIGHT = 2
static

minimum height of a window widget

◆ MIN_WIDTH

unsigned int const wmhelper::MIN_WIDTH = 6
static

minimum width of a window widget


The documentation for this class was generated from the following files: