Panda3D
gtkStatsLabel.h
1 // Filename: gtkStatsLabel.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 GTKSTATSLABEL_H
16 #define GTKSTATSLABEL_H
17 
18 #include "pandatoolbase.h"
19 
20 #include <gtk/gtk.h>
21 
22 class GtkStatsMonitor;
23 class GtkStatsGraph;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : GtkStatsLabel
27 // Description : A text label that will draw in color appropriate for
28 // a particular collector. It also responds when the
29 // user double-clicks on it. This is handy for putting
30 // colored labels on strip charts.
31 ////////////////////////////////////////////////////////////////////
33 public:
35  int thread_index, int collector_index, bool use_fullname);
36  ~GtkStatsLabel();
37 
38  GtkWidget *get_widget() const;
39  int get_height() const;
40 
41  int get_collector_index() const;
42 
43  void set_highlight(bool highlight);
44  bool get_highlight() const;
45 
46 private:
47  void set_mouse_within(bool mouse_within);
48  static gboolean expose_event_callback(GtkWidget *widget,
49  GdkEventExpose *event, gpointer data);
50  static gboolean enter_notify_event_callback(GtkWidget *widget,
51  GdkEventCrossing *event,
52  gpointer data);
53  static gboolean leave_notify_event_callback(GtkWidget *widget,
54  GdkEventCrossing *event,
55  gpointer data);
56  static gboolean button_press_event_callback(GtkWidget *widget,
57  GdkEventButton *event,
58  gpointer data);
59 
60  GtkStatsMonitor *_monitor;
61  GtkStatsGraph *_graph;
62  int _thread_index;
63  int _collector_index;
64  string _text;
65  GtkWidget *_widget;
66  GdkColor _fg_color;
67  GdkColor _bg_color;
68  PangoLayout *_layout;
69 
70  /*
71  COLORREF _bg_color;
72  COLORREF _fg_color;
73  HBRUSH _bg_brush;
74  HBRUSH _highlight_brush;
75  */
76 
77  bool _highlight;
78  bool _mouse_within;
79  int _height;
80 
81  static int _left_margin, _right_margin;
82  static int _top_margin, _bottom_margin;
83 };
84 
85 #endif
86 
int get_height() const
Returns the height of the label as we requested it.
bool get_highlight() const
Returns true if the visual highlight for this label is enabled.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: gtkStatsGraph.h:32
void set_highlight(bool highlight)
Enables or disables the visual highlight for this label.
This class represents a connection to a PStatsClient and manages the data exchange with the client...
int get_collector_index() const
Returns the collector this label represents.
GtkWidget * get_widget() const
Returns the widget for this label.
A text label that will draw in color appropriate for a particular collector.
Definition: gtkStatsLabel.h:32