Panda3D
gtkStatsLabel.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file gtkStatsLabel.h
10  * @author drose
11  * @date 2006-01-16
12  */
13 
14 #ifndef GTKSTATSLABEL_H
15 #define GTKSTATSLABEL_H
16 
17 #include "pandatoolbase.h"
18 
19 #include <gtk/gtk.h>
20 
21 class GtkStatsMonitor;
22 class GtkStatsGraph;
23 
24 /**
25  * A text label that will draw in color appropriate for a particular
26  * collector. It also responds when the user double-clicks on it. This is
27  * handy for putting colored labels on strip charts.
28  */
30 public:
32  int thread_index, int collector_index, bool use_fullname);
33  ~GtkStatsLabel();
34 
35  GtkWidget *get_widget() const;
36  int get_height() const;
37 
38  int get_collector_index() const;
39  int get_thread_index() const;
40 
41  void set_highlight(bool highlight);
42  bool get_highlight() const;
43 
44 private:
45  void set_mouse_within(bool mouse_within);
46  static gboolean expose_event_callback(GtkWidget *widget,
47  GdkEventExpose *event, gpointer data);
48  static gboolean enter_notify_event_callback(GtkWidget *widget,
49  GdkEventCrossing *event,
50  gpointer data);
51  static gboolean leave_notify_event_callback(GtkWidget *widget,
52  GdkEventCrossing *event,
53  gpointer data);
54  static gboolean button_press_event_callback(GtkWidget *widget,
55  GdkEventButton *event,
56  gpointer data);
57 
58  GtkStatsMonitor *_monitor;
59  GtkStatsGraph *_graph;
60  int _thread_index;
61  int _collector_index;
62  std::string _text;
63  GtkWidget *_widget;
64  GdkColor _fg_color;
65  GdkColor _bg_color;
66  PangoLayout *_layout;
67 
68  /*
69  COLORREF _bg_color;
70  COLORREF _fg_color;
71  HBRUSH _bg_brush;
72  HBRUSH _highlight_brush;
73  */
74 
75  bool _highlight;
76  bool _mouse_within;
77  int _height;
78 
79  static int _left_margin, _right_margin;
80  static int _top_margin, _bottom_margin;
81 };
82 
83 #endif
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_thread_index() const
Returns the thread index.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: gtkStatsGraph.h:29
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:29