A top-level drawable item (TLD), such as a window. More...
#include <top_level_drawable.hpp>
Public Member Functions | |
virtual void | update () |
Update state and any parameters that may effect layout, or any of the later stages. More... | |
virtual void | layout () |
Finalize the size and position of the drawable and its children, and invalidate any regions requiring redraw. More... | |
virtual void | render () |
Perform any internal rendering necessary to prepare the drawable. More... | |
virtual bool | expose (const rect ®ion)=0 |
Draw the portion of the drawable intersecting region to the screen. More... | |
virtual rect | screen_location ()=0 |
The location of the TLD on the screen, in drawing coordinates. More... | |
Protected Member Functions | |
top_level_drawable () | |
virtual | ~top_level_drawable () |
top_level_drawable (const top_level_drawable &) | |
top_level_drawable & | operator= (const top_level_drawable &) |
top_level_drawable (top_level_drawable &&) | |
top_level_drawable & | operator= (top_level_drawable &&) |
A top-level drawable item (TLD), such as a window.
For now, TLDs keep track of where they are on the screen on their own. They must draw themselves when requested via expose().
The TLD interface will be called in the following order:
It can be assumed that events will have been processed before TLD interface calls commence, and that no more events will be processed until all TLD interfaces have been called. As such the main program loop will usually be:
TLDs are responsible for propagating these calls to their children.
This process is loosely based on the GTK drawing model. Ref:
Definition at line 51 of file top_level_drawable.hpp.
|
protected |
Definition at line 22 of file top_level_drawable.cpp.
References draw_manager::register_drawable().
|
protectedvirtual |
Definition at line 27 of file top_level_drawable.cpp.
References draw_manager::deregister_drawable().
|
protected |
Definition at line 32 of file top_level_drawable.cpp.
References draw_manager::register_drawable().
|
protected |
Definition at line 43 of file top_level_drawable.cpp.
References draw_manager::register_drawable().
|
pure virtual |
Draw the portion of the drawable intersecting region
to the screen.
TLDs must not invalidate regions during expose. Only drawing must occur, with no modification of layout.
Implementation of this interface is mandatory.
region | The region to expose, in absolute draw-space coordinates. |
Implemented in gui::widget, tooltips::manager, gui2::window, and display.
|
inlinevirtual |
Finalize the size and position of the drawable and its children, and invalidate any regions requiring redraw.
Visibly changed screen locations should be invalidated using draw_manager::invalidate_region(), both in the previous location and in the new location if different.
TLDs must not perform any actual drawing during layout.
This interface is optional.
Reimplemented in gui::widget, gui::textbox, tooltips::manager, gui2::window, gui2::dialogs::loading_screen, game_display, editor::palette_manager, editor::location_palette, editor::editor_palette< Item >, editor::editor_palette< t_translation::terrain_code >, editor::editor_palette< const unit_type & >, editor::editor_palette< overlay >, editor::editor_display, and display.
Definition at line 90 of file top_level_drawable.hpp.
Referenced by draw_manager::layout().
|
protected |
Definition at line 37 of file top_level_drawable.cpp.
References draw_manager::register_drawable().
|
protected |
Definition at line 48 of file top_level_drawable.cpp.
References draw_manager::register_drawable().
|
inlinevirtual |
Perform any internal rendering necessary to prepare the drawable.
For example if the drawable has an offscreen buffer it manages, it should ensure this buffer is up to date.
TLDs should also invalidate any regions visibly changed by this call.
This interface is optional.
Reimplemented in gui2::window, game_display, and display.
Definition at line 102 of file top_level_drawable.hpp.
Referenced by draw_manager::render().
|
pure virtual |
The location of the TLD on the screen, in drawing coordinates.
This will be used to determine the region (if any) to expose.
Implementation of this interface is mandatory.
Implemented in gui::widget, tooltips::manager, gui2::window, and display.
|
inlinevirtual |
Update state and any parameters that may effect layout, or any of the later stages.
In general this should be used to make changes to things that will affect the visible state of the drawable. This can include changing the drawable's size or position, or updating animation frames to show the appropriate image for the current time. Exact usage is up to the drawable to decide.
This interface is optional.
Reimplemented in gui2::dialogs::story_viewer, gui2::dialogs::outro, gui2::dialogs::end_credits, gui2::dialogs::debug_clock, game_display, and display.
Definition at line 76 of file top_level_drawable.hpp.
Referenced by draw_manager::update(), gui2::dialogs::debug_clock::update(), and gui2::dialogs::story_viewer::update().