TermOx
Public Member Functions | Protected Member Functions | List of all members
ox::layout::Selecting< Layout_t, unselect_on_focus_out > Class Template Reference

Adds a 'Selected Child' concept to Layout_t. More...

#include <selecting.hpp>

Inheritance diagram for ox::layout::Selecting< Layout_t, unselect_on_focus_out >:

Public Member Functions

 Selecting (Key_codes increment_selection_keys, Key_codes decrement_selection_keys, Key_codes increment_scroll_keys, Key_codes decrement_scroll_keys)
 
void set_increment_selection_keys (Key_codes keys)
 
void set_decrement_selection_keys (Key_codes keys)
 
void set_increment_scroll_keys (Key_codes keys)
 
void set_decrement_scroll_keys (Key_codes keys)
 
auto is_child_selected () const -> bool
 Return whether or not a child widget is currently selected. More...
 
auto selected_child () const -> typename Layout_t::Child_t const &
 Return the currently selected child, UB if no children in Layout.
 
auto selected_child () -> typename Layout_t::Child_t &
 Return the currently selected child, UB if no children in Layout.
 
auto selected_index () const -> std::size_t
 Return the index into get_children() corresponding to the selected child. More...
 
void select_first_child ()
 Set the first visible child as the selected child.
 

Protected Member Functions

auto key_press_event (Key k) -> bool override
 
auto mouse_wheel_event_filter (Widget &, Mouse const &m) -> bool override
 
auto mouse_press_event_filter (Widget &w, Mouse const &m) -> bool override
 
auto resize_event (ox::Area new_size, ox::Area old_size) -> bool override
 Reset the selected child if needed.
 
auto focus_in_event () -> bool override
 
auto focus_out_event () -> bool override
 
auto enable_event () -> bool override
 
auto disable_event () -> bool override
 
auto child_added_event (Widget &child) -> bool override
 
auto child_removed_event (Widget &child) -> bool override
 

Detailed Description

template<typename Layout_t, bool unselect_on_focus_out = true>
class ox::layout::Selecting< Layout_t, unselect_on_focus_out >

Adds a 'Selected Child' concept to Layout_t.

There is only a single selected child at a time. Keyboard and mouse selecting ability, scrolls when selection is off screeen. Depends on the Child Widgets of Layout_t to have a select() and unselect() method. Inherit from this and override key_press_event to perform actions on the selected_child(). Scroll action also moves the selected child index.

Member Function Documentation

◆ is_child_selected()

template<typename Layout_t , bool unselect_on_focus_out = true>
auto ox::layout::Selecting< Layout_t, unselect_on_focus_out >::is_child_selected ( ) const -> bool
inline

Return whether or not a child widget is currently selected.

Useful to call before selected_child(), if you don't want to catch.

◆ selected_index()

template<typename Layout_t , bool unselect_on_focus_out = true>
auto ox::layout::Selecting< Layout_t, unselect_on_focus_out >::selected_index ( ) const -> std::size_t
inline

Return the index into get_children() corresponding to the selected child.

Returns this->Widget::child_count() if no child is selected.


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