Panda3D

gtkStatsLabel.h

00001 // Filename: gtkStatsLabel.h
00002 // Created by:  drose (16Jan06)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef GTKSTATSLABEL_H
00016 #define GTKSTATSLABEL_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include <gtk/gtk.h>
00021 
00022 class GtkStatsMonitor;
00023 class GtkStatsGraph;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : GtkStatsLabel
00027 // Description : A text label that will draw in color appropriate for
00028 //               a particular collector.  It also responds when the
00029 //               user double-clicks on it.  This is handy for putting
00030 //               colored labels on strip charts.
00031 ////////////////////////////////////////////////////////////////////
00032 class GtkStatsLabel {
00033 public:
00034   GtkStatsLabel(GtkStatsMonitor *monitor, GtkStatsGraph *graph,
00035                 int thread_index, int collector_index, bool use_fullname);
00036   ~GtkStatsLabel();
00037 
00038   GtkWidget *get_widget() const;
00039   int get_height() const;
00040 
00041   int get_collector_index() const;
00042 
00043   void set_highlight(bool highlight);
00044   bool get_highlight() const;
00045 
00046 private:
00047   void set_mouse_within(bool mouse_within);
00048   static gboolean expose_event_callback(GtkWidget *widget, 
00049           GdkEventExpose *event, gpointer data);
00050   static gboolean enter_notify_event_callback(GtkWidget *widget, 
00051                 GdkEventCrossing *event, 
00052                 gpointer data);
00053   static gboolean leave_notify_event_callback(GtkWidget *widget, 
00054                 GdkEventCrossing *event, 
00055                 gpointer data);
00056   static gboolean button_press_event_callback(GtkWidget *widget, 
00057                 GdkEventButton *event, 
00058                 gpointer data);
00059 
00060   GtkStatsMonitor *_monitor;
00061   GtkStatsGraph *_graph;
00062   int _thread_index;
00063   int _collector_index;
00064   string _text;
00065   GtkWidget *_widget;
00066   GdkColor _fg_color;
00067   GdkColor _bg_color;
00068   PangoLayout *_layout;
00069 
00070   /*
00071   COLORREF _bg_color;
00072   COLORREF _fg_color;
00073   HBRUSH _bg_brush;
00074   HBRUSH _highlight_brush;
00075   */
00076 
00077   bool _highlight;
00078   bool _mouse_within;
00079   int _height;
00080 
00081   static int _left_margin, _right_margin;
00082   static int _top_margin, _bottom_margin;
00083 };
00084 
00085 #endif
00086 
 All Classes Functions Variables Enumerations