Background class reference


Widget, displays a solid color area. It can be used as a background in sub-widgets or windows. Specifying a nullptr value as a window is prohibited. Example (using widget as background for window):

 Window window(nullptr, "Bg test", { {250,100}, {980,620}, WindowFlags::AutoInvokeRender});
 Background bg(&window, {{0,0}, {0,0}, ResizePolicy::AutoFill});

Functions documentation

Background(Window* window, const Widget2DProps& props, const BackgroundTheme& rectProps);

Default constructor.


Background(Window* window, const Widget2DProps& props, const Theme& theme);

Delegating constructor with theme application.


Background(const Background& copy);

Copy constructor.


virtual ~Background();

Destructor.


Background& operator=(Background rhs);

Assignment operator.


friend void swap(Background& first, Background& second) noexcept;

Swap function.


Background* Clone() const override;

Clones the object (usefull while making copy of object that is casted to its base).


const Color& GetColor() const;

Returns the color of the widget.


void SetColor(Color color);

Sets the color of the widget.


const Color& GetBorderColor() const;

Returns the border color of the widget.


void SetBorderColor(Color color);

Sets the border color of the widget.


const Dimension<int>& GetBorderSize() const;

Returns the border size of the widget.


void SetBorderSize(Dimension<int> newBorderSize);

Sets the widget border size.


void Render() override;

Renders the widget.


void CreateBuffers();

Creates OpenGL VAO and VBO.


void BindBuffers() override;

Binds the filled-in data arrays that are used in the rendering process.


void Cleanup();

Deletes OpenGL VAO and VBO.


Variables documentation

BackgroundTheme m_RectangleTheme;

Stores information about widget theme.


GLuint m_VertexArrayId;

OpenGL Vertex Array Object


GLuint m_VertexBufferId;

OpenGL Vertex Buffer object