mousetrap v0.2.0
Loading...
Searching...
No Matches
mousetrap::ColumnView Class Reference

view that displays widget in a table, ordered by column More...

#include <column_view.hpp>

Inheritance diagram for mousetrap::ColumnView:
mousetrap::has_signal_unmap< ColumnView > mousetrap::has_signal_map< ColumnView > mousetrap::has_signal_show< ColumnView > mousetrap::has_signal_hide< ColumnView > mousetrap::has_signal_destroy< ColumnView > mousetrap::has_signal_unrealize< ColumnView > mousetrap::has_signal_realize< ColumnView > mousetrap::has_signal_activate< ColumnView > mousetrap::Widget

Classes

class  Column
 

Public Member Functions

 ColumnView (SelectionMode mode=SelectionMode::NONE)
 construct
 
 ColumnView (detail::ColumnViewInternal *)
 construct from internal
 
 ~ColumnView ()
 destructor
 
NativeObject get_internal () const override
 expose internal
 
Column push_back_column (const std::string &title)
 add a column to the end of the column view
 
Column push_front_column (const std::string &title)
 add a colum to the start of the column view
 
Column insert_column (uint64_t index, const std::string &title)
 insert a column at given position, inserts at the end if index is out of bounds
 
void remove_column (const Column &column)
 remove a column from the column view
 
Column get_column_at (uint64_t column_i)
 get column at specified position
 
Column get_column_with_title (const std::string &title)
 get column with given title
 
bool has_column_with_title (const std::string &title)
 get whether at least one column has given title
 
void set_widget_at (const Column &column, uint64_t row_i, const Widget &widget)
 set at row / column. If the row does not yet exist, the table will be backfilled with empty rows until the given index is reached. If the column does not yet exist, no action will be taken and the widget will not appear in the table
 
template<typename... WidgetRef_ts>
void push_back_row (WidgetRef_ts... widget_by_column)
 convenience function that maps widgets to columns and appends them as a new row at end of the list
 
template<typename... WidgetRef_ts>
void push_front_row (WidgetRef_ts... widget_by_column)
 convenience function that maps widgets to columns and appends them as a new row at end of the list
 
template<typename... WidgetRef_ts>
void insert_row_at (uint64_t i, WidgetRef_ts... widget_by_column)
 convenience functino that maps widgets to columns and appends them as a new row at end of the list
 
void set_enable_rubberband_selection (bool b)
 set whether the user is able to selecte multiple items by click-dragging
 
bool get_enable_rubberband_selection () const
 get whether the user is able to selecte multiple items by click-dragging
 
void set_show_row_separators (bool b)
 set whether rows should be separated
 
bool get_show_row_separators () const
 get whether row separators are shown
 
void set_show_column_separators (bool b)
 set whether columns should be separated
 
bool get_show_column_separators () const
 get whether row separators are shown
 
void set_single_click_activate (bool b)
 set whether the column views seletion model should emit an activate signal when the user clicks on an item in the view once
 
bool get_single_click_activate () const
 get whether the column views seletion model should emit an activate signal when the user clicks on an item in the view once
 
void set_is_reorderable (bool b)
 set whether user can reorder columns by click-dragging
 
bool get_is_reorderable () const
 get whether the user can reorder columns by click-dragging
 
SelectionModelget_selection_model ()
 expose the selection model
 
uint64_t get_n_rows () const
 get number of rows
 
uint64_t get_n_columns () const
 get number of columns
 
template<typename... Ts>
void push_back_row (Ts... widgets)
 
template<typename... Ts>
void push_front_row (Ts... widgets)
 
template<typename... Ts>
void insert_row_at (uint64_t i, Ts... widgets)
 
- Public Member Functions inherited from mousetrap::Widget
 Widget (detail::WidgetInternal *)
 construct from internal
 
virtual ~Widget ()
 default dtor
 
 Widget (const Widget &)=delete
 
Widgetoperator= (const Widget &) const =delete
 
 Widget (Widget &&other)=delete
 
Widgetoperator= (Widget &&)=delete
 
 operator NativeObject () const override
 implement signal emitter
 
NativeObject get_internal () const override
 expose internally managed object, \for_internal_use_only
 
virtual operator NativeWidget () const
 expose as GtkWidget, this is the only function that needs to be implemented in oder for an object to act as a widget
 
void activate ()
 activate the widget, if it is activatable. This will also trigger any associated animations or signals
 
Vector2f get_size_request ()
 get minimum allocated size
 
void set_size_request (Vector2f)
 set minimum allocated size
 
bool operator== (const Widget &other) const
 check if both widgets point to the same internal object
 
bool operator!= (const Widget &other) const
 check if both widgets point to the same internal object
 
void set_margin_top (float margin)
 set top margin, minimum distance to any other widget boundary
 
float get_margin_top () const
 get top margin, minimum distance to any other widget boundary
 
void set_margin_bottom (float margin)
 set bottom margin, minimum distance to any other widget boundary
 
float get_margin_bottom () const
 set botom margin, minimum distance to any other widget boundary
 
void set_margin_start (float margin)
 set left margin, minimum distance to any other widget boundary
 
float get_margin_start () const
 get left margin, minimum distance to any other widget boundary
 
void set_margin_end (float margin)
 set right margin, minimum distance to any other widget boundary
 
float get_margin_end () const
 get right margin, minimum distance to any other widget boundary
 
void set_margin_horizontal (float margin)
 set left and right margin, minimum distance to any other widget boundary
 
void set_margin_vertical (float margin)
 set top and bottom margin, minimum distance to any other widget boundary
 
void set_margin (float margin)
 set margin in all directions, minimum distance to any other widget boundary
 
void set_expand_horizontally (bool should_expand)
 set whether widget should attempt to allocate the maximum allowed space horizontally
 
bool get_expand_horizontally () const
 get whether widget should attempt to allocate the maximum allowed space horizontally
 
void set_expand_vertically (bool should_expand)
 set whether widget should attempt to allocate the maximum allowed space verticall
 
bool get_expand_vertically () const
 get whether widget should attempt to allocate the maximum allowed space vertically
 
void set_expand (bool both)
 set whether the widget should attempt to allocate the maximum allowed space in both dimensions
 
void set_horizontal_alignment (Alignment)
 set where the widget should align itself along the x-axis
 
Alignment get_horizontal_alignment () const
 get where the widget should align itself along the x-axis
 
void set_vertical_alignment (Alignment)
 set where the widget should align itself along the y-axis
 
Alignment get_vertical_alignment () const
 get where the widget should align itself along the y-axis
 
void set_alignment (Alignment both)
 set where the widget should align itself along both axes
 
void set_opacity (float opacity)
 set widget opacity, in [0, 1], if opacity is set to 0, equivalent to mousetrap::Widget::hide()
 
float get_opacity ()
 get widget opacity
 
void set_is_visible (bool b)
 set whether the widget should be hidden
 
bool get_is_visible ()
 get whether the widget is hidden
 
void set_tooltip_text (const std::string &text)
 set text displayed as a tooltip when the user hovers over the widget
 
void set_tooltip_widget (const Widget &widget)
 set arbitrary widget displayed as a tooltip when user hovers over the widget
 
void remove_tooltip_widget ()
 remove tooltip
 
void set_cursor (CursorType type)
 set the shape of cursor displayed when the cursor is above the widget
 
void set_cursor_from_image (const Image &image, Vector2i offset)
 set cursor from custom image
 
void hide ()
 hide the widget, this may set its allocated size to 0
 
void show ()
 show the widget, this allocates its size
 
void add_controller (const EventController &)
 add an event controller to the widget, a widget may have an arbitrary number of controllers
 
void remove_controller (const EventController &)
 remove an event controller from the widget, if event controller is not registered to widget, does nothing
 
void set_is_focusable (bool)
 set whether the widgets can contain input focus
 
bool get_is_focusable () const
 get whether widget can contain focus input focus
 
void grab_focus ()
 attempt to grab the input focus
 
bool get_has_focus ()
 get whether the wigdet currently holds input focus
 
void set_focus_on_click (bool)
 set whether the input should attempt to grab the focus when the user clicks on it
 
bool get_focus_on_click () const
 get whether the input should attempt to grab the focus when the user clicks on it
 
bool get_is_realized ()
 get whether the widget was realized
 
Vector2f get_minimum_size () const
 get minimum size, this will always be equal to or larger than the size request
 
Vector2f get_natural_size () const
 get natural size, this is the intended size of the widget if no expansion or clipping occurrs
 
Vector2f get_position () const
 get position
 
Vector2f get_allocated_size () const
 get allocated size
 
void unparent ()
 remove the widget from the container it is in, if any
 
void set_can_respond_to_input (bool)
 set whether the widget is allowed to gather input events. If set to false, the widget may appear "grayed out"
 
bool get_can_respond_to_input () const
 get whether the widget is allowed to gather input events
 
template<typename Function_t , typename Data_t >
void set_tick_callback (Function_t function, Data_t data)
 add a callback that is invoked every frame
 
template<typename Function_t >
void set_tick_callback (Function_t function)
 add a callback that is invoked every frame
 
void remove_tick_callback ()
 remove callback that si invoked every frame
 
Clipboard get_clipboard () const
 get the widgets associated clipboard
 
void set_hide_on_overflow (bool b)
 set whether a child widget inside this widget should be cutoff when it leaves this widgets boundary
 
bool get_hide_on_overflow () const
 get whether a child widget inside this widget should be cutoff when it leaves this widgets boundary
 
void set_listens_for_shortcut_actions (Action &)
 Convenience function that automatically adds the action to a shortcut controller of this widget.
 
void apply_style_class (const StyleClass &)
 apply style class to widget and its children
 
void add_css_class (const std::string &css)
 add css class
 
void remove_css_class (const std::string &css)
 remove css class
 
std::vector< std::string > get_css_classes () const
 get all applied css classes
 
- Public Member Functions inherited from mousetrap::SignalEmitter
void set_signal_blocked (const std::string &signal_id, bool b)
 block a signal by id \for_internal_use_only
 
bool get_signal_blocked (const std::string &signal_id) const
 get whether a signal is currently blocked
 
std::vector< std::string > get_all_signal_names ()
 get list of possible signal ids \for_internal_use_only
 
template<typename Function_t >
void connect_signal (const std::string &signal_id, Function_t *function, void *data=nullptr)
 connect static function to signal, does not work with lambdas \for_internal_use_only
 
void disconnect_signal (const std::string &signal_id)
 disconnect signal, it may not be invoked until reconnected, if signal is not registered, does nothing. For internal use only
 
virtual operator NativeObject () const =0
 expose as NativeObject, this is the GLib instance that signals are emitted on \for_internal_use_only
 
virtual NativeObject get_internal () const
 expose internally managed object, \for_internal_use_only
 
- Public Member Functions inherited from mousetrap::has_signal_activate< ColumnView >
void connect_signal_activate (Function_t f, Data_t data)
 connect handler, will be invoked when signal is emitted. Data is passed to the signal handler function
 
void connect_signal_activate (Function_t f)
 connect handler, will be invoked when signal is emitted
 
void set_signal_activate_blocked (bool b)
 
bool get_signal_activate_blocked () const
 
void emit_signal_activate ()
 invoke signal handler manually
 
void disconnect_signal_activate ()
 
- Public Member Functions inherited from mousetrap::has_signal_realize< ColumnView >
void connect_signal_realize (Function_t f, Data_t data)
 connect handler, will be invoked when signal is emitted. Data is passed to the signal handler function
 
void connect_signal_realize (Function_t f)
 connect handler, will be invoked when signal is emitted
 
void set_signal_realize_blocked (bool b)
 
bool get_signal_realize_blocked () const
 
void emit_signal_realize ()
 invoke signal handler manually
 
void disconnect_signal_realize ()
 
- Public Member Functions inherited from mousetrap::has_signal_unrealize< ColumnView >
void connect_signal_unrealize (Function_t f, Data_t data)
 connect handler, will be invoked when signal is emitted. Data is passed to the signal handler function
 
void connect_signal_unrealize (Function_t f)
 connect handler, will be invoked when signal is emitted
 
void set_signal_unrealize_blocked (bool b)
 Set whether signal emission should trigger the signal handler.
 
bool get_signal_unrealize_blocked () const
 get whether signal emission should trigger the signal handler
 
void emit_signal_unrealize ()
 invoke signal handler manually
 
void disconnect_signal_unrealize ()
 disconnect the signal handler
 
- Public Member Functions inherited from mousetrap::has_signal_destroy< ColumnView >
void connect_signal_destroy (Function_t f, Data_t data)
 connect handler, will be invoked when signal is emitted. Data is passed to the signal handler function
 
void connect_signal_destroy (Function_t f)
 connect handler, will be invoked when signal is emitted
 
void set_signal_destroy_blocked (bool b)
 Set whether signal emission should trigger the signal handler.
 
bool get_signal_destroy_blocked () const
 get whether signal emission should trigger the signal handler
 
void emit_signal_destroy ()
 invoke signal handler manually
 
void disconnect_signal_destroy ()
 disconnect the signal handler
 
- Public Member Functions inherited from mousetrap::has_signal_hide< ColumnView >
void connect_signal_hide (Function_t f, Data_t data)
 connect handler, will be invoked when signal is emitted. Data is passed to the signal handler function
 
void connect_signal_hide (Function_t f)
 connect handler, will be invoked when signal is emitted
 
void set_signal_hide_blocked (bool b)
 
bool get_signal_hide_blocked () const
 
void emit_signal_hide ()
 invoke signal handler manually
 
void disconnect_signal_hide ()
 
- Public Member Functions inherited from mousetrap::has_signal_show< ColumnView >
void connect_signal_show (Function_t f, Data_t data)
 connect handler, will be invoked when signal is emitted. Data is passed to the signal handler function
 
void connect_signal_show (Function_t f)
 connect handler, will be invoked when signal is emitted
 
void set_signal_show_blocked (bool b)
 
bool get_signal_show_blocked () const
 
void emit_signal_show ()
 invoke signal handler manually
 
void disconnect_signal_show ()
 
- Public Member Functions inherited from mousetrap::has_signal_map< ColumnView >
void connect_signal_map (Function_t f, Data_t data)
 connect handler, will be invoked when signal is emitted. Data is passed to the signal handler function
 
void connect_signal_map (Function_t f)
 connect handler, will be invoked when signal is emitted
 
void set_signal_map_blocked (bool b)
 
bool get_signal_map_blocked () const
 
void emit_signal_map ()
 invoke signal handler manually
 
void disconnect_signal_map ()
 
- Public Member Functions inherited from mousetrap::has_signal_unmap< ColumnView >
void connect_signal_unmap (Function_t f, Data_t data)
 connect handler, will be invoked when signal is emitted. Data is passed to the signal handler function
 
void connect_signal_unmap (Function_t f)
 connect handler, will be invoked when signal is emitted
 
void set_signal_unmap_blocked (bool b)
 
bool get_signal_unmap_blocked () const
 
void emit_signal_unmap ()
 invoke signal handler manually
 
void disconnect_signal_unmap ()
 

Additional Inherited Members

- Static Public Attributes inherited from mousetrap::has_signal_activate< ColumnView >
static const char * signal_id
 glib ID
 
- Static Public Attributes inherited from mousetrap::has_signal_realize< ColumnView >
static const char * signal_id
 glib ID
 
- Static Public Attributes inherited from mousetrap::has_signal_unrealize< ColumnView >
static const char * signal_id
 
- Static Public Attributes inherited from mousetrap::has_signal_destroy< ColumnView >
static const char * signal_id
 
- Static Public Attributes inherited from mousetrap::has_signal_hide< ColumnView >
static const char * signal_id
 glib ID
 
- Static Public Attributes inherited from mousetrap::has_signal_show< ColumnView >
static const char * signal_id
 glib ID
 
- Static Public Attributes inherited from mousetrap::has_signal_map< ColumnView >
static const char * signal_id
 glib ID
 
- Static Public Attributes inherited from mousetrap::has_signal_unmap< ColumnView >
static const char * signal_id
 glib ID
 
- Protected Member Functions inherited from mousetrap::Widget
 Widget (NativeWidget widget)
 ctor protected. Only inheriting classes should call this
 
- Protected Member Functions inherited from mousetrap::SignalEmitter
 SignalEmitter ()
 ctor
 
 ~SignalEmitter ()
 destructor
 
- Protected Member Functions inherited from mousetrap::has_signal_activate< ColumnView >
 has_signal_activate (ColumnView *instance)
 
- Protected Member Functions inherited from mousetrap::has_signal_realize< ColumnView >
 has_signal_realize (ColumnView *instance)
 
- Protected Member Functions inherited from mousetrap::has_signal_unrealize< ColumnView >
 has_signal_unrealize (ColumnView *instance)
 ctor protected
 
- Protected Member Functions inherited from mousetrap::has_signal_destroy< ColumnView >
 has_signal_destroy (ColumnView *instance)
 ctor protected
 
- Protected Member Functions inherited from mousetrap::has_signal_hide< ColumnView >
 has_signal_hide (ColumnView *instance)
 
- Protected Member Functions inherited from mousetrap::has_signal_show< ColumnView >
 has_signal_show (ColumnView *instance)
 
- Protected Member Functions inherited from mousetrap::has_signal_map< ColumnView >
 has_signal_map (ColumnView *instance)
 
- Protected Member Functions inherited from mousetrap::has_signal_unmap< ColumnView >
 has_signal_unmap (ColumnView *instance)
 

Detailed Description

view that displays widget in a table, ordered by column

signal id signature emitted when...
activate (ColumnView&, (Data_t)) -> void Widget is activated, usually by pressing Enter while it is in focus or otherwise triggering interaction with it
Signals inherited from Widget
realize (ColumnView&, (Data_t)) -> void Widget is realized, usually right before it is drawn for the first time
unrealize (ColumnView&, (Data_t)) -> void Widget is unmapped and will no longer be drawn
destroy (ColumnView&, (Data_t)) -> void Widgets internal state is deallocated, calling Widget::~Widget() may not necessarily emit this signal
hide (ColumnView&, (Data_t)) -> void Widget is actively hidden, leaves the visible area of the window, or its opacity is set to 0
show (ColumnView&, (Data_t)) -> void Widget is drawn for the first time after being realized
map (ColumnView&, (Data_t)) -> void Widget is mapped, this happens the first time it and all its parents become visible
unmap (ColumnView&, (Data_t)) -> void Widget and all of its parents become hidden

Constructor & Destructor Documentation

◆ ColumnView()

mousetrap::ColumnView::ColumnView ( SelectionMode  mode = SelectionMode::NONE)

construct

Parameters
modeselection mode, governs how many rows can be selected at one time

Member Function Documentation

◆ get_column_at()

ColumnView::Column mousetrap::ColumnView::get_column_at ( uint64_t  column_i)

get column at specified position

Parameters
column_iindex
Returns
column, may be a wrapped nullptr if column_i out of bounds

References mousetrap::log::critical().

◆ get_column_with_title()

ColumnView::Column mousetrap::ColumnView::get_column_with_title ( const std::string &  title)

get column with given title

Parameters
titlecurrent title of the column
Returns
column, may be a wrapped nullptr if column_i out of bounds

References mousetrap::log::critical().

◆ get_enable_rubberband_selection()

bool mousetrap::ColumnView::get_enable_rubberband_selection ( ) const

get whether the user is able to selecte multiple items by click-dragging

Returns
true if this type of selection should be enabled, false otherwise

◆ get_internal()

NativeObject mousetrap::ColumnView::get_internal ( ) const
overridevirtual

expose internal

Reimplemented from mousetrap::SignalEmitter.

◆ get_is_reorderable()

bool mousetrap::ColumnView::get_is_reorderable ( ) const

get whether the user can reorder columns by click-dragging

Returns
true if reorderable, false otherwise

◆ get_n_columns()

uint64_t mousetrap::ColumnView::get_n_columns ( ) const

get number of columns

Returns
uint64_t

◆ get_n_rows()

uint64_t mousetrap::ColumnView::get_n_rows ( ) const

get number of rows

Returns
uint64_t

◆ get_selection_model()

SelectionModel * mousetrap::ColumnView::get_selection_model ( )

expose the selection model

Returns
selection model

◆ get_show_column_separators()

bool mousetrap::ColumnView::get_show_column_separators ( ) const

get whether row separators are shown

Returns
true if separators are visible, false otherwise

◆ get_show_row_separators()

bool mousetrap::ColumnView::get_show_row_separators ( ) const

get whether row separators are shown

Returns
true if separators are visible, false otherwise

◆ get_single_click_activate()

bool mousetrap::ColumnView::get_single_click_activate ( ) const

get whether the column views seletion model should emit an activate signal when the user clicks on an item in the view once

Returns
true if signal emissions this way should be allowed, false otherwise

◆ has_column_with_title()

bool mousetrap::ColumnView::has_column_with_title ( const std::string &  title)

get whether at least one column has given title

Parameters
title
Returns
true if at least once column with that title exists, false otherwise

◆ insert_column()

ColumnView::Column mousetrap::ColumnView::insert_column ( uint64_t  index,
const std::string &  title 
)

insert a column at given position, inserts at the end if index is out of bounds

Parameters
indexindex of column to insert a new column after
titleheader name for the column
Returns
pointer to newly created column iterator

◆ insert_row_at()

template<typename... WidgetRef_ts>
void mousetrap::ColumnView::insert_row_at ( uint64_t  i,
WidgetRef_ts...  widget_by_column 
)

convenience functino that maps widgets to columns and appends them as a new row at end of the list

Template Parameters
WidgetRef_tshas to be Widget, Widget& or const Widget&
Parameters
irow index, table is backfilled if current number of rows is less than i
widget_by_column

◆ push_back_column()

ColumnView::Column mousetrap::ColumnView::push_back_column ( const std::string &  title)

add a column to the end of the column view

Parameters
titleheader name for the column
Returns
pointer to newly created column iterator

◆ push_back_row()

template<typename... WidgetRef_ts>
void mousetrap::ColumnView::push_back_row ( WidgetRef_ts...  widget_by_column)

convenience function that maps widgets to columns and appends them as a new row at end of the list

Template Parameters
WidgetRef_tshas to be Widget, Widget& or const Widget&
Parameters
widget_by_columnnumber of widgets has to smaller than or equal to the number of columns

◆ push_front_column()

ColumnView::Column mousetrap::ColumnView::push_front_column ( const std::string &  title)

add a colum to the start of the column view

Parameters
titleheader name for the column
Returns
pointer to newly created column iterator

◆ push_front_row()

template<typename... WidgetRef_ts>
void mousetrap::ColumnView::push_front_row ( WidgetRef_ts...  widget_by_column)

convenience function that maps widgets to columns and appends them as a new row at end of the list

Template Parameters
WidgetRef_tshas to be Widget, Widget& or const Widget&
Parameters
widget_by_column

◆ remove_column()

void mousetrap::ColumnView::remove_column ( const Column column)

remove a column from the column view

Parameters
column

◆ set_enable_rubberband_selection()

void mousetrap::ColumnView::set_enable_rubberband_selection ( bool  b)

set whether the user is able to selecte multiple items by click-dragging

Parameters
btrue if this type of selection should be enabled, false otherwise

◆ set_is_reorderable()

void mousetrap::ColumnView::set_is_reorderable ( bool  b)

set whether user can reorder columns by click-dragging

Parameters
btrue if reorderable, false otherwise

◆ set_show_column_separators()

void mousetrap::ColumnView::set_show_column_separators ( bool  b)

set whether columns should be separated

Parameters
btrue if spearators should be visible, false otherwise

◆ set_show_row_separators()

void mousetrap::ColumnView::set_show_row_separators ( bool  b)

set whether rows should be separated

Parameters
btrue if separators should be visible, false otherwise

◆ set_single_click_activate()

void mousetrap::ColumnView::set_single_click_activate ( bool  b)

set whether the column views seletion model should emit an activate signal when the user clicks on an item in the view once

Parameters
btrue if signal emissions this way should be allowed, false otherwise

◆ set_widget_at()

void mousetrap::ColumnView::set_widget_at ( const Column column,
uint64_t  row_i,
const Widget widget 
)

set at row / column. If the row does not yet exist, the table will be backfilled with empty rows until the given index is reached. If the column does not yet exist, no action will be taken and the widget will not appear in the table

Parameters
columncolumn
row_irow index
widgetwidget to insert

References mousetrap::log::critical().


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