SBB Host
Host communication with the self balancing bike.
Loading...
Searching...
No Matches
StreamTreeView Class Reference

A class for the stream tree view. More...

#include <StreamTreeView.h>

Inheritance diagram for StreamTreeView:

Public Member Functions

 StreamTreeView (Gtk::ApplicationWindow *win)
 Constructor. More...
 
virtual ~StreamTreeView ()
 Destructor. More...
 
void set_graph (CGraph::CairoGraph *graph)
 Set the graph pointer. More...
 
void append_row (int id, Glib::ustring name, Gdk::RGBA rgba=Gdk::RGBA(0.5, 0.5, 0.5), CairoGraphLineStyle linetype=CairoGraphLineStyle::SOLID_LINE)
 Append a row. More...
 
void create_column ()
 Create the column(s). More...
 
void set_popover_sensitive (bool sensitive=true)
 Set the popover menu sensitive. More...
 
std::vector< int > get_col_id_selected ()
 Get the ID of the selected signal(s). More...
 

Protected Attributes

Gtk::ApplicationWindow * p_win = nullptr
 Gtk::ApplicationWindow pointer to the application main window. More...
 
CGraph::CairoGraph * p_graph = nullptr
 CGraph::CairoGraph pointer to the stream graph. More...
 
TreeColumnsp_treeColumns = nullptr
 TreeColumns pointer for the format of the tree view column(s). More...
 
Glib::RefPtr< Gtk::ListStore > p_TreeModel = nullptr
 Gtk::ListStore pointer for the tree view model. More...
 
Glib::RefPtr< Gtk::TreeSelection > p_TreeSelection = nullptr
 Gtk::TreeSelection pointer for the tree view selection. More...
 
std::unique_ptr< Gtk::PopoverMenu > p_popOverMenu = nullptr
 Gtk::PopoverMenu pointer for the popover menu in the tree view. More...
 
Glib::RefPtr< Gio::SimpleActionGroup > p_actionGroup
 Gio::SimpleActionGroup pointer for simple actions in the popover menu. More...
 
Glib::RefPtr< Gio::SimpleAction > p_lineTypeAction
 Gio::SimpleActionGroup pointer for line-type action in the popover menu. More...
 
std::unique_ptr< Gtk::ColorChooserDialog > p_colorChooser
 Gtk::ColorChooserDialog pointer for the color chooser dialog. More...
 
Glib::RefPtr< Gtk::Builder > p_builder
 Gtk::Builder pointer to read the popover menu from the XML file. More...
 

Private Member Functions

void on_popover_button_pressed (int n_press, double x, double y)
 Callback for popover item pressed. More...
 
void on_menu_set_color ()
 Callback for the set color. More...
 
void on_menu_set_linetype (int type)
 Callback for the set linetype. More...
 
void on_color_chooser_response (int id)
 Callback for the color chooser response. More...
 
void on_stream_tree_selected ()
 Callback for the tree view selected. More...
 
std::vector< Gtk::TreeModel::iterator > get_selected ()
 Get the selected signals(s). More...
 
std::vector< Gdk::RGBA > get_col_rgba_selected ()
 Get the RGB color of the selected signal(s). More...
 
std::vector< CairoGraphLineStyle > get_col_linetype_selected ()
 Get the linetype of the selected signal(s). More...
 

Detailed Description

A class for the stream tree view.

Class for the tree view in the stream tab, extending the Gtk::TreeView class and allowing selection of the signal to be shown in the graph during signal streaming. Class used in SBBHostApp.

See also
SBBHostApp
Author
Stefano Lovato
Date
2022

Constructor & Destructor Documentation

◆ StreamTreeView()

StreamTreeView::StreamTreeView ( Gtk::ApplicationWindow *  win)

Constructor.

Default constructor.

Parameters
winThe pointer to the main window of SBBHostApp.
See also
SBBHostApp

◆ ~StreamTreeView()

virtual StreamTreeView::~StreamTreeView ( )
virtual

Destructor.

Default destructor.

Member Function Documentation

◆ append_row()

void StreamTreeView::append_row ( int  id,
Glib::ustring  name,
Gdk::RGBA  rgba = Gdk::RGBA(0.5, 0.5, 0.5),
CairoGraphLineStyle  linetype = CairoGraphLineStyle::SOLID_LINE 
)

Append a row.

Function to append a signal row to the tree view.

Parameters
idThe ID of the signal.
nameThe name of the signal.
rgbaThe Gdk::RGBA line color to assign to the graph. Default RGB is (0.5,0.5,0.5).
linetypeThe CairoGraphLineStyle line type to assign to the graph. Default is solid line.

◆ create_column()

void StreamTreeView::create_column ( )

Create the column(s).

Function to create the column(s) in the tree view.

◆ get_col_id_selected()

std::vector< int > StreamTreeView::get_col_id_selected ( )

Get the ID of the selected signal(s).

Function to get the ID of the selected signal(s) in the tree view.

Returns
A std::vector<int> containing the selected signal ID(s).

◆ get_col_linetype_selected()

std::vector< CairoGraphLineStyle > StreamTreeView::get_col_linetype_selected ( )
private

Get the linetype of the selected signal(s).

Function to get the CairoGraphLineStyle linetype object of the selected signal(s) in the tree view.

Returns
A std::vector<CairoGraphLineStyle> containing the selected signal linetype(s).

◆ get_col_rgba_selected()

std::vector< Gdk::RGBA > StreamTreeView::get_col_rgba_selected ( )
private

Get the RGB color of the selected signal(s).

Function to get the Gdk::RGBA color object of the selected signal(s) in the tree view.

Returns
A std::vector<Gdk::RGBA> containing the selected signal color(s).

◆ get_selected()

std::vector< Gtk::TreeModel::iterator > StreamTreeView::get_selected ( )
private

Get the selected signals(s).

Function to get the selected signal(s) in the tree view.

Returns
A std::vector containing the selected signal(s), represented by a Gtk::TreeModel::iterator.

◆ on_color_chooser_response()

void StreamTreeView::on_color_chooser_response ( int  id)
private

Callback for the color chooser response.

Callback function called when exiting from the color chooser dialog.

See also
Gtk::ColorChooserDialog
Parameters
idThe response ID.

◆ on_menu_set_color()

void StreamTreeView::on_menu_set_color ( )
private

Callback for the set color.

Callback function called when selecting the 'Set color' button in the popover menu.

◆ on_menu_set_linetype()

void StreamTreeView::on_menu_set_linetype ( int  type)
private

Callback for the set linetype.

Callback function called when selecting the 'Set linetype' button in the popover menu.

◆ on_popover_button_pressed()

void StreamTreeView::on_popover_button_pressed ( int  n_press,
double  x,
double  y 
)
private

Callback for popover item pressed.

Callback function called when pressing a button of the popover menu.

See also
Glib::SignalProxy<void(int, double, double)> Gtk::GestureClick::signal_pressed()
Parameters
n_pressHow many touch/button presses happened with this one.
xThe X coordinate, in widget allocation coordinates.
yThe Y coordinate, in widget allocation coordinates.

◆ on_stream_tree_selected()

void StreamTreeView::on_stream_tree_selected ( )
private

Callback for the tree view selected.

Callback function called when selecting a signal in the trew view.

◆ set_graph()

void StreamTreeView::set_graph ( CGraph::CairoGraph *  graph)

Set the graph pointer.

Function to set the stream graph pointer, in order to have full access to the graph.

Parameters
graphThe pointer to the CGraph::CairoGraph graph object.

◆ set_popover_sensitive()

void StreamTreeView::set_popover_sensitive ( bool  sensitive = true)

Set the popover menu sensitive.

Function to set the popover menu of the tree view sensitive or not.

Parameters
sensitiveTrue or false if to set sensitive or nor.

Member Data Documentation

◆ p_actionGroup

Glib::RefPtr<Gio::SimpleActionGroup> StreamTreeView::p_actionGroup
protected

Gio::SimpleActionGroup pointer for simple actions in the popover menu.

◆ p_builder

Glib::RefPtr<Gtk::Builder> StreamTreeView::p_builder
protected

Gtk::Builder pointer to read the popover menu from the XML file.

◆ p_colorChooser

std::unique_ptr<Gtk::ColorChooserDialog> StreamTreeView::p_colorChooser
protected

Gtk::ColorChooserDialog pointer for the color chooser dialog.

◆ p_graph

CGraph::CairoGraph* StreamTreeView::p_graph = nullptr
protected

CGraph::CairoGraph pointer to the stream graph.

◆ p_lineTypeAction

Glib::RefPtr<Gio::SimpleAction> StreamTreeView::p_lineTypeAction
protected

Gio::SimpleActionGroup pointer for line-type action in the popover menu.

◆ p_popOverMenu

std::unique_ptr<Gtk::PopoverMenu> StreamTreeView::p_popOverMenu = nullptr
protected

Gtk::PopoverMenu pointer for the popover menu in the tree view.

◆ p_treeColumns

TreeColumns* StreamTreeView::p_treeColumns = nullptr
protected

TreeColumns pointer for the format of the tree view column(s).

◆ p_TreeModel

Glib::RefPtr<Gtk::ListStore> StreamTreeView::p_TreeModel = nullptr
protected

Gtk::ListStore pointer for the tree view model.

◆ p_TreeSelection

Glib::RefPtr<Gtk::TreeSelection> StreamTreeView::p_TreeSelection = nullptr
protected

Gtk::TreeSelection pointer for the tree view selection.

◆ p_win

Gtk::ApplicationWindow* StreamTreeView::p_win = nullptr
protected

Gtk::ApplicationWindow pointer to the application main window.