Panda3D
 All Classes Functions Variables Enumerations
gtkStatsPianoRoll.h
1 // Filename: gtkStatsPianoRoll.h
2 // Created by: drose (16Jan06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef GTKSTATSPIANOROLL_H
16 #define GTKSTATSPIANOROLL_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "gtkStatsGraph.h"
21 #include "pStatPianoRoll.h"
22 #include "pointerTo.h"
23 
24 #include <gtk/gtk.h>
25 
26 class GtkStatsMonitor;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : GtkStatsPianoRoll
30 // Description : A window that draws a piano-roll style chart,
31 // which shows the collectors explicitly stopping and
32 // starting, one frame at a time.
33 ////////////////////////////////////////////////////////////////////
35 public:
36  GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index);
37  virtual ~GtkStatsPianoRoll();
38 
39  virtual void new_data(int thread_index, int frame_number);
40  virtual void force_redraw();
41  virtual void changed_graph_size(int graph_xsize, int graph_ysize);
42 
43  virtual void set_time_units(int unit_mask);
44  virtual void clicked_label(int collector_index);
45  void set_horizontal_scale(double time_width);
46 
47 protected:
48  void clear_region();
49  virtual void begin_draw();
50  virtual void draw_bar(int row, int from_x, int to_x);
51  virtual void end_draw();
52  virtual void idle();
53 
54  virtual void additional_graph_window_paint();
55  virtual DragMode consider_drag_start(int graph_x, int graph_y);
56 
57  virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
58  bool double_click);
59  virtual gboolean handle_button_release(GtkWidget *widget, int graph_x, int graph_y);
60  virtual gboolean handle_motion(GtkWidget *widget, int graph_x, int graph_y);
61 
62 private:
63  int get_collector_under_pixel(int xpoint, int ypoint);
64  void update_labels();
65  void draw_guide_bar(GdkDrawable *surface, const PStatGraph::GuideBar &bar);
66  void draw_guide_labels();
67  void draw_guide_label(const PStatGraph::GuideBar &bar);
68 
69  static gboolean expose_event_callback(GtkWidget *widget,
70  GdkEventExpose *event, gpointer data);
71 };
72 
73 #endif
74 
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 ...
This is an abstract class that presents the interface for drawing a piano-roll type chart: it shows t...
A window that draws a piano-roll style chart, which shows the collectors explicitly stopping and star...
void set_horizontal_scale(double time_width)
Changes the amount of time the width of the horizontal axis represents.
virtual void new_data(int thread_index, int frame_number)
Called as each frame&#39;s data is made available.
virtual void force_redraw()
Called when it is necessary to redraw the entire graph.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: gtkStatsGraph.h:32
This class represents a connection to a PStatsClient and manages the data exchange with the client...
virtual void clicked_label(int collector_index)
Called when the user single-clicks on a label.
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.