libwtk-sdl2  0.0.1
Public Member Functions | List of all members
texture_view Struct Reference

#include <texture_view.hpp>

Inheritance diagram for texture_view:
Inheritance graph
[legend]
Collaboration diagram for texture_view:
Collaboration graph
[legend]

Public Member Functions

 texture_view (unique_texture_ptr p, int min_width=-1, int nat_width=-1)
 
void on_draw (draw_context &dc, selection_context const &sc) const override
 
void on_box_allocated () override
 
size_hint get_size_hint (int width, int height) const override
 
Texture View Interface
void set_texture (unique_texture_ptr p, int min_width=-1, int nat_width=-1)
 
- Public Member Functions inherited from widget
 widget (widget const &)=delete
 
widgetoperator= (widget const &)=delete
 
SDL_Rect const & get_box () const
 
context_info const & get_context_info () const
 
void set_context_info (context_info const &ci)
 
void set_parent (widget *parent)
 
virtual std::vector< widget * > get_children ()
 
virtual std::vector< widget const * > get_children () const
 
virtual void on_child_dirty (widget *child)
 
virtual std::vector< widget * > get_visible_children ()
 
virtual std::vector< widget const * > get_visible_children () const
 
void clear_dirty ()
 
void mark_dirty ()
 
void mark_child_dirty (widget *child)
 
void draw (draw_context &dc, selection_context const &sc) const
 
void draw_dirty (draw_context &dc, selection_context const &sc) const
 
virtual void on_mouse_up_event (mouse_up_event const &e)
 
virtual void on_mouse_down_event (mouse_down_event const &e)
 
virtual void on_mouse_move_event (mouse_move_event const &e)
 
virtual void on_key_event (key_event const &e)
 
virtual void on_activate ()
 
void apply_layout (SDL_Rect box)
 
virtual bool can_use_intermediate_size () const
 
virtual widgetfind_selectable (navigation_type nt, point center)
 
virtual widgetnavigate_selectable (navigation_type nt, point center)
 
virtual widgetnavigate_selectable_from_children (navigation_type nt, widget *w, point center)
 
virtual void on_select ()
 
virtual void on_unselect ()
 

Additional Inherited Members

- Protected Member Functions inherited from widget
std::optional< swipe_infoget_swipe_info_with_context_info (mouse_up_event const &e)
 
widgetnavigate_selectable_parent (navigation_type nt, point center)
 
- Protected Attributes inherited from widget
widget_parent
 

Detailed Description

A widget that displays a texture with the correct aspect ratio. The widget takes ownership of the texture.

Currently the widget centers the texture within its box. As that behavior is inconsistent with that of other widgets it may change in the future.

Constructor & Destructor Documentation

◆ texture_view()

texture_view::texture_view ( unique_texture_ptr  p,
int  min_width = -1,
int  nat_width = -1 
)

Create a texture view by moving a texture pointer.

One may give the minimum and natural width. The minimum width will default to half of the width of the texture. The natural width will default to the textures width.

Member Function Documentation

◆ get_size_hint()

size_hint texture_view::get_size_hint ( int  width,
int  height 
) const
overridevirtual

Computes the widgets preferred minimal and natural size. When given a specific width or height the widget might use that to give a more accurate size.

Implements widget.

◆ on_box_allocated()

void texture_view::on_box_allocated ( )
overridevirtual

Refresh layout with existing box. This should not be called if the widget does not have a box already. Otherwise no space is allocated.

Reimplemented from widget.

◆ on_draw()

void texture_view::on_draw ( draw_context dc,
selection_context const &  sc 
) const
overridevirtual

Draw the widget. No children should be drawn here.

Implements widget.


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