Panda3D
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
GtkStatsGraph Class Reference

This is just an abstract base class to provide a common pointer type for the various kinds of graphs that may be created for a GtkStatsMonitor. More...

#include "gtkStatsGraph.h"

Inheritance diagram for GtkStatsGraph:
GtkStatsPianoRoll GtkStatsStripChart

List of all members.

Public Types

enum  DragMode {
  DM_none, DM_scale, DM_guide_bar, DM_new_guide_bar,
  DM_sizing
}

Public Member Functions

 GtkStatsGraph (GtkStatsMonitor *monitor)
virtual void changed_graph_size (int graph_xsize, int graph_ysize)
 Called when the user has resized the window, forcing a resize of the graph.
virtual void clicked_label (int collector_index)
 Called when the user single-clicks on a label.
virtual void force_redraw ()
 Called when it is necessary to redraw the entire graph.
virtual void new_collector (int collector_index)
 Called whenever a new Collector definition is received from the client.
virtual void new_data (int thread_index, int frame_number)
 Called whenever new data arrives.
void set_pause (bool pause)
 Changes the pause flag for the graph.
virtual void set_scroll_speed (double scroll_speed)
 Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust the speed for the graph to the indicated value.
virtual void set_time_units (int unit_mask)
 Called when the user selects a new time units from the monitor pulldown menu, this should adjust the units for the graph to the indicated mask if it is a time-based graph.
void user_guide_bars_changed ()
 Called when the user guide bars have been changed.

Protected Types

typedef pmap< int, GdkGC * > Brushes

Protected Member Functions

virtual void additional_graph_window_paint ()
 This is called during the servicing of expose_event; it gives a derived class opportunity to do some further painting into the graph window.
void close ()
 Should be called when the user closes the associated window.
virtual DragMode consider_drag_start (int graph_x, int graph_y)
 Based on the mouse position within the graph window, look for draggable things the mouse might be hovering over and return the appropriate DragMode enum or DM_none if nothing is indicated.
GdkGC * get_collector_gc (int collector_index)
 Returns a GC suitable for drawing in the indicated collector's color.
virtual gboolean handle_button_press (GtkWidget *widget, int graph_x, int graph_y, bool double_click)
 Called when the mouse button is depressed within the window, or any nested window.
virtual gboolean handle_button_release (GtkWidget *widget, int graph_x, int graph_y)
 Called when the mouse button is released within the window, or any nested window.
virtual gboolean handle_motion (GtkWidget *widget, int graph_x, int graph_y)
 Called when the mouse is moved within the window, or any nested window.
virtual void set_drag_mode (DragMode drag_mode)
 This should be called whenever the drag mode needs to change state.

Static Protected Member Functions

static gboolean button_press_event_callback (GtkWidget *widget, GdkEventButton *event, gpointer data)
 Called when the mouse button is depressed within the graph window or main window.
static gboolean button_release_event_callback (GtkWidget *widget, GdkEventButton *event, gpointer data)
 Called when the mouse button is released within the graph window or main window.
static gboolean motion_notify_event_callback (GtkWidget *widget, GdkEventMotion *event, gpointer data)
 Called when the mouse is moved within the graph window or main window.

Protected Attributes

Brushes _brushes
int _drag_guide_bar
DragMode _drag_mode
double _drag_scale_start
int _drag_start_x
int _drag_start_y
GtkWidget * _graph_hbox
GtkWidget * _graph_vbox
GtkWidget * _graph_window
GdkCursor * _hand_cursor
GtkWidget * _hpaned
GtkStatsLabelStack _label_stack
GtkStatsMonitor_monitor
GtkWidget * _parent_window
bool _pause
GdkPixmap * _pixmap
GdkGC * _pixmap_gc
int _pixmap_xsize
int _pixmap_ysize
DragMode _potential_drag_mode
GtkWidget * _scale_area
GtkWidget * _window

Static Protected Attributes

static const GdkColor rgb_black
static const GdkColor rgb_dark_gray
static const GdkColor rgb_light_gray
static const GdkColor rgb_user_guide_bar
static const GdkColor rgb_white

Detailed Description

This is just an abstract base class to provide a common pointer type for the various kinds of graphs that may be created for a GtkStatsMonitor.

Definition at line 32 of file gtkStatsGraph.h.


Member Function Documentation

void GtkStatsGraph::additional_graph_window_paint ( ) [protected, virtual]

This is called during the servicing of expose_event; it gives a derived class opportunity to do some further painting into the graph window.

Reimplemented in GtkStatsStripChart, and GtkStatsPianoRoll.

Definition at line 305 of file gtkStatsGraph.cxx.

gboolean GtkStatsGraph::button_press_event_callback ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  data 
) [static, protected]

Called when the mouse button is depressed within the graph window or main window.

Definition at line 491 of file gtkStatsGraph.cxx.

gboolean GtkStatsGraph::button_release_event_callback ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  data 
) [static, protected]

Called when the mouse button is released within the graph window or main window.

Definition at line 511 of file gtkStatsGraph.cxx.

void GtkStatsGraph::changed_graph_size ( int  graph_xsize,
int  graph_ysize 
) [virtual]

Called when the user has resized the window, forcing a resize of the graph.

Reimplemented in GtkStatsPianoRoll, and GtkStatsStripChart.

Definition at line 188 of file gtkStatsGraph.cxx.

void GtkStatsGraph::clicked_label ( int  collector_index) [virtual]

Called when the user single-clicks on a label.

Reimplemented in GtkStatsStripChart, and GtkStatsPianoRoll.

Definition at line 245 of file gtkStatsGraph.cxx.

Referenced by GtkStatsPianoRoll::handle_button_press().

void GtkStatsGraph::close ( ) [protected]

Should be called when the user closes the associated window.

This tells the monitor to remove the graph.

Definition at line 255 of file gtkStatsGraph.cxx.

References GtkStatsLabelStack::clear_labels().

GtkStatsGraph::DragMode GtkStatsGraph::consider_drag_start ( int  graph_x,
int  graph_y 
) [protected, virtual]

Based on the mouse position within the graph window, look for draggable things the mouse might be hovering over and return the appropriate DragMode enum or DM_none if nothing is indicated.

Reimplemented in GtkStatsStripChart, and GtkStatsPianoRoll.

Definition at line 317 of file gtkStatsGraph.cxx.

Referenced by GtkStatsPianoRoll::consider_drag_start(), and handle_motion().

void GtkStatsGraph::force_redraw ( ) [virtual]

Called when it is necessary to redraw the entire graph.

Reimplemented in GtkStatsPianoRoll, and GtkStatsStripChart.

Definition at line 178 of file gtkStatsGraph.cxx.

Referenced by GtkStatsPianoRoll::force_redraw().

GdkGC * GtkStatsGraph::get_collector_gc ( int  collector_index) [protected]

Returns a GC suitable for drawing in the indicated collector's color.

Definition at line 275 of file gtkStatsGraph.cxx.

References PStatMonitor::get_collector_color().

Referenced by GtkStatsPianoRoll::draw_bar(), and GtkStatsStripChart::draw_slice().

gboolean GtkStatsGraph::handle_button_press ( GtkWidget *  widget,
int  graph_x,
int  graph_y,
bool  double_click 
) [protected, virtual]

Called when the mouse button is depressed within the window, or any nested window.

Reimplemented in GtkStatsStripChart, and GtkStatsPianoRoll.

Definition at line 340 of file gtkStatsGraph.cxx.

References set_drag_mode().

Referenced by GtkStatsPianoRoll::handle_button_press().

gboolean GtkStatsGraph::handle_button_release ( GtkWidget *  widget,
int  graph_x,
int  graph_y 
) [protected, virtual]

Called when the mouse button is released within the window, or any nested window.

Reimplemented in GtkStatsStripChart, and GtkStatsPianoRoll.

Definition at line 358 of file gtkStatsGraph.cxx.

References handle_motion(), and set_drag_mode().

Referenced by GtkStatsPianoRoll::handle_button_release().

gboolean GtkStatsGraph::handle_motion ( GtkWidget *  widget,
int  graph_x,
int  graph_y 
) [protected, virtual]

Called when the mouse is moved within the window, or any nested window.

Reimplemented in GtkStatsStripChart, and GtkStatsPianoRoll.

Definition at line 372 of file gtkStatsGraph.cxx.

References consider_drag_start().

Referenced by GtkStatsPianoRoll::handle_button_release(), handle_button_release(), and GtkStatsPianoRoll::handle_motion().

gboolean GtkStatsGraph::motion_notify_event_callback ( GtkWidget *  widget,
GdkEventMotion *  event,
gpointer  data 
) [static, protected]

Called when the mouse is moved within the graph window or main window.

Definition at line 529 of file gtkStatsGraph.cxx.

void GtkStatsGraph::new_collector ( int  collector_index) [virtual]

Called whenever a new Collector definition is received from the client.

Reimplemented in GtkStatsStripChart.

Definition at line 160 of file gtkStatsGraph.cxx.

Referenced by GtkStatsMonitor::new_collector().

void GtkStatsGraph::new_data ( int  thread_index,
int  frame_number 
) [virtual]

Called whenever new data arrives.

Reimplemented in GtkStatsPianoRoll, and GtkStatsStripChart.

Definition at line 169 of file gtkStatsGraph.cxx.

Referenced by GtkStatsMonitor::new_data().

void GtkStatsGraph::set_drag_mode ( GtkStatsGraph::DragMode  drag_mode) [protected, virtual]

This should be called whenever the drag mode needs to change state.

It provides hooks for a derived class to do something special.

Reimplemented in GtkStatsStripChart.

Definition at line 329 of file gtkStatsGraph.cxx.

Referenced by GtkStatsPianoRoll::handle_button_press(), handle_button_press(), GtkStatsPianoRoll::handle_button_release(), handle_button_release(), and GtkStatsPianoRoll::handle_motion().

void GtkStatsGraph::set_pause ( bool  pause)

Changes the pause flag for the graph.

When this flag is true, the graph does not update in response to new data.

Definition at line 222 of file gtkStatsGraph.cxx.

Referenced by GtkStatsMonitor::open_piano_roll(), GtkStatsMonitor::open_strip_chart(), and GtkStatsMonitor::set_pause().

void GtkStatsGraph::set_scroll_speed ( double  scroll_speed) [virtual]

Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust the speed for the graph to the indicated value.

Reimplemented in GtkStatsStripChart.

Definition at line 211 of file gtkStatsGraph.cxx.

Referenced by GtkStatsMonitor::open_piano_roll(), and GtkStatsMonitor::set_scroll_speed().

void GtkStatsGraph::set_time_units ( int  unit_mask) [virtual]

Called when the user selects a new time units from the monitor pulldown menu, this should adjust the units for the graph to the indicated mask if it is a time-based graph.

Reimplemented in GtkStatsPianoRoll, and GtkStatsStripChart.

Definition at line 200 of file gtkStatsGraph.cxx.

Referenced by GtkStatsMonitor::set_time_units().

Called when the user guide bars have been changed.

Definition at line 232 of file gtkStatsGraph.cxx.

Referenced by GtkStatsMonitor::user_guide_bars_changed().


Member Data Documentation

const GdkColor GtkStatsGraph::rgb_black [static, protected]
Initial value:
 {
  0, 0x0000, 0x0000, 0x0000
}

Definition at line 113 of file gtkStatsGraph.h.

const GdkColor GtkStatsGraph::rgb_dark_gray [static, protected]
Initial value:
 {
  0, 0x3333, 0x3333, 0x3333,
}

Definition at line 112 of file gtkStatsGraph.h.

const GdkColor GtkStatsGraph::rgb_light_gray [static, protected]
Initial value:
 {
  0, 0x9a9a, 0x9a9a, 0x9a9a,
}

Definition at line 111 of file gtkStatsGraph.h.

const GdkColor GtkStatsGraph::rgb_user_guide_bar [static, protected]
Initial value:
 {
  0, 0x8282, 0x9696, 0xffff
}

Definition at line 114 of file gtkStatsGraph.h.

const GdkColor GtkStatsGraph::rgb_white [static, protected]
Initial value:
 {
  0, 0xffff, 0xffff, 0xffff
}

Definition at line 110 of file gtkStatsGraph.h.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations