lecui 1.0.0-alpha.20
lecui C++ user interface library
Public Member Functions | List of all members
liblec::lecui::dimensions Class Reference

Manipulate a form's dimensions. More...

#include <controls.h>

Public Member Functions

 dimensions (form &fm)
 Class constructor. More...
 
 ~dimensions ()
 Class destructor.
 
lecui::rect measure_label (const std::string &formatted_text, const std::string &font, const float font_size, text_alignment alignment, paragraph_alignment paragraph_alignment, const lecui::rect max_rect)
 Measure how much space a label will take. More...
 
lecui::rect measure_html_widget (const std::string &formatted_text, const std::string &font, const float font_size, text_alignment alignment, const bool editor, const lecui::rect max_rect)
 Measure how much space an html widget will take. More...
 
lecui::rect working_area ()
 Get the working area of the screen. This is the part of the screen that excludes the operating system's task bar. More...
 
lecui::rect cursor_rect ()
 Get the position of the mouse cursor. More...
 
dimensionsset_size (const lecui::size &size)
 Set the form's size. More...
 
const lecui::size get_size ()
 Get the form's size. More...
 
const lecui::size get_design_size ()
 Get the form's design size. More...
 
const lecui::point get_position ()
 Get the form's position. More...
 
dimensionsset_minimum (const lecui::size &size)
 Set the form's minimum size. More...
 
const lecui::sizeget_minimum ()
 Get the form's minimum size. More...
 

Detailed Description

Manipulate a form's dimensions.

This manipulation is best done in the form's initialize event.

Constructor & Destructor Documentation

◆ dimensions()

liblec::lecui::dimensions::dimensions ( form fm)

Class constructor.

Parameters
fmA reference to the form.

Member Function Documentation

◆ cursor_rect()

lecui::rect liblec::lecui::dimensions::cursor_rect ( )

Get the position of the mouse cursor.

Returns
The rectangle bounding the cursor.

This method is DPI aware.

◆ get_design_size()

const lecui::size liblec::lecui::dimensions::get_design_size ( )

Get the form's design size.

Returns
The size, in pixels, as defined in lecui::size.

The design size is the the size that pages 'see' when they are added to the form. This is the size of the form minus any external resizing by the user or the operating system.

◆ get_minimum()

const lecui::size & liblec::lecui::dimensions::get_minimum ( )

Get the form's minimum size.

Returns
The size, in pixels.

◆ get_position()

const lecui::point liblec::lecui::dimensions::get_position ( )

Get the form's position.

Returns
Returns the coordinates of the top left corner.

◆ get_size()

const lecui::size liblec::lecui::dimensions::get_size ( )

Get the form's size.

Returns
The size, in pixels, as defined in lecui::size.

Do not use this for laying out widgets on the form. Widgets are never placed directly onto a form, only into containers. Therefore, use the size of the containers for widget layout. Containers are never the same size as the form, some room is left for the form border, form controls, and depending on the container possibly scroll area etc. Refer to the container's documentation for more details.

◆ measure_html_widget()

lecui::rect liblec::lecui::dimensions::measure_html_widget ( const std::string &  formatted_text,
const std::string &  font,
const float  font_size,
text_alignment  alignment,
const bool  editor,
const lecui::rect  max_rect 
)

Measure how much space an html widget will take.

Parameters
formatted_textThe formatted text.
fontThe font, e.g. Segoe UI.
font_sizeThe font size, in points, e.g. 9.0f.
alignmentThe alignment of the text.
editorWhether this is an html_editor. Use false for an html_view.
max_rectThe area which the text should not exceed.
Returns
The rectangle that defines the optimal rectangle for the text.

◆ measure_label()

lecui::rect liblec::lecui::dimensions::measure_label ( const std::string &  formatted_text,
const std::string &  font,
const float  font_size,
text_alignment  alignment,
paragraph_alignment  paragraph_alignment,
const lecui::rect  max_rect 
)

Measure how much space a label will take.

Parameters
formatted_textThe formatted text.
fontThe font, e.g. Segoe UI.
font_sizeThe font size, in points, e.g. 9.0f.
alignmentThe alignment of the text.
paragraph_alignmentThe paragraph alignment.
max_rectThe area which the text should not exceed.
Returns
The rectangle that defines the optimal rectangle for the text.

◆ set_minimum()

dimensions & liblec::lecui::dimensions::set_minimum ( const lecui::size size)

Set the form's minimum size.

Parameters
sizeThe size, in pixels.
Returns
A reference to the modified object.

This manipulation should be done in the form's layout method.

◆ set_size()

dimensions & liblec::lecui::dimensions::set_size ( const lecui::size size)

Set the form's size.

Parameters
sizeThe size, in pixels.
Returns
A reference to the modified object.

To pre-set the form's design size, this manipulation should be done in the form's initialize event.

◆ working_area()

lecui::rect liblec::lecui::dimensions::working_area ( )

Get the working area of the screen. This is the part of the screen that excludes the operating system's task bar.

Returns
The working area rectangle.

As with all lecui methods, this method is also DPI aware.


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