MQWidgetBase class

(new in Rev4.00)

MQWidgetBase is a base class for all widgets such as a button, a check box, a window and so on. The following classes inherit a MQWidgetBase class.

Name Description
MQWindowBase A base class for a window and a dialog
 |- MQWindow Window
 |- MQDialog Dialog
 |- MQPopup Popup
MQFrameBase A base class for frames
 |- MQFrame Frame
 |- MQGroupBox Group box
MQScrollBox Scroll area
MQTab Switch multiple pages
MQButton Button
MQCheckBox Check box
MQRadioButton Radio button
MQComboBox Combo box
MQListBox List box
MQCheckListBox Check list box
MQTreeListBox Tree list box
MQLabel Display a text
MQEdit Input a text
MQMemo Input multiple text lines
MQSpinBox Input an integer
MQDoubleSpinBox Input a real number
MQSlider Slider
MQProgressBar Progress bar
MQScrollBar Scroll bar
MQColorPanel Color panel
MQPaintBox Paint box
MQMenuItem Menu item

You can use as a class library by adding MQWidget.cpp and MQWidget.h to your project.

Class
MQWidgetBase Constructor
~MQWidgetBase Destructor
Member functions
GetID Get a widget ID
AddChild Add a child widget
InsertChild Insert a child widget
RemoveChild Remove a child widget
GetIndexOfChild Get an index of a child widget
GetName Get a name
SetName Set a name
GetTag Get an arbitrary value
SetTag Set an arbitrary value
GetEnabled Get an enabling status
SetEnabled Set an enabling status
GetVisible Get a visibility
SetVisible Set a visibility
GetHorzLayout Get a horizontal layout status
SetHorzLayout Set a horizontal layout status
GetVertLayout Get a vertical layout status
SetVertLayout Set a vertical layout status
GetWidth Get a width
SetWidth Set a width
GetHeight Get a height
SetHeight Set a height
GetFillRateX Get a filling rate in the width
SetFillRateX Set a filling rate in the width
GetFillRateY Get a filling rate in the height
SetFillRateY Set a filling rate in the height
GetFillBeforeRate Get a filling rate for a forward space
SetFillBeforeRate Set a filling rate for a forward space
GetFillAfterRate Get a filling rate for a backward space
SetFillAfterRate Set a filling rate for a backward space
GetInSpace Get spaces between child widgets
SetInSpace Set spaces between child widgets
GetOutSpace Get a space outside all children
SetOutSpace Set a space outside all children
GetHintSizeRateX Get a hint size for a width
SetHintSizeRateX Set a hint size for a width
GetHintSizeRateY Get a hint size for a height
SetHintSizeRateY Set a hint size for a height
GetCellColumn Get a number of columns of a cell
SetCellColumn Set a number of columns of a cell
GetHintText Get a hint text
SetHintText Set a hint text
SetCursor Set a mouse cursor for a widget
GetJustSize Get a size to contain all child widgets.
ClientToScreen Convert client coordinate to screen
ScreenToClient Convert screen coordinate to client
ClientToClient Convert client coordinate to other client
Repaint Repaint
RefreshPaint Apply a repainting reservation
CaptureMouse Capture a mouse operation
CanReceiveMouseEvent Whether mouse events can be received
Static functions
FindWidgetByID Find a widget by ID
GetSystemWidgetID Get a widget ID for a system widget
GetBaseRateSize Get a widget size by a rate of a base size
GetDefaultBackColor Get a default background color
GetDefaultFrameColor Get a default frame color
GetDefaultTextColor Get a default text color
GetDefaultTitleBackColor Get a default title background color
GetDefaultTitleTextColor Get a default title text color
GetDefaultListBackColor Get a default list background color
GetDefaultListTextColor Get a default list text color
GetDefaultListActiveColor Get a default list active color
GetDefaultListActiveTextColor Get a default list active text color
GetDefaultEditBackColor Get a default edit background color
GetDefaultEditTextColor Get a default edit text color
GetDefaultEditSelectionColor Get a default edit selection color
GetDefaultEditSelectionTextColor Get a default edit selection text color
RegisterSubCommandButton Register a button for a sub command
EnterEventLoop Enter an event loop
ExitEventLoop Exit an event loop
CanReceiveTextFromClipboard Check a clipboard text
GetKeyState Get a key state
Events
AddShowEvent Add an event for showing a widget
AddHideEvent Add an event for hiding a widget
AddMoveEvent Add an event for moving a widget
AddResizeEvent Add an event for resizing a widget
AddLeftDownEvent Add an event for pushing a left button
AddLeftUpEvent Add an event for releasing a left button
AddLeftDoubleClickEvent Add an event for double-clicking a left button
AddMiddleDownEvent Add an event for pushing a middle button
AddMiddleUpEvent Add an event for releasing a middle button
AddMiddleDoubleClickEvent Add an event for double-clicking a middle button
AddRightDownEvent Add an event for pushing a right button
AddRightUpEvent Add an event for releasing a right button
AddRightDoubleClickEvent Add an event for double-clicking a right button
AddMouseMoveEvent Add an event for moving a mouse cursor
AddMouseWheelEvent Add an event for rotating a mouse wheel
AddMouseEnterEvent Add an event for a mouse cursor entering a widget area
AddMouseLeaveEvent Add an event for a mouse cursor leaving a widget area
AddKeyDownEvent Add an event for pushing a key
AddKeyUpEvent Add an event for releasing a key
AddTimerEvent Add an event for a timer

MQWidgetBase::MQWidgetBase();

MQWidgetBase::MQWidgetBase(int id);

id
A widget id created outside the plug-in

It is a constructor.


virtual MQWidgetBase::~MQWidgetBase();

It is a destructor. It is declared as a virtual function.


int MQWidgetBase::GetID();

Return value
A widget ID

It returns a widget ID.


int MQWidgetBase::AddChild(MQWidgetBase *child);

child
A child widget
Return value
An index of the child widget

It adds the specified widget as a child.

The added child widget will be deleted together when this parent widget is deleted.

child must not be a window or a dialog. Please refer MQWindowBase::AddChildWindow() to add a child window.


int MQWidgetBase::InsertChild(MQWidgetBase *child, int index);

child
A child widget
index
An index of a child widget
Return value
An index of the child widget

(new in Rev4.59)

It inserts the specified widget at the specified index as a child.

The inserteded child widget will be deleted together when this parent widget is deleted.

child must not be a window or a dialog. Please refer MQWindowBase::AddChildWindow() to add a child window.


void MQWidgetBase::RemoveChild(MQWidgetBase *child);

child
A child widget

It separates the child widget from this widget.

The separated widget is not deleted automatically. Please delete it manually after separating.


int MQWidgetBase::GetIndexOfChild(MQWidgetBase *child);

child
A child widget
Return value
An index of the child widget

(new in Rev4.59)

It returns an index of the child widget.


std::wstring MQWidgetBase::GetName();

Return value
A name

(new in Rev4.50)

It returns a widget's name.


void MQWidgetBase::SetName(const std::wstring& value);

value
A name

(new in Rev4.50)

It specifies a widget's name.

It cannot rename for the named widget.


__int64 MQWidgetBase::GetTag();

Return value
An arbitrary value

(new in Rev4.50)

It returns an arbitrary value specified to the widget.


void MQWidgetBase::SetTag(__int64 value);

value
An arbitrary value

(new in Rev4.50)

It specifies an arbitrary value to the widget.

You can use an arbitrary value for an index, ID and so on to distinguish widgets.


bool MQWidgetBase::GetEnabled();

Return value
An enabling status

It returns whether the widget is enabled or disabled.

It is necessary to check the enabling status of the parent widget if the messages are actually notified to this widget.


void MQWidgetBase::SetEnabled(bool value);

value
An enabling status

It specifies the widget is enabled or disabled.

Mouse and keyboard messages are not notified to disabled widgets and the child widgets.


bool MQWidgetBase::GetVisible();

Return value
An visibility of a widget

It returns the widget is visible or invisible.


void MQWidgetBase::SetVisible(bool value);

value
An visibility of a widget

It specifies the widget is visible or invisible.


LAYOUT_TYPE MQWidgetBase::GetHorzLayout();

Return value
A layout status
[LAYOUT_AUTO] Automatically
[LAYOUT_FIXED] Set a width in pixels
[LAYOUT_HINTSIZE] Set a width by a hint size
[LAYOUT_FILL] Fill the whole width
[LAYOUT_FREE] Specify a position and a size manually

It returns how to determine a width.


void MQWidgetBase::SetHorzLayout(LAYOUT_TYPE value);

value
A layout status
[LAYOUT_AUTO] Automatically
[LAYOUT_FIXED] Set a width in pixels
[LAYOUT_HINTSIZE] Set a width by a hint size
[LAYOUT_FILL] Fill the whole width
[LAYOUT_FREE] Specify a position and a size manually

It specifies how to determine a width.


LAYOUT_TYPE MQWidgetBase::GetVertLayout();

Return value
A layout status
[LAYOUT_AUTO] Automatically
[LAYOUT_FIXED] Set a height in pixels
[LAYOUT_HINTSIZE] Set a height by a hint size
[LAYOUT_FILL] Fill the whole height
[LAYOUT_FREE] Specify a position and a size manually

It returns how to determine a height.


void MQWidgetBase::SetVertLayout(LAYOUT_TYPE value);

value
A layout status
[LAYOUT_AUTO] Automatically
[LAYOUT_FIXED] Set a height in pixels
[LAYOUT_HINTSIZE] Set a height by a hint size
[LAYOUT_FILL] Fill the whole height
[LAYOUT_FREE] Specify a position and a size manually

It specifies how to determine a height.


int MQWidgetBase::GetWidth();

Return value
A width in pixels

It returns the width in pixels.


void MQWidgetBase::SetWidth(int value);

value
A width in pixels

It specifies the width in pixels.。

This functions is deprecated unless the fixed pixel size is necessary. Please use SetHintSizeRateX() as possible.


int MQWidgetBase::GetHeight();

Return value
A height in pixels

It returns the height in pixels.


void MQWidgetBase::SetHeight(int value);

value
A height in pixels

It specifies the height in pixels.。

This functions is deprecated unless the fixed pixel size is necessary. Please use SetHintSizeRateY() as possible.


double MQWidgetBase::GetFillRateX();

Return value
A filling rate in the width

It returns a filling rate in the width when widgets in the same parent widget have LAYOUT_FILL flags for SetHorzLayout().

A width of the widget is determined by the rate for sum of each widget's filing rate.

The default value is 1.


void MQWidgetBase::SetFillRateX(double value);

value
A filling rate in the width

It specifies a filling rate in the width when widgets in the same parent widget have LAYOUT_FILL flags for SetHorzLayout().

A width of the widget is determined by the rate for sum of each widget's filing rate.

The default value is 1.


double MQWidgetBase::GetFillRateY();

Return value
A filling rate in the height

It returns a filling rate in the width when widgets in the same parent widget have LAYOUT_FILL flags for SetVertLayout() .

A height of the widget is determined by the rate for sum of each widget's filing rate.

The default value is 1.


void MQWidgetBase::SetFillRateY(double value);

value
A filling rate in the height

It specifies a filling rate in the width when widgets in the same parent widget have LAYOUT_FILL flags for SetVertLayout() .

A height of the widget is determined by the rate for sum of each widget's filing rate.

The default value is 1.


double MQWidgetBase::GetFillBeforeRate();

Return value
A filling rate for a forward space

It returns a filling rate for a forward space of the widget.

A size of the forward space is determined by the rate for sum of each widget's filing rate.


void MQWidgetBase::SetFillBeforeRate(double value);

value
A filling rate for a forward space

It specifies a filling rate for a forward space of the widget.

A size of the forward space is determined by the rate for sum of each widget's filing rate.


double MQWidgetBase::GetFillAfterRate();

Return value
A filling rate for a backward space

It returns a filling rate for a backward space of the widget.

A size of the backward space is determined by the rate for sum of each widget's filing rate.


void MQWidgetBase::SetFillAfterRate(double value);

value
A filling rate for a backward space

It specifies a filling rate for a backward space of the widget.

A size of the backward space is determined by the rate for sum of each widget's filing rate.


double MQWidgetBase::GetInSpace();

Return value
A space between child widgets (in the ratio to the base size)

It returns a space between two child widgets in the ratio to the base size.


void MQWidgetBase::SetInSpace(double value);

value
A space between child widgets (in the ratio to the base size)

It specify a space between two child widgets in the ratio to the base size.


double MQWidgetBase::GetOutSpace();

Return value
A space outside all child widgets (in the ratio to the base size)

It returns a space outside all child widgets in the ratio to the base size.


void MQWidgetBase::SetOutSpace(double value);

value
A space outside all child widgets (in the ratio to the base size)

It specifies a space outside all child widgets in the ratio to the base size.


double MQWidgetBase::GetHintSizeRateX();

Return value
A hint size for a width

It returns a normal width in the ratio to the base size.


void MQWidgetBase::SetHintSizeRateX(double value);

value
A hint size for a width

It specifies a normal width in the ratio to the base size.

A width of the widget is determined by a hint size when the LAYOUT_HINTSIZE flag is specified for SetHorzLayout(). The hint size is just a hint, and a determined size will be changed by a type of a widget and specified parameters.


double MQWidgetBase::GetHintSizeRateY();

Return value
A hint size for a height

It returns a normal height in the ratio to the base size.


void MQWidgetBase::SetHintSizeRateY(double value);

value
A hint size for a height

It specifies a normal height in the ratio to the base size.

A height of the widget is determined by a hint size when the LAYOUT_HINTSIZE flag is specified for SetVertLayout(). The hint size is just a hint, and a determined size will be changed by a type of a widget and specified parameters.


int MQWidgetBase::GetCellColumn();

Return value
A number of columns of a cell in a matrix frame

(new in Rev4.23)

It returns a number of columns of a cell in a matrix frame by MQFrameBase::SetMatrixColumn().


void MQWidgetBase::SetCellColumn(int value);

value
A number of columns of a cell in a matrix frame

(new in Rev4.23)

It specifies a number of columns of a cell in a matrix frame by MQFrameBase::SetMatrixColumn().


std::wstring MQWidgetBase::GetHintText();

Return value
A hint text

(new in Rev4.30)

It returns a text displayed at the time that a mouse cursor is on a widget.


void MQWidgetBase::SetHintText(const std::wstring& value);

value
A hint text

(new in Rev4.30)

It specifies a text displayed at the time that a mouse cursor is on a widget.


void MQWidgetBase::SetCursor(HCURSOR cursor);

cursor
A cursor handle

(new in Rev4.60)

It changes a mouse cursor for a widget.

Please specify a cursor that is obtained by GetResourceCursor() or is a resource cursor obtained by LoadCursor() of Win32-API with the DLL instance. The operation is not ensured when a predefined cursor obtained by LoadCursor() with the NULL instance is specified.

Please call MQCommandPlugin::SetMouseCursor() if you want to change a cursor for 3D views.

Please call MQBasePlugin::SetScreenMouseCursor() if you want to change a cursor for a screen.



POINT MQWidgetBase::GetJustSize(int max_width = -1, int max_height = -1);

max_width
Maximum width of a widget
max_height
Maximum height of a widget
Return value
A widget size

It returns a size to contain all child widget.

The size will be calculated without an upper limit when -1 is specified for max_width or max_height.


bool MQWidgetBase::ClientToScreen(int client_x, int client_y, int *screen_x, int *screen_y);

client_x
X coordinate on client
client_y
Y coordinate on client
screen_x
X coordinate on screen (out)
screen_y
Y coordinate on screen (out)
Return value
Succeeded or failed

It converts a client coordinate to a screen coordinate.


bool MQWidgetBase::ScreenToClient(int screen_x, int screen_y, int *client_x, int *client_y);

screen_x
X coordinate on screen
screen_y
Y coordinate on screen
client_x
X coordinate on client (out)
client_y
Y coordinate on client (out)
Return value
Succeeded or failed

It converts a screen coordinate to a client coordinate.


bool MQWidgetBase::ClientToClient(int client_x, int client_y, MQWidgetBase *target, int *target_x, int *target_y);

client_x
X coordinate on client
client_y
Y coordinate on client
target
A target widget
target_x
X coordinate on the target client (out)
target_y
X coordinate on the target client (out)
Return value
Succeeded or failed

It converts a client coordinate to the target client coordinate.


void MQWidgetBase::Repaint(bool immediate = false);

immediate
Whether to repaint immediately or later

It repaints a widget.

When immediate is true, the widget will be repainted immediately. When immediate is false, a repainting is reserved and it will be repainted after returning to an event loop.


void MQWidgetBase::RefreshPaint();

(new in Rev4.30)

It performs to paint immediately to the area where a repainting is reserved by Repaint(false), a window operation and so on.


void MQWidgetBase::CaptureMouse(bool value);

value
Whether to capture

(new in Rev4.30)

It captures a mouse operation, and mouse events are notified to this widget even if a mouse is moved out of this widget.


bool MQWidgetBase::CanReceiveMouseEvent();

Return value
Whether mouse events can be received

(new in Rev4.69)

It returns whether mouse events can be received or not. When a window in a modal, other windows cannot receive mouse events.


static MQWidgetBase *MQWidgetBase::FindWidgetByID(int id);

id
A widget ID
Return value
A widget

It returns a widget which has the specified ID.

NULL is returned when no widget has the ID.


static int MQWidgetBase::GetSystemWidgetID(MQSystemWidget::WidgetType type);

type
A type of a widget
[MQSystemWidget::MainWindow] A main window

It returns a widget ID created in the main program.

A system widget are usually used as a parent widget to create child windows or a child widgets. An unexpected malfunction may be caused when you operate the system widget.


static int MQWidgetBase::GetBaseRateSize(double rate);

rate
A rate of a base size
Return value
A size in pixels

It returns a widget size by a rate of a base size.


static void MQWidgetBase::GetDefaultBackColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultBackColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

(new in Rev4.60)

It returns a default background color


static void MQWidgetBase::GetDefaultFrameColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultFrameColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default frame color.


static void MQWidgetBase::GetDefaultTextColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultTextColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default text color.


static void MQWidgetBase::GetDefaultTitleBackColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultTitleBackColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

(new in Rev4.11)

It returns a default title background color.


static void MQWidgetBase::GetDefaultTitleTextColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultTitleTextColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

(new in Rev4.11)

It returns a default title text color.


static void MQWidgetBase::GetDefaultListBackColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultListBackColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default list background color.


static void MQWidgetBase::GetDefaultListTextColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultListTextColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default list text color.


static void MQWidgetBase::GetDefaultListActiveColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultListActiveColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default list active color.


static void MQWidgetBase::GetDefaultListActiveTextColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultListActiveTextColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default list active text color.


static void MQWidgetBase::GetDefaultEditBackColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultEditBackColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default edit background color.


static void MQWidgetBase::GetDefaultEditTextColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultEditTextColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default edit text color.


static void MQWidgetBase::GetDefaultEditSelectionColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultEditSelectionColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default edit selection color.


static void MQWidgetBase::GetDefaultEditSelectionTextColor(int& r, int& g, int& b, int& a);

static MQCanvasColor MQWidgetBase::GetDefaultEditSelectionTextColor();

r
Red (0-255)
g
Green (0-255)
b
Blue (0-255)
a
Opacity (0-255)

It returns a default edit selection text color.


static void MQWidgetBase::RegisterSubCommandButton(MQStationPlugin *plugin, MQButton *button, const char *command_str);

plugin
A plug-in
button
A button
command_str
A sub command's identifier string

(new in Rev4.30)

It registers a button for a sub command corresponding with MQStationPlugin::EnumSubCommand().

A shortcut key will be shown on the button when the key is assigned to the specified sub command.


static void MQWidgetBase::EnterEventLoop(unsigned int timeout_ms = (unsigned int)-1, bool empty_return = false);

timeout_ms
A maximum time for a timeout in millisecond
empty_return
Return a procedure if a message is empty

It enters a new event loop to process events such as a mouse, a keyboard or a drawing.

When timeout_ms is 0 or larger, a procedure will exit an event loop and return when a specified time is exceeded. But if a processing which requires time within an event loop is performed, a procedure will not return until the processing finished, even if a time is exceeded.

When timeout_ms is not specified, a procedure continues in an event loop and does not return until calling ExitEventLoop().

When empty_return is true, a procedure will return immediately at the time that no event exists even if a time is not exceeded.


static void MQWidgetBase::ExitEventLoop();

It is called to exit an event loop entered by EnterEventLoop().

Please be careful that a procedure will become invalid when EnterEventLoop() is not called yet or the procedure already exited an event loop.


static bool MQWidgetBase::CanReceiveTextFromClipboard();

Return value
A text exists or not in a clipboard
[true] Can receive a text
[false] Cannot receive a text

(new in Rev4.64)

It returns whether to receive a text or not in a clipboard.


static bool MQWidgetBase::GetKeyState(MQKeyCode::KEY_CODE key);

key
A key code defined in MQKeyCode
Return value
Whether the key is pressed
[true] Pressed
[false] Not pressed

(new in Rev4.64)

It returns whether the specified key is pressed or not now.

Please refer the header file in this SDK about a key code.


template<typename T> void MQWidgetBase::AddShowEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), bool prior = false);

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a widget is shown.

A member function 'f' must have the following options and return value.

 

BOOL T::f(MQWidgetBase* sender, MQDocument doc);

sender
A source widget that notifies an event
doc
A document
Return value
[TRUE] Modified the document
[FALSE] Nothing is modified in the document

template<typename T> void MQWidgetBase::AddHideEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), bool prior = false);

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a widget is hidden.

Please refer the description in AddShowEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddMoveEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), bool prior = false);

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a widget is moved.

Please refer the description in AddShowEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddResizeEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), bool prior = false);

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a widget is resized.

Please refer the description in AddShowEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddLeftDownEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a left button is pushed.

A member function 'f' must have the following options and return value.

 

BOOL T::f(MQWidgetBase* sender, MQDocument doc, MQWidgetMouseParam& param);

sender
A source widget that notifies an event
doc
A document
param
Parameters when an event is occurred (See the following description)
Return value
[TRUE] Modified the document
[FALSE] Nothing is modified in the document

struct MQWidgetMouseParam {
	POINT ClientPos;
	POINT ScreenPos;
	POINT DownPos;
	POINT LastPos;
	int Wheel;
	bool LButton;
	bool MButton;
	bool RButton;
	bool Shift;
	bool Ctrl;
	bool Alt;
	float Pressure;
	bool Finished;
};
ClientPos
A position of a mouse cursor in a client coordinate
ScreenPos
A position of a mouse cursor in a screen coordinate
DownPos
A clicked position in a client coordinate
LastPos
A position in a client coordinate at the last mouse event
Wheel
A rotation of a mouse wheel (WHEEL_DELTA based value)
LButton
Whether a left button is pressed
MButton
Whether a middle button is pressed
RButton
Whether a right button is pressed
Shift
Whether a Shift key is pressed
Ctrl
Whether a Ctrl key is pressed
Alt
Whether an Alt button is pressed
Pressure (new in Rev4.20)
Pressure of a tablet or a touch operation (0-1)
Finished (new in Rev4.30)
Set true if you do not want to perform a default behavior (out)

template<typename T> void MQWidgetBase::AddLeftUpEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a left button is released.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddLeftDoubleClickEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a left button is double-clicked.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddMiddleDownEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a middle button is pushed.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddMiddleUpEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a middle button is released.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddMiddleDoubleClickEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a middle button is double-clicked.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddRightDownEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a right button is pushed.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddRightUpEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a right button is released.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddRightDoubleClickEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a right button is double-clicked.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddMouseMoveEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a mouse cursor is moved on this widget.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddMouseWheelEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetMouseParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a mouse wheel is rotated.

Please refer the description in AddLeftDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddMouseEnterEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), bool prior = false);

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

(new in Rev4.60)

It adds events notified when a mouse cursor is entering this widget area.

Please refer the description in AddShowEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddMouseLeaveEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), bool prior = false);

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

(new in Rev4.60)

It adds events notified when a mouse cursor is leaving this widget area.

Please refer the description in AddShowEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddKeyDownEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetKeyParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a key is pushed.

A member function 'f' must have the following options and return value.

BOOL T::f(MQWidgetBase* sender, MQDocument doc, MQWidgetKeyParam& param);

sender
A source widget that notifies an event
doc
A document
param
Parameters when an event is occurred (See the following description)
Return value
[TRUE] Modified the document
[FALSE] Nothing is modified in the document

struct MQWidgetKeyParam {
	MQKeyCode::KEY_CODE Key;
	bool AutoRepeat;
	bool LButton;
	bool MButton;
	bool RButton;
	bool Shift;
	bool Ctrl;
	bool Alt;
	bool Finished;
};
Key
Key code
AutoRepeat
Whether an event is caused by an automatic repeat (for KeyDown only)
LButton
Whether a left button is pressed
MButton
Whether a middle button is pressed
RButton
Whether a right button is pressed
Shift
Whether a Shift key is pressed
Ctrl
Whether a Ctrl key is pressed
Alt
Whether an Alt button is pressed
Finished (new in Rev4.30)
Set true if you do not want to perform a default behavior (out)

template<typename T> void MQWidgetBase::AddKeyUpEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQWidgetKeyParam&), bool prior = false)

p
A widget to notify events
f
A member function to notify events
prior
An order to notify events
[true] Notify first
[false] Notify last

It adds events notified when a key is released.

Please refer the description in AddKeyDownEvent about the member function 'f'.


template<typename T> void MQWidgetBase::AddTimerEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), unsigned int timeout_ms, bool overwrite = false);

p
A widget to notify events
f
A member function to notify events
timeout_ms
A time to invoke an event in millisecond
overwrite
Whether to overwrite an event

It invokes a timer event after a specified time is exceeded.

If a processing which requires time within the same thread is performed, a timer event will not invoked until the processing finished, even if a time is exceeded.

When overwrite is true, the old event is overwritten if the target widget and the member function are same.

A timer event is invoked once for calling this function. Specify that overwrite is false and call this function several times if you want to invoke events several times.

Please refer the description in AddShowEvent about the member function 'f'.