Milo  0.1
Milo:EquationManipulationProgram
Static Public Member Functions | Protected Attributes | Static Protected Attributes | Static Private Attributes | List of all members
UI::MiloApp Class Referenceabstract

#include <ui.h>

Inheritance diagram for UI::MiloApp:
Inheritance graph
[legend]
Collaboration diagram for UI::MiloApp:
Collaboration graph
[legend]

Public Member Functions

Virtual Public Member Functions
virtual void redraw_screen ()=0
 
virtual Graphics & getGraphics ()=0
 

Static Public Member Functions

static MiloApp & getGlobal ()
 

Protected Member Functions

Constructors and Virtual Destructor
 MiloApp ()
 
 MiloApp (MiloWindowPtr win)
 
 ~MiloApp ()
 

Protected Attributes

MiloWindowVector m_windows
 List of windows for this application.
 
MiloWindowIter m_current_window
 Current active window.
 

Static Protected Attributes

static MiloApp & m_current = app
 Reference to current application singleton. More...
 

Static Private Attributes

static std::unordered_map< std::string, menu_handler > menu_map
 

Public helper member functions.

void doMenu (const std::string &menuFunctionName)
 
MiloWindow & getWindow ()
 
void addWindow (MiloWindowPtr win)
 
void closeWindow ()
 
void closeWindow (MiloWindowIter it)
 
static bool isRunning ()
 

Detailed Description

Singleton class that provides a global context for menu and current window.

Constructor & Destructor Documentation

UI::MiloApp::MiloApp ( )
inlineprotected

Protected constructor for singleton base class for windowless context.

UI::MiloApp::MiloApp ( MiloWindowPtr  win)
inlineprotected

Protected constructor for singleton base class.

Parameters
winDefault window
UI::MiloApp::~MiloApp ( )
inlineprotected

Abstract base class needs virtual destructor.

Member Function Documentation

void UI::MiloApp::addWindow ( MiloWindowPtr  win)
inline

Add new window to application after current window.

Parameters
winNew window added to application
void UI::MiloApp::closeWindow ( )
inline

Close current window from application.

void UI::MiloApp::closeWindow ( MiloWindowIter  it)
inline

Close window from application.

Parameters
itIterator to window to be deleted.
void MiloApp::doMenu ( const std::string &  menuFunctionName)

Execute function based on its name. Used for menu handling.

static MiloApp& UI::MiloApp::getGlobal ( )
inlinestatic

Return current global context.

Returns
current global context
virtual Graphics& UI::MiloApp::getGraphics ( )
pure virtual

Get graphics context.

Returns
Graphics context object.

Implemented in CursesApp, and AsciiApp.

MiloWindow& UI::MiloApp::getWindow ( )
inline

Get active window.

Returns
Active window.
bool MiloApp::isRunning ( )
static

Query if program should quit.

Returns
If true, exit main loop.
virtual void UI::MiloApp::redraw_screen ( )
pure virtual

Redraw entire screen.

Implemented in CursesApp, and AsciiApp.

Member Data Documentation

MiloApp & MiloApp::m_current = app
staticprotected

Reference to current application singleton.

Ascii app class object.

unordered_map< string, menu_handler > MiloApp::menu_map
staticprivate
Initial value:
= {
{ "undo", []() { MiloApp::getGlobal().getWindow().getPanel().pushUndo(); } },
{ "redraw", []() { MiloApp::getGlobal().redraw_screen(); } },
{ "quit", []() { fRunning = false; } }
}

Map of names to functions that handle menu items.


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