Simple Graphics Library  0.9.5
SGL API
Public Member Functions | Public Attributes | List of all members
sgl::ProceduralWindow Class Reference
Inheritance diagram for sgl::ProceduralWindow:
Inheritance graph
[legend]
Collaboration diagram for sgl::ProceduralWindow:
Collaboration graph
[legend]

Public Member Functions

 ProceduralWindow (const std::string &title, double x, double y, double width, double height)
 
void paint () override
 
void mouse_pressed (double x, double y, MouseButton b) override
 
void mouse_released (double x, double y, MouseButton b) override
 
void mouse_moved (double x, double y) override
 
void mouse_dragged (double x, double y) override
 
void key_pressed (int k, double x, double y) override
 
- Public Member Functions inherited from sgl::ObjectWindow
 ObjectWindow (const std::string &title, int left, int top, int width, int height, double min_x, double max_x, double min_y, double max_y)
 
 ObjectWindow (const std::string &title, int width, int height)
 
 ObjectWindow (const std::string &title, double min_x, double max_x, double min_y, double max_y)
 
 ObjectWindow ()
 
 ~ObjectWindow ()
 
void prepaint () override
 
void postpaint () override
 
void internal_add (GraphicalObject *obj)
 
template<typename T , typename... Args>
T * add (Args &&... args)
 
void remove (GraphicalObject *obj)
 
void remove_all ()
 
GraphicalObjecthit (double x, double y) const
 
std::vector< GraphicalObject * >::iterator begin ()
 
std::vector< GraphicalObject * >::iterator end ()
 
- Public Member Functions inherited from sgl::Window
 Window (const std::string &title, int left, int top, int width, int height, double min_x, double max_x, double min_y, double max_y)
 
 Window (const std::string &title, int width, int height)
 
 Window (const std::string &title, double min_x, double max_x, double min_y, double max_y)
 
 Window ()
 
virtual ~Window ()
 
virtual void clear ()
 
virtual void set_title (const std::string &str)
 
virtual void set_background_color (const Color &color)
 
virtual void set_position (int x, int y)
 
virtual void set_size (int width, int height)
 
virtual void set_viewport (double left, double right, double bottom, double top)
 
virtual void set_visible (bool visible)
 
virtual CursorShape set_cursor (CursorShape cursor)
 
virtual CursorShape get_cursor ()
 
virtual void run ()
 
virtual void repaint ()
 
virtual void paint_all ()
 
virtual int get_x () const
 
virtual int get_y () const
 
virtual int get_width () const
 
virtual int get_height () const
 
virtual void set_window_size (int w, int h)
 
virtual void resized (int w, int h)
 
virtual double get_min_x () const
 
virtual double get_max_x () const
 
virtual double get_min_y () const
 
virtual double get_max_y () const
 
virtual void draw_axes (double x_inc, double y_inc) const
 
virtual void mouse_entered ()
 
virtual void mouse_exited ()
 
KeyModifier get_key_modifiers () const
 
void set_key_modifiers (KeyModifier mod)
 
virtual void start_timer (int msec)
 
virtual void timer_expired ()
 

Public Attributes

std::function< void()> paint_function
 
std::function< void(double, double, MouseButton)> mouse_pressed_function
 
std::function< void(double, double, MouseButton)> mouse_released_function
 
std::function< void(double, double)> mouse_moved_function
 
std::function< void(double, double)> mouse_dragged_function
 
std::function< void(int, double, double)> key_pressed_function
 

Additional Inherited Members

- Protected Member Functions inherited from sgl::Window
void initialize (const std::string &title, int left, int top, int width, int height, double min_x, double max_x, double min_y, double max_y)
 
- Protected Attributes inherited from sgl::ObjectWindow
std::vector< GraphicalObject * > object_list
 
GraphicalObjectactive_object
 
- Protected Attributes inherited from sgl::Window
double min_x
 
double max_x
 
double min_y
 
double max_y
 
CursorShape normal_cursor
 
KeyModifier key_mods
 

Member Function Documentation

◆ key_pressed()

void sgl::ProceduralWindow::key_pressed ( int  k,
double  x,
double  y 
)
inlineoverridevirtual

Called by the event manager when the user types a key when the window has keyboard focus. The key pressed and the location of the mouse pointer in viewport coordinates is reported.

Parameters
kthe key typed by the user
xthe x coordinate in viewport coordinates of the location of the mouse pointer within the window
ythe y coordinate in viewport coordinates of the location of the mouse pointer within the window
Returns
nothing

Reimplemented from sgl::ObjectWindow.

◆ mouse_dragged()

void sgl::ProceduralWindow::mouse_dragged ( double  x,
double  y 
)
inlineoverridevirtual

Called by the event manager when the user drags the mouse (moves the mouse while holding down a mouse button) when the mouse pointer is within the window. The location reported is given in viewport coordinates.

Parameters
xthe x coordinate in viewport coordinates of the location of the mouse pointer within the window during the most recent mouse event.
ythe y coordinate in viewport coordinates of the location of the mouse pointer within the window during the most recent mouse event.
Returns
nothing

Reimplemented from sgl::ObjectWindow.

◆ mouse_moved()

void sgl::ProceduralWindow::mouse_moved ( double  x,
double  y 
)
inlineoverridevirtual

Called by the event manager when the user moves the mouse when the mouse pointer is within the window. The location reported is given in viewport coordinates.

Parameters
xthe x coordinate in viewport coordinates of the location of the mouse pointer within the window during the most recent mouse event.
ythe y coordinate in viewport coordinates of the location of the mouse pointer within the window during the most recent mouse event.
Returns
nothing

Reimplemented from sgl::ObjectWindow.

◆ mouse_pressed()

void sgl::ProceduralWindow::mouse_pressed ( double  x,
double  y,
MouseButton  button 
)
inlineoverridevirtual

Called by the event loop when the user depresses any mouse button when the mouse pointer is within the window.

Parameters
xthe x coordinate in viewport coordinates of the mouse pointer location within the window during the current mouse event.
ythe y coordinate in viewport coordinates of the mouse pointer location within the window during the current mouse event.
buttonthe button that was depressed, left (LEFT_BUTTON) or right (RIGHT_BUTTON) during the current mouse event.
Returns
nothing

Reimplemented from sgl::ObjectWindow.

◆ mouse_released()

void sgl::ProceduralWindow::mouse_released ( double  x,
double  y,
MouseButton  button 
)
inlineoverridevirtual

Called by the event manager when the user releases any mouse button when the mouse pointer is within the window.

Parameters
xthe x coordinate in viewport coordinates of the mouse pointer location within the window during the current mouse event.
ythe y coordinate in viewport coordinates of the mouse pointer location within the window during the current mouse event.
buttonthe button that was released, left (LEFT_BUTTON) or right (RIGHT_BUTTON) during the current mouse event.
Returns
nothing

Reimplemented from sgl::ObjectWindow.

◆ paint()

void sgl::ProceduralWindow::paint ( )
inlineoverridevirtual

Responsible for rendering the image in the window's viewport. This method is abstract, so concrete derived classes must provide a concrete implementation.

Returns
nothing.

Implements sgl::Window.


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