MQButton class

(new in Rev4.00)

MQButton class manges a button. It inherits a MQWidgetBase class.

Please refer the inherited class about member functions declared in the inherited class.

Class
MQButton Constructor
~MQButton Destructor
Member functions
GetText Get a displayed string
SetText Set a displayed string
GetFontName Get a font name
SetFontName Set a font name
GetFontBold Get a bold font
SetFontBold Set a bold font
GetFontScale Get a font scaling
SetFontScale Set a font scaling
GetFontColor Get a font color
SetFontColor Set a font color
GetAlignment Get an alignment for a text
SetAlignment Set an alignment for a text
GetToggle Get an automatic switching
SetToggle Set an automatic switching
GetDown Get a down status
SetDown Set a down status
GetRepeat Get a repeatability
SetRepeat Set a repeatability
GetChain Get a chain display
SetChain Set a chain display
GetPaddingX Get a horizontal padding
SetPaddingX Set a horizontal padding
GetPaddingY Get a vertical padding
SetPaddingY Set a vertical padding
SetSystemSVGFile Set a system SVG file
GetImageScale Get a scale for an image
SetImageScale Set a scale for an image
GetImagePosition Get a position for an image
SetImagePosition Set a position for an image
SetDefault Set as a default button
SetCancel Set as a cancel button
SetModalResult Set a result for a dialog
Events
AddClickEvent Add an event for a click
AddRepeatEvent Add an event for holding down

MQButton::MQButton();

MQButton::MQButton(int id);

id
A widget ID created outside the plug-in

It is a constructor.


virtual MQButton::~MQButton();

This method is a destructor. It is defined as a virtual function.


std::wstring MQButton::GetText();

Return value
A displayed text

It returns a text displayed on a button.


void MQButton::SetText(const std::wstring& text);

text
A displayed text

It specifies a text displayed on a button.


std::wstring MQButton::GetFontName();

Return value
Font name

It returns a font name for displaying a text.


void MQButton::SetFontName(const std::wstring& value);

value
Font name

It specifies a font name for displaying a text.


bool MQButton::GetFontBold();

Return value
Bold font

It returns whether a displayed font is bold or not.


void MQButton::SetFontBold(bool value);

value
Bold font

It specifies whether a displayed font is bold or not.


double MQButton::GetFontScale();

Return value
Font scaling

It returns a font scaling ratio for a default font size.

A default value is 1.0.


void MQButton::SetFontScale(double value);

value
Font scaling

It specifies a font scaling ratio for a default font size.


void MQButton::GetFontColor(int& r, int& g, int& b, int& a);

r
Red value
g
Green value
b
Blue value
a
Opacity

It returns a color of a displayed font. Each value is from 0 to 255.

When a is 0, a text is drawn with a default color.


void MQButton::SetFontColor(int r, int g, int b, int a);

r
Red value
g
Green value
b
Blue value
a
Opacity

It specifies a color of a displayed font. Each value is from 0 to 255.


MQButton::MQButtonTextAlignment MQButton::GetAlignment();

Return value
An alignment for a text
[ALIGN_LEFT] Left
[ALIGN_CENTER] Center
[ALIGN_RIGHT] Right
[ALIGN_CENTER_EXCEPT_IMAGE] Center text and side image

(new in Rev4.20)

It returns an alignment for displaying a text.


void MQButton::SetAlignment(MQMQButtonTextAlignment value);

value
An alignment for a text
[ALIGN_LEFT] Left
[ALIGN_CENTER] Center
[ALIGN_RIGHT] Right
[ALIGN_CENTER_EXCEPT_IMAGE] Center text and side image

(new in Rev4.20)

It specifies an alignment for displaying a text.


bool MQButton::GetToggle();

Return value
Automatic switching

It returns whether a button is automatically switched on and off when a button is pushed.


void MQButton::SetToggle(bool value);

value
Automatic switching

It specifies whether a button is automatically switched on and off when a button is pushed.


bool MQButton::GetDown();

Return value
Down or up

It returns whether a button is on or off.


void MQButton::SetDown(bool value);

value
Down or up

It specifies whether a button is on or off.


bool MQButton::GetRepeat();

Return value
Repeatability

It returns whether events are repeatedly invoked while a button is held down.


void MQButton::SetRepeat(bool value);

value
Repeatability

It specifies whether events are repeatedly invoked while a button is held down.

A function specified in AddRepeatEvent will be called in the case that 'true' is specified.


bool MQButton::GetChain();

Return value
A chain status

It returns whether a button is displayed with a connection to a neighbor button or not.


void MQButton::SetChain(bool value);

value
A chain status

It specifies whether a button is displayed with a connection to a neighbor button or not.


double MQButton::GetPaddingX();

Return value
A horizontal padding

(new in Rev4.30)

It returns a horizontal padding between a text, an icon and so on.


void MQButton::SetPaddingX(double value);

value
A horizontal padding

(new in Rev4.30)

It specifies a horizontal padding between a text, an icon and so on.


double MQButton::GetPaddingY();

Return value
A vertical padding

(new in Rev4.30)

It returns a vertical padding between a text, an icon and so on.


void MQButton::SetPaddingY(double value);

value
A vertical padding

(new in Rev4.30)

It specifies a vertical padding between a text, an icon and so on.


void MQButton::SetSystemSVGFile(const wchar_t *filename);

filename
A filename of a svg file

(new in Rev4.30)

It shows a svg image prepared by a system as an icon.


double MQButton::GetImageScale();

Return value
A image scaling

(new in Rev4.32)

It returns a scaling factor for a svg image.


void MQButton::SetImageScale(double value);

value
A image scaling

(new in Rev4.32)

It specifies a scaling factor for a svg image.


MQButton::MQButtonImagePosition MQButton::GetImagePosition();

Return value
A position of an image
[IMAGE_LEFT] Left
[IMAGE_RIGHT] Right
[IMAGE_TOP] Top
[IMAGE_BOTTOM] Bottom

(new in Rev4.32)

It returns where a svg image is shown.


void MQButton::SetImagePosition(MQButtonImagePosition value);

value
A position of an image
[IMAGE_LEFT] Left
[IMAGE_RIGHT] Right
[IMAGE_TOP] Top
[IMAGE_BOTTOM] Bottom

(new in Rev4.32)

It specifies where a svg image is shown.


void MQButton::SetDefault(bool value);

value
As a default button

It specifies whether a button works or not when an Enter key is pressed in a dialog.


void MQButton::SetCancel(bool value);

value
As a cancel button

It specifies whether a button works or not when an Esc key is pressed in a dialog.


void MQButton::SetModalResult(MQDialog::DIALOG_RESULT value);

value
A result value for a dialog
[DIALOG_NONE] None
[DIALOG_OK] As a 'OK' button
[DIALOG_CANCEL] As a 'Cancel' button
[DIALOG_YES] As a 'Yes' button
[DIALOG_NO] As a 'No' button
[DIALOG_ALL] As an 'All' button

It specifies a return value of MQDialog::Execute when a button is pushed.

A dialog will be closed automatically when a button is pushed in the case that a result value except DIALOG_NONE is specified.


template<typename T> void MQButton::AddClickEvent(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 button is pushed.


template<typename T> void MQButton::AddRepeatEvent(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 button is held down.

It is necessary that 'true' is specified in SetRepeat() to notify this event.