EMath++
Classes for mathematical concepts
Loading...
Searching...
No Matches
efc::Window Class Reference

Generic class for wrapping a curses WINDOW. More...

+ Inheritance diagram for efc::Window:

Public Member Functions

 Window () noexcept
 Generic constructor with default values.
 
const char * get_title () const noexcept
 Returns the c_str() const char pointer of the title std::string.
 
const unsigned int & get_y () const noexcept
 Returns the y coordinate.
 
const unsigned int & get_x () const noexcept
 Returns the x coordinate.
 
const unsigned int & get_height () const noexcept
 Returns the height value.
 
const unsigned int & get_width () const noexcept
 Returns the width value.
 
const unsigned int get_title_size () const noexcept
 Returns the title size.
 
void set_title (const ::std::string &&title) noexcept
 Sets the title.
 
void set_coords (const unsigned int y, const unsigned int x) noexcept
 Sets the y and x coordinates.
 
void set_size (const unsigned int h, const unsigned int w) noexcept
 Sets the size.
 
void set_active (const bool active) noexcept
 Sets the active boolean to the provided value.
 
virtual const unsigned int get_title_y () const noexcept
 Gets the title y coordinate.
 
virtual const unsigned int get_title_x () const noexcept
 Gets the title x coordinate.
 
const bool needs_update () noexcept
 Gets if the window needs a redraw.
 
const bool is_active () const noexcept
 Gets if the window is active/focused.
 
void place ()
 Deletes the WINDOW pointer and creates a new WINDOW at the class coordinates.
 
virtual ~Window () noexcept
 Calls curses delwin() function on the curses WINDOW object and returns.
 

Public Attributes

WINDOW * o
 Pointer to the curses WINDOW object.
 

Protected Attributes

bool c
 Two booleans: c for knowing if contents changed, and a for knowing if window is active.
 
bool a
 
::std::string t
 String t: window title.
 
unsigned int y
 Four unsigned ints: x and y for the coordinates relative to the console window, w and h for the size of the window.
 
unsigned int x
 
unsigned int h
 
unsigned int w
 

Detailed Description

Generic class for wrapping a curses WINDOW.

It wraps a curses WINDOW in a way that lets it manage some centralized structure.

Definition at line 59 of file interface.cpp.

Constructor & Destructor Documentation

◆ Window()

efc::Window::Window ( )
inlinenoexcept

Generic constructor with default values.

Definition at line 81 of file interface.cpp.

◆ ~Window()

virtual efc::Window::~Window ( )
inlinevirtualnoexcept

Calls curses delwin() function on the curses WINDOW object and returns.

Definition at line 161 of file interface.cpp.

Member Function Documentation

◆ get_height()

const unsigned int & efc::Window::get_height ( ) const
inlinenoexcept

Returns the height value.

Returns
(const unsigned int&) The height value as a const unsigned int&

Definition at line 101 of file interface.cpp.

◆ get_title()

const char * efc::Window::get_title ( ) const
inlinenoexcept

Returns the c_str() const char pointer of the title std::string.

Returns
(const char*) The title as a char array

Definition at line 86 of file interface.cpp.

◆ get_title_size()

const unsigned int efc::Window::get_title_size ( ) const
inlinenoexcept

Returns the title size.

Returns
(const unsigned int) The title size as a const unsigned int

Definition at line 111 of file interface.cpp.

◆ get_title_x()

virtual const unsigned int efc::Window::get_title_x ( ) const
inlinevirtualnoexcept

Gets the title x coordinate.

Returns
(const unsigned int) The title x coordinate as a const unsigned int

Reimplemented in efc::OWindow, and efc::IWindow.

Definition at line 143 of file interface.cpp.

◆ get_title_y()

virtual const unsigned int efc::Window::get_title_y ( ) const
inlinevirtualnoexcept

Gets the title y coordinate.

Returns
(const unsigned int) The title y coordinate as a const unsigned int

Reimplemented in efc::OWindow, and efc::IWindow.

Definition at line 138 of file interface.cpp.

◆ get_width()

const unsigned int & efc::Window::get_width ( ) const
inlinenoexcept

Returns the width value.

Returns
(const unsigned int&) The width value as a const unsigned int&

Definition at line 106 of file interface.cpp.

◆ get_x()

const unsigned int & efc::Window::get_x ( ) const
inlinenoexcept

Returns the x coordinate.

Returns
(const unsigned int&) The x coordinate as a const unsigned int&

Definition at line 96 of file interface.cpp.

◆ get_y()

const unsigned int & efc::Window::get_y ( ) const
inlinenoexcept

Returns the y coordinate.

Returns
(const unsigned int&) The y coordinate as a const unsigned int&

Definition at line 91 of file interface.cpp.

References y.

◆ is_active()

const bool efc::Window::is_active ( ) const
inlinenoexcept

Gets if the window is active/focused.

Returns
(const bool) True if the window is active, false otherwise

Definition at line 153 of file interface.cpp.

◆ needs_update()

const bool efc::Window::needs_update ( )
inlinenoexcept

Gets if the window needs a redraw.

Returns
(const bool) True if the window should be redrawed, false otherwise

Definition at line 148 of file interface.cpp.

◆ place()

void efc::Window::place ( )
inline

Deletes the WINDOW pointer and creates a new WINDOW at the class coordinates.

Definition at line 157 of file interface.cpp.

◆ set_active()

void efc::Window::set_active ( const bool  active)
inlinenoexcept

Sets the active boolean to the provided value.

Parameters
activeIf it is a active as a const boolean

Definition at line 133 of file interface.cpp.

◆ set_coords()

void efc::Window::set_coords ( const unsigned int  y,
const unsigned int  x 
)
inlinenoexcept

Sets the y and x coordinates.

Parameters
yThe y coordinate as a const unsigned int y
xThe x coordinate as a const unsigned int x

Definition at line 122 of file interface.cpp.

References y.

◆ set_size()

void efc::Window::set_size ( const unsigned int  h,
const unsigned int  w 
)
inlinenoexcept

Sets the size.

Parameters
hThe height as a const unsigned int y
wThe width as a const unsigned int x

Definition at line 128 of file interface.cpp.

◆ set_title()

void efc::Window::set_title ( const ::std::string &&  title)
inlinenoexcept

Sets the title.

Parameters
titleThe title as a cons std::string&&

Definition at line 116 of file interface.cpp.

Member Data Documentation

◆ a

bool efc::Window::a
protected

Definition at line 64 of file interface.cpp.

◆ c

bool efc::Window::c
protected

Two booleans: c for knowing if contents changed, and a for knowing if window is active.

Definition at line 64 of file interface.cpp.

◆ h

unsigned int efc::Window::h
protected

Definition at line 72 of file interface.cpp.

◆ o

WINDOW* efc::Window::o

Pointer to the curses WINDOW object.

Definition at line 77 of file interface.cpp.

◆ t

::std::string efc::Window::t
protected

String t: window title.

Definition at line 68 of file interface.cpp.

◆ w

unsigned int efc::Window::w
protected

Definition at line 72 of file interface.cpp.

◆ x

unsigned int efc::Window::x
protected

Definition at line 72 of file interface.cpp.

◆ y

unsigned int efc::Window::y
protected

Four unsigned ints: x and y for the coordinates relative to the console window, w and h for the size of the window.

Definition at line 72 of file interface.cpp.


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