The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
gui2::rectangle_shape Class Reference

Definition of a rectangle shape. More...

#include <canvas_private.hpp>

Inheritance diagram for gui2::rectangle_shape:
Inheritance graph

Public Member Functions

 rectangle_shape (const config &cfg)
 Constructor. More...
 
void draw (surface &canvas, SDL_Renderer *renderer, wfl::map_formula_callable &variables) override
 Implement shape::draw(). More...
 
- Public Member Functions inherited from gui2::canvas::shape
 shape (const config &cfg)
 
virtual ~shape ()
 
bool immutable () const
 

Private Attributes

typed_formula< int > x_
 The x coordinate of the rectangle. More...
 
typed_formula< int > y_
 The y coordinate of the rectangle. More...
 
typed_formula< int > w_
 The width of the rectangle. More...
 
typed_formula< int > h_
 The height of the rectangle. More...
 
int border_thickness_
 Border thickness. More...
 
typed_formula< color_tborder_color_
 The border color of the rectangle. More...
 
typed_formula< color_tfill_color_
 The border color of the rectangle. More...
 

Detailed Description

Definition of a rectangle shape.

Definition at line 57 of file canvas_private.hpp.

Constructor & Destructor Documentation

gui2::rectangle_shape::rectangle_shape ( const config cfg)
explicit

Constructor.

Parameters
cfgThe config object to define the rectangle see http://www.wesnoth.org/wiki/GUICanvasWML#Rectangle for more information.

Definition at line 667 of file canvas.cpp.

References border_color_, border_thickness_, DBG_GUI_P, debug, and gui2::typed_formula< T >::has_formula().

Member Function Documentation

void gui2::rectangle_shape::draw ( surface canvas,
SDL_Renderer *  renderer,
wfl::map_formula_callable variables 
)
overridevirtual

Implement shape::draw().

Todo:
formulas are now recalculated every draw cycle which is a bit silly unless there has been a resize. So to optimize we should use an extra flag or do the calculation in a separate routine.

Implements gui2::canvas::shape.

Definition at line 688 of file canvas.cpp.

References _(), border_color_, border_thickness_, DBG_GUI_D, fill_color_, h, h_, i, color_t::null(), VALIDATE, w, w_, x_, and y_.

Member Data Documentation

typed_formula<color_t> gui2::rectangle_shape::border_color_
private

The border color of the rectangle.

If the color is fully transparent the border isn't drawn.

Definition at line 91 of file canvas_private.hpp.

Referenced by draw(), and rectangle_shape().

int gui2::rectangle_shape::border_thickness_
private

Border thickness.

If 0 the fill color is used for the entire widget.

Definition at line 84 of file canvas_private.hpp.

Referenced by draw(), and rectangle_shape().

typed_formula<color_t> gui2::rectangle_shape::fill_color_
private

The border color of the rectangle.

If the color is fully transparent the rectangle won't be filled.

Definition at line 98 of file canvas_private.hpp.

Referenced by draw().

typed_formula<int> gui2::rectangle_shape::h_
private

The height of the rectangle.

Definition at line 74 of file canvas_private.hpp.

Referenced by draw().

typed_formula<int> gui2::rectangle_shape::w_
private

The width of the rectangle.

Definition at line 74 of file canvas_private.hpp.

Referenced by draw().

typed_formula<int> gui2::rectangle_shape::x_
private

The x coordinate of the rectangle.

Definition at line 74 of file canvas_private.hpp.

Referenced by draw().

typed_formula<int> gui2::rectangle_shape::y_
private

The y coordinate of the rectangle.

Definition at line 74 of file canvas_private.hpp.

Referenced by draw().


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