gtkdataboxmm  0.9.4
Public Member Functions | Protected Member Functions | Related Functions | List of all members
GDatabox::Databox Class Reference

#include <gtkdataboxmm/databox.h>

Inheritance diagram for GDatabox::Databox:
Inheritance graph
[legend]

Public Member Functions

virtual ~Databox ()
 
GtkDatabox* gobj ()
 Provides access to the underlying C GtkObject. More...
 
const GtkDatabox* gobj () const
 Provides access to the underlying C GtkObject. More...
 
 Databox ()
 
 Databox (Gtk::Table** table, bool scrollbar_x=false, bool scrollbar_y=false, bool ruler_x=false, bool ruler_y=false)
 
int graph_add (const Glib::RefPtr< Graph >& graph)
 Adds the graph to the box. More...
 
int graph_remove (const Glib::RefPtr< Graph >& graph)
 Removes the graph from the box once. More...
 
int graph_remove_all ()
 Removes all graphs from the box. More...
 
int auto_rescale (float border)
 This function is similar to set_total_limits(). More...
 
int calculate_extrema (float& min_x, float& max_x, float& min_y, float& max_y)
 Determines the minimum and maximum x and y values of all Gtk::DataboxGraph objects which have been added to the Gtk::Databox widget via graph_add(). More...
 
void set_total_limits (float left, float right, float top, float bottom)
 This function is used to set the limits of the total display area of box. More...
 
void set_visible_limits (float left, float right, float top, float bottom)
 This function is used to set the limits of the visible display area of box. More...
 
void get_total_limits (float&left, float&right, float& top, float& bottom) const
 Gives the total limits (as set by auto_rescale() or set_total_limits()). More...
 
void get_visible_limits (float&left, float&right, float& top, float& bottom) const
 Gives the current visible limits. More...
 
void set_adjustment_x (Gtk::Adjustment& adj)
 Setter function for the Gtk::Databox::property_adjustment_x() property. More...
 
void set_adjustment_y (Gtk::Adjustment& adj)
 Setter function for the Gtk::Databox::property_adjustment_y() property. More...
 
Gtk::Adjustment* get_adjustment_x ()
 Getter function for the Gtk::Databox::property_adjustment_x() property. More...
 
const Gtk::Adjustment* get_adjustment_x () const
 Getter function for the Gtk::Databox::property_adjustment_x() property. More...
 
Gtk::Adjustment* get_adjustment_y ()
 Getter function for the Gtk::Databox::property_adjustment_y() property. More...
 
const Gtk::Adjustment* get_adjustment_y () const
 Getter function for the Gtk::Databox::property_adjustment_y() property. More...
 
void set_ruler_x (const Ruler& ruler)
 Setter function for the Gtk::Databox::property_ruler_x() property. More...
 
void set_ruler_y (const Ruler& ruler)
 Setter function for the Gtk::Databox::property_ruler_y() property. More...
 
const Rulerget_ruler_x () const
 Getter function for the Gtk::Databox::property_ruler_x() property. More...
 
const Rulerget_ruler_y () const
 Getter function for the Gtk::Databox::property_ruler_y() property. More...
 
void set_enable_selection (bool enable)
 Setter function for the Gtk::Databox::property_enable_selection() property. More...
 
void set_enable_zoom (bool enable)
 Setter function for the Gtk::Databox::property_enable_zoom() property. More...
 
bool get_enable_selection () const
 Getter function for the Gtk::Databox::property_enable_selection() property. More...
 
bool get_enable_zoom () const
 Getter function for the Gtk::Databox::property_enable_selection() property. More...
 
void zoom_to_selection ()
 This is equivalent to left-clicking into the selected area. More...
 
void zoom_out ()
 This is equivalent to right-clicking into the box. More...
 
void zoom_home ()
 This is equivalent to shift right-clicking into the box. More...
 
short value_to_pixel_x (float value)
 Calculates the horizontal pixel coordinate which represents the x value. More...
 
short value_to_pixel_y (float value)
 Calculates the horizontal pixel coordinate which represents the x value. More...
 
float pixel_to_value_x (short pixel)
 Calculates the x value which is represented by the horizontal pixel coordinate. More...
 
float pixel_to_value_y (short pixel)
 Calculates the y value which is represented by the vertical pixel coordinate. More...
 
Glib::RefPtr< Gdk::Pixmap > get_backing_pixmap () const
 This function returns the pixmap which is used by box and its Gtk::DataboxGraph objects for drawing operations before copying the result to the screen. More...
 
Glib::SignalProxy0< void > signal_zoomed ()
 
Glib::SignalProxy0< void > signal_selection_canceled ()
 
Glib::PropertyProxy< bool > property_enable_selection ()
 Enable selection of areas via mouse (TRUE/FALSE). More...
 
Glib::PropertyProxy_ReadOnly< bool > property_enable_selection () const
 Enable selection of areas via mouse (TRUE/FALSE). More...
 
Glib::PropertyProxy< bool > property_enable_zoom ()
 Enable zooming in or out via mouse click (TRUE/FALSE). More...
 
Glib::PropertyProxy_ReadOnly< bool > property_enable_zoom () const
 Enable zooming in or out via mouse click (TRUE/FALSE). More...
 
Glib::PropertyProxy< Gtk::Adjustment*> property_adjustment_x ()
 GtkAdjustment for horizontal scrolling. More...
 
Glib::PropertyProxy_ReadOnly< Gtk::Adjustment*> property_adjustment_x () const
 GtkAdjustment for horizontal scrolling. More...
 
Glib::PropertyProxy< Gtk::Adjustment*> property_adjustment_y ()
 GtkAdjustment for vertical scrolling. More...
 
Glib::PropertyProxy_ReadOnly< Gtk::Adjustment*> property_adjustment_y () const
 GtkAdjustment for vertical scrolling. More...
 
Glib::PropertyProxy< Rulerproperty_ruler_x ()
 A horizontal GtkDataboxRuler or NULL. More...
 
Glib::PropertyProxy_ReadOnly< Rulerproperty_ruler_x () const
 A horizontal GtkDataboxRuler or NULL. More...
 
Glib::PropertyProxy< Rulerproperty_ruler_y ()
 A vertical GtkDataboxRuler or NULL. More...
 
Glib::PropertyProxy_ReadOnly< Rulerproperty_ruler_y () const
 A vertical GtkDataboxRuler or NULL. More...
 

Protected Member Functions

virtual void on_zoomed ()
 This is a default handler for the signal signal_zoomed(). More...
 
virtual void on_selection_canceled ()
 This is a default handler for the signal signal_selection_canceled(). More...
 

Related Functions

(Note that these are not member functions.)

GDatabox::Databoxwrap (GtkDatabox* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Constructor & Destructor Documentation

§ ~Databox()

virtual GDatabox::Databox::~Databox ( )
virtual

§ Databox() [1/2]

GDatabox::Databox::Databox ( )

§ Databox() [2/2]

GDatabox::Databox::Databox ( Gtk::Table **  table,
bool  scrollbar_x = false,
bool  scrollbar_y = false,
bool  ruler_x = false,
bool  ruler_y = false 
)
explicit

Member Function Documentation

§ auto_rescale()

int GDatabox::Databox::auto_rescale ( float  border)

This function is similar to set_total_limits().

It sets the total limits to match the data extrema (see calculate_extrema()). If you do not like data pixels exactly at the widget's border, you can add modify the limits using the border parameter: The limits are extended by border*(max-min) if max!=min. If max==min, they are extended by border* max (otherwise the data could not be scaled to the pixel realm).

After calling this function, x values grow from left to right, y values grow from bottom to top.

Parameters
borderRelative border width (e.g. 0.1 means that the border on each side is 10% of the data area).
Returns
0 on success, -1 if box is no GtkDatabox widget, -2 if no datasets are available.

§ calculate_extrema()

int GDatabox::Databox::calculate_extrema ( float &  min_x,
float &  max_x,
float &  min_y,
float &  max_y 
)

Determines the minimum and maximum x and y values of all Gtk::DataboxGraph objects which have been added to the Gtk::Databox widget via graph_add().

Parameters
min_xWill be filled with the lowest x value of all datasets.
max_xWill be filled with the highest x value of all datasets.
min_yWill be filled with the lowest y value of all datasets.
max_yWill be filled with the highest y value of all datasets.
Returns
0 on success, -1 if box is no GtkDatabox widget, -2 if no datasets are available.

§ get_adjustment_x() [1/2]

Gtk::Adjustment* GDatabox::Databox::get_adjustment_x ( )

Getter function for the Gtk::Databox::property_adjustment_x() property.

Returns
The Gtk::Databox::property_adjustment_x() property value.

§ get_adjustment_x() [2/2]

const Gtk::Adjustment* GDatabox::Databox::get_adjustment_x ( ) const

Getter function for the Gtk::Databox::property_adjustment_x() property.

Returns
The Gtk::Databox::property_adjustment_x() property value.

§ get_adjustment_y() [1/2]

Gtk::Adjustment* GDatabox::Databox::get_adjustment_y ( )

Getter function for the Gtk::Databox::property_adjustment_y() property.

Returns
The Gtk::Databox::property_adjustment_y() property value.

§ get_adjustment_y() [2/2]

const Gtk::Adjustment* GDatabox::Databox::get_adjustment_y ( ) const

Getter function for the Gtk::Databox::property_adjustment_y() property.

Returns
The Gtk::Databox::property_adjustment_y() property value.

§ get_backing_pixmap()

Glib::RefPtr<Gdk::Pixmap> GDatabox::Databox::get_backing_pixmap ( ) const

This function returns the pixmap which is used by box and its Gtk::DataboxGraph objects for drawing operations before copying the result to the screen.

The function is typically called by the Gtk::DataboxGraph objects.

Returns
Backing pixmap.

§ get_enable_selection()

bool GDatabox::Databox::get_enable_selection ( ) const

Getter function for the Gtk::Databox::property_enable_selection() property.

Returns
The Gtk::Databox::property_enable_selection() property value.

§ get_enable_zoom()

bool GDatabox::Databox::get_enable_zoom ( ) const

Getter function for the Gtk::Databox::property_enable_selection() property.

Returns
The Gtk::Databox::property_enable_selection() property value.

§ get_ruler_x()

const Ruler* GDatabox::Databox::get_ruler_x ( ) const

Getter function for the Gtk::Databox::property_ruler_x() property.

Returns
The Gtk::Databox::property_ruler_x() property value.

§ get_ruler_y()

const Ruler* GDatabox::Databox::get_ruler_y ( ) const

Getter function for the Gtk::Databox::property_ruler_y() property.

Returns
The Gtk::Databox::property_ruler_y() property value.

§ get_total_limits()

void GDatabox::Databox::get_total_limits ( float &  left,
float &  right,
float &  top,
float &  bottom 
) const

Gives the total limits (as set by auto_rescale() or set_total_limits()).

Parameters
leftSpace for total left value or #0.
rightSpace for total right value or #0.
topSpace for total top value or #0.
bottomSpace for total bottom value or #0.

§ get_visible_limits()

void GDatabox::Databox::get_visible_limits ( float &  left,
float &  right,
float &  top,
float &  bottom 
) const

Gives the current visible limits.

These differ from those given by get_total_limits() if you zoomed into the data for instance by zoom_to_selection() or set_visible_limits() (these values can be changed by scrolling, of course).

Parameters
leftSpace for visible left value or #0.
rightSpace for visible right value or #0.
topSpace for visible top value or #0.
bottomSpace for visible bottom value or #0.

§ gobj() [1/2]

GtkDatabox* GDatabox::Databox::gobj ( )
inline

Provides access to the underlying C GtkObject.

§ gobj() [2/2]

const GtkDatabox* GDatabox::Databox::gobj ( ) const
inline

Provides access to the underlying C GtkObject.

§ graph_add()

int GDatabox::Databox::graph_add ( const Glib::RefPtr< Graph >&  graph)

Adds the graph to the box.

The next time the box is re-drawn, the graph will be shown.

It might be becessary to modify the total_limits in order for the graph to be displayed properly (see set_total_limits()).

Parameters
graphA graph, e.g. a Gtk::DataboxPoints or a Gtk::DataboxGrid object.
Returns
0 on success, -1 otherwise.

§ graph_remove()

int GDatabox::Databox::graph_remove ( const Glib::RefPtr< Graph >&  graph)

Removes the graph from the box once.

The next time the box is re-drawn, the graph will not be shown (unless it was added more than once).

Parameters
graphA graph, e.g. a Gtk::DataboxPoints or a Gtk::DataboxGrid object.
Returns
0 on success, -1 otherwise.

§ graph_remove_all()

int GDatabox::Databox::graph_remove_all ( )

Removes all graphs from the box.

The next time the box is re-drawn, no graphs will be shown.

Returns
0 on success, -1 otherwise.

§ on_selection_canceled()

virtual void GDatabox::Databox::on_selection_canceled ( )
protectedvirtual

This is a default handler for the signal signal_selection_canceled().

§ on_zoomed()

virtual void GDatabox::Databox::on_zoomed ( )
protectedvirtual

This is a default handler for the signal signal_zoomed().

§ pixel_to_value_x()

float GDatabox::Databox::pixel_to_value_x ( short  pixel)

Calculates the x value which is represented by the horizontal pixel coordinate.

Pixel coordinates are relative to the top-left corner of the box which is equivalent to (0,0).

Parameters
pixelA horizontal pixel coordinate.
Returns
X value.

§ pixel_to_value_y()

float GDatabox::Databox::pixel_to_value_y ( short  pixel)

Calculates the y value which is represented by the vertical pixel coordinate.

Pixel coordinates are relative to the top-left corner of the box which is equivalent to (0,0).

Parameters
pixelA vertical pixel coordinate.
Returns
Y value.

§ property_adjustment_x() [1/2]

Glib::PropertyProxy< Gtk::Adjustment* > GDatabox::Databox::property_adjustment_x ( )

GtkAdjustment for horizontal scrolling.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_adjustment_x() [2/2]

Glib::PropertyProxy_ReadOnly< Gtk::Adjustment* > GDatabox::Databox::property_adjustment_x ( ) const

GtkAdjustment for horizontal scrolling.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_adjustment_y() [1/2]

Glib::PropertyProxy< Gtk::Adjustment* > GDatabox::Databox::property_adjustment_y ( )

GtkAdjustment for vertical scrolling.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_adjustment_y() [2/2]

Glib::PropertyProxy_ReadOnly< Gtk::Adjustment* > GDatabox::Databox::property_adjustment_y ( ) const

GtkAdjustment for vertical scrolling.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_enable_selection() [1/2]

Glib::PropertyProxy< bool > GDatabox::Databox::property_enable_selection ( )

Enable selection of areas via mouse (TRUE/FALSE).

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_enable_selection() [2/2]

Glib::PropertyProxy_ReadOnly< bool > GDatabox::Databox::property_enable_selection ( ) const

Enable selection of areas via mouse (TRUE/FALSE).

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_enable_zoom() [1/2]

Glib::PropertyProxy< bool > GDatabox::Databox::property_enable_zoom ( )

Enable zooming in or out via mouse click (TRUE/FALSE).

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_enable_zoom() [2/2]

Glib::PropertyProxy_ReadOnly< bool > GDatabox::Databox::property_enable_zoom ( ) const

Enable zooming in or out via mouse click (TRUE/FALSE).

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_ruler_x() [1/2]

Glib::PropertyProxy< Ruler > GDatabox::Databox::property_ruler_x ( )

A horizontal GtkDataboxRuler or NULL.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_ruler_x() [2/2]

Glib::PropertyProxy_ReadOnly< Ruler > GDatabox::Databox::property_ruler_x ( ) const

A horizontal GtkDataboxRuler or NULL.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_ruler_y() [1/2]

Glib::PropertyProxy< Ruler > GDatabox::Databox::property_ruler_y ( )

A vertical GtkDataboxRuler or NULL.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ property_ruler_y() [2/2]

Glib::PropertyProxy_ReadOnly< Ruler > GDatabox::Databox::property_ruler_y ( ) const

A vertical GtkDataboxRuler or NULL.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

§ set_adjustment_x()

void GDatabox::Databox::set_adjustment_x ( Gtk::Adjustment &  adj)

Setter function for the Gtk::Databox::property_adjustment_x() property.

Normally, it should not be required to use this function, see property documentation.

Parameters
adjA Gtk::Adjustment object.

§ set_adjustment_y()

void GDatabox::Databox::set_adjustment_y ( Gtk::Adjustment &  adj)

Setter function for the Gtk::Databox::property_adjustment_y() property.

Normally, it should not be required to use this function, see property documentation.

Parameters
adjA Gtk::Adjustment object.

§ set_enable_selection()

void GDatabox::Databox::set_enable_selection ( bool  enable)

Setter function for the Gtk::Databox::property_enable_selection() property.

Parameters
enableWhether selection via mouse is enabled or not.

§ set_enable_zoom()

void GDatabox::Databox::set_enable_zoom ( bool  enable)

Setter function for the Gtk::Databox::property_enable_zoom() property.

Parameters
enableWhether zoom via mouse is enabled or not.

§ set_ruler_x()

void GDatabox::Databox::set_ruler_x ( const Ruler ruler)

Setter function for the Gtk::Databox::property_ruler_x() property.

Parameters
rulerA Gtk::DataboxRuler object.

§ set_ruler_y()

void GDatabox::Databox::set_ruler_y ( const Ruler ruler)

Setter function for the Gtk::Databox::property_ruler_y() property.

Parameters
rulerAn Gtk::DataboxRuler object.

§ set_total_limits()

void GDatabox::Databox::set_total_limits ( float  left,
float  right,
float  top,
float  bottom 
)

This function is used to set the limits of the total display area of box.

This function can be used to invert the orientation of the displayed graphs, e.g. top=-1000 and bottom=0.

Side effect: The box also internally calls set_visible_limits() with the same values.

Parameters
leftLeft total limit.
rightRight total limit.
topTop total limit.
bottomBottom total limit.

§ set_visible_limits()

void GDatabox::Databox::set_visible_limits ( float  left,
float  right,
float  top,
float  bottom 
)

This function is used to set the limits of the visible display area of box.

The visible display area can be section of the total area, i.e. the box zooms in, showing only a part of the complete picture.

The orientation of the values have to be the same as in set_total_limits() and the visible limits have to be within the total limits. The values will not be used otherwise.

Side effect: The box emits Gtk::Databox::signal_zoomed().

Parameters
leftLeft visible limit.
rightRight visible limit.
topTop visible limit.
bottomBottom visible limit.

§ signal_selection_canceled()

Glib::SignalProxy0< void > GDatabox::Databox::signal_selection_canceled ( )
Slot Prototype:
void on_my_selection_canceled()

This signal is emitted after a right click outside a selection rectangle.

§ signal_zoomed()

Glib::SignalProxy0< void > GDatabox::Databox::signal_zoomed ( )
Slot Prototype:
void on_my_zoomed()

This signal is emitted each time the zoom of the widget is changed, see for example Gtk::Databox::zoom_to_selection(), Gtk::Databox::set_visible_limits().

§ value_to_pixel_x()

short GDatabox::Databox::value_to_pixel_x ( float  value)

Calculates the horizontal pixel coordinate which represents the x value.

Pixel coordinates are relative to the top-left corner of the box which is equivalent to (0,0).

Parameters
valueAn x value.
Returns
Pixel coordinate.

§ value_to_pixel_y()

short GDatabox::Databox::value_to_pixel_y ( float  value)

Calculates the horizontal pixel coordinate which represents the x value.

Pixel coordinates are relative to the top-left corner of the box which is equivalent to (0,0).

Parameters
valueAn x value.
Returns
Pixel coordinate.

§ zoom_home()

void GDatabox::Databox::zoom_home ( )

This is equivalent to shift right-clicking into the box.

This function works, if the attribute #enable-zoom is set to #true. It is equivalent to calling the set_visible_limits() with the total limits.

§ zoom_out()

void GDatabox::Databox::zoom_out ( )

This is equivalent to right-clicking into the box.

This function works, if the attribute #enable-zoom is set to #true. Calling the function then zooms out by a factor of 2 in both dimensions (the maximum is defined by the total limits, see set_total_limits()).

Side effect: The box emits Gtk::Databox::signal_zoomed().

§ zoom_to_selection()

void GDatabox::Databox::zoom_to_selection ( )

This is equivalent to left-clicking into the selected area.

This function works, if the attribute #enable-zoom is set to #true. Calling the function then zooms to the area selected with the mouse.

Side effect: The box emits Gtk::Databox::signal_zoomed().

Friends And Related Function Documentation

§ wrap()

GDatabox::Databox* wrap ( GtkDatabox *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.

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