FDOSTUI
FreeDOS Text User Interface
|
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 | |
window * | m_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 &) | |
wmhelper & | operator= (wmhelper const &) |
void | event_system_menu () |
pop-up the system menu More... | |
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.
|
protected |
|
protected |
wmhelper::wmhelper | ( | ) |
constructor
|
virtual |
destructor
|
inline |
gets whether or not the window is in capture mode
|
inline |
sets capture state to ::CAPTURE_KEYBOARD and event state to ::EVENT_MOVE
|
inline |
sets capture state to ::CAPTURE_KEYBOARD and event state to ::EVENT_RESIZE
void wmhelper::close | ( | ) |
closes the window
|
static |
adorns a rectangular area
[in] | i_box | rectangular region to paint |
[in] | i_attr | drawing attributes |
[in] | i_title | optional title |
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.
|
static |
draw a rectangular frame
[in] | i_box | rectangular region to paint |
[in] | i_skin | how to draw the frame |
[in] | i_fcolor | foreground color |
[in] | i_bcolor | background color |
|
static |
draw title on the window
[in] | i_title | valid title to draw |
[in] | i_box | rectangular region |
enum event_response wmhelper::event_key | ( | struct event_key const & | i_event | ) |
handle key event
[in] | i_event | key event to handle |
enum event_response wmhelper::event_key | ( | window *const | i_window, |
struct event_key const & | i_event | ||
) |
handle key event
[in] | i_window | window that will receive events |
[in] | i_event | key event to handle |
Currently, this method does nothing. In the future, it may be used to activate the system menu with a key combination.
enum event_response wmhelper::event_mouse | ( | window *const | i_window, |
struct event_mouse const & | i_event | ||
) |
handle mouse event
[in] | i_window | window to receive events |
[in] | i_event | mouse event to handle |
enum event_response wmhelper::event_mouse | ( | struct event_mouse const & | i_event | ) |
handle mouse event
[in] | i_event | mouse event to handle |
|
private |
pop-up the system menu
void wmhelper::maximize | ( | ) |
maximizes the window
void wmhelper::minimize | ( | ) |
minimizes the window
|
protected |
capture state
|
protected |
event state
|
protected |
previous mouse x position
|
protected |
previous mouse y position
|
protected |
reference to window being manipulated
|
static |
minimum height of a window widget
|
static |
minimum width of a window widget