Panda3D
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes
WinStatsGraph 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 WinStatsMonitor. More...

#include "winStatsGraph.h"

Inheritance diagram for WinStatsGraph:
WinStatsPianoRoll WinStatsStripChart

List of all members.

Public Types

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

Public Member Functions

 WinStatsGraph (WinStatsMonitor *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, HBRUSH > Brushes

Protected Member Functions

virtual void additional_graph_window_paint (HDC hdc)
 This is called during the servicing of WM_PAINT; it gives a derived class opportunity to do some further painting into the graph window.
virtual void additional_window_paint (HDC hdc)
 This is called during the servicing of WM_PAINT; it gives a derived class opportunity to do some further painting into the window (the outer window, not the graph window).
void close ()
 Should be called when the user closes the associated window.
virtual DragMode consider_drag_start (int mouse_x, int mouse_y, int width, int height)
 Based on the mouse position within the window's client area, look for draggable things the mouse might be hovering over and return the appropriate DragMode enum or DM_none if nothing is indicated.
HBRUSH get_collector_brush (int collector_index)
 Returns a brush suitable for drawing in the indicated collector's color.
virtual LONG graph_window_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
virtual void move_graph_window (int graph_left, int graph_top, int graph_xsize, int graph_ysize)
 Repositions the graph child window within the parent window according to the _margin variables.
void move_label_stack ()
 Repositions the label stack if its coordinates or size have changed.
virtual void set_drag_mode (DragMode drag_mode)
 This should be called whenever the drag mode needs to change state.
void setup_label_stack ()
 Sets up the label stack on the left edge of the frame.
LONG window_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 This window_proc should be called up to by the derived classes for any messages that are not specifically handled by the derived class.

Protected Attributes

HBITMAP _bitmap
HDC _bitmap_dc
int _bitmap_xsize
int _bitmap_ysize
int _bottom_margin
Brushes _brushes
COLORREF _dark_color
HPEN _dark_pen
int _drag_guide_bar
DragMode _drag_mode
double _drag_scale_start
int _drag_start_x
int _drag_start_y
int _graph_left
int _graph_top
HWND _graph_window
HCURSOR _hand_cursor
WinStatsLabelStack _label_stack
int _left_margin
COLORREF _light_color
HPEN _light_pen
WinStatsMonitor_monitor
bool _pause
DragMode _potential_drag_mode
int _right_margin
HCURSOR _sizewe_cursor
int _top_margin
COLORREF _user_guide_bar_color
HPEN _user_guide_bar_pen
HWND _window

Static Protected Attributes

static DWORD graph_window_style

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 WinStatsMonitor.

Definition at line 32 of file winStatsGraph.h.


Member Function Documentation

void WinStatsGraph::additional_graph_window_paint ( HDC  hdc) [protected, virtual]

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

Reimplemented in WinStatsStripChart, and WinStatsPianoRoll.

Definition at line 463 of file winStatsGraph.cxx.

void WinStatsGraph::additional_window_paint ( HDC  hdc) [protected, virtual]

This is called during the servicing of WM_PAINT; it gives a derived class opportunity to do some further painting into the window (the outer window, not the graph window).

Reimplemented in WinStatsStripChart, and WinStatsPianoRoll.

Definition at line 452 of file winStatsGraph.cxx.

Referenced by window_proc().

void WinStatsGraph::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 WinStatsPianoRoll, and WinStatsStripChart.

Definition at line 126 of file winStatsGraph.cxx.

Referenced by window_proc().

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

Called when the user single-clicks on a label.

Reimplemented in WinStatsStripChart, and WinStatsPianoRoll.

Definition at line 181 of file winStatsGraph.cxx.

void WinStatsGraph::close ( ) [protected]

Should be called when the user closes the associated window.

This tells the monitor to remove the graph.

Definition at line 191 of file winStatsGraph.cxx.

Referenced by window_proc().

WinStatsGraph::DragMode WinStatsGraph::consider_drag_start ( int  mouse_x,
int  mouse_y,
int  width,
int  height 
) [protected, virtual]

Based on the mouse position within the window's client area, 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 WinStatsStripChart, and WinStatsPianoRoll.

Definition at line 475 of file winStatsGraph.cxx.

Referenced by WinStatsPianoRoll::consider_drag_start(), and window_proc().

void WinStatsGraph::force_redraw ( ) [virtual]

Called when it is necessary to redraw the entire graph.

Reimplemented in WinStatsPianoRoll, and WinStatsStripChart.

Definition at line 116 of file winStatsGraph.cxx.

Referenced by WinStatsPianoRoll::force_redraw(), and window_proc().

HBRUSH WinStatsGraph::get_collector_brush ( int  collector_index) [protected]

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

Definition at line 239 of file winStatsGraph.cxx.

References PStatMonitor::get_collector_color().

Referenced by WinStatsPianoRoll::draw_bar(), and WinStatsStripChart::draw_slice().

void WinStatsGraph::move_graph_window ( int  graph_left,
int  graph_top,
int  graph_xsize,
int  graph_ysize 
) [protected, virtual]

Repositions the graph child window within the parent window according to the _margin variables.

Reimplemented in WinStatsStripChart.

Definition at line 504 of file winStatsGraph.cxx.

Referenced by window_proc().

void WinStatsGraph::move_label_stack ( ) [protected]

Repositions the label stack if its coordinates or size have changed.

Definition at line 218 of file winStatsGraph.cxx.

References WinStatsLabelStack::is_setup(), and WinStatsLabelStack::set_pos().

Referenced by setup_label_stack(), and window_proc().

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

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

Reimplemented in WinStatsStripChart.

Definition at line 98 of file winStatsGraph.cxx.

Referenced by WinStatsMonitor::new_collector().

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

Called whenever new data arrives.

Reimplemented in WinStatsPianoRoll, and WinStatsStripChart.

Definition at line 107 of file winStatsGraph.cxx.

Referenced by WinStatsMonitor::new_data().

void WinStatsGraph::set_drag_mode ( WinStatsGraph::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 WinStatsStripChart.

Definition at line 493 of file winStatsGraph.cxx.

Referenced by WinStatsPianoRoll::window_proc(), and window_proc().

void WinStatsGraph::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 160 of file winStatsGraph.cxx.

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

void WinStatsGraph::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 WinStatsStripChart.

Definition at line 149 of file winStatsGraph.cxx.

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

void WinStatsGraph::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 WinStatsPianoRoll, and WinStatsStripChart.

Definition at line 138 of file winStatsGraph.cxx.

Referenced by WinStatsMonitor::set_time_units().

void WinStatsGraph::setup_label_stack ( ) [protected]

Sets up the label stack on the left edge of the frame.

Definition at line 206 of file winStatsGraph.cxx.

References move_label_stack(), and WinStatsLabelStack::setup().

Called when the user guide bars have been changed.

Definition at line 170 of file winStatsGraph.cxx.

Referenced by WinStatsMonitor::user_guide_bars_changed().

LONG WinStatsGraph::window_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
) [protected]

This window_proc should be called up to by the derived classes for any messages that are not specifically handled by the derived class.

Reimplemented in WinStatsStripChart, and WinStatsPianoRoll.

Definition at line 265 of file winStatsGraph.cxx.

References additional_window_paint(), changed_graph_size(), close(), consider_drag_start(), force_redraw(), move_graph_window(), move_label_stack(), and set_drag_mode().

Referenced by WinStatsPianoRoll::window_proc().


Member Data Documentation

DWORD WinStatsGraph::graph_window_style [static, protected]
Initial value:
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW | WS_VISIBLE

Definition at line 129 of file winStatsGraph.h.


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