00001 // Filename: gtkStatsLabel.h 00002 // Created by: drose (15Jul00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef GTKSTATSLABEL_H 00020 #define GTKSTATSLABEL_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include <gtk--.h> 00025 00026 class PStatMonitor; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : GtkStatsLabel 00030 // Description : A text label that will draw in color appropriate for 00031 // a particular collector, instead of referring to some 00032 // dumb Gtk::Style. It also throws a signal when the 00033 // user double-clicks on it, passing in the collector 00034 // index. This is handy for putting colored labels on 00035 // strip charts. 00036 //////////////////////////////////////////////////////////////////// 00037 class GtkStatsLabel : public Gtk::DrawingArea { 00038 public: 00039 GtkStatsLabel(PStatMonitor *monitor, int collector_index, 00040 Gdk_Font font); 00041 00042 int get_width() const; 00043 int get_height() const; 00044 00045 SigC::Signal1<void, int> collector_picked; 00046 00047 private: 00048 virtual gint configure_event_impl (GdkEventConfigure *event); 00049 virtual gint expose_event_impl (GdkEventExpose *event); 00050 virtual gint button_press_event_impl(GdkEventButton *button); 00051 00052 private: 00053 int _collector_index; 00054 00055 string _text; 00056 Gdk_Font _font; 00057 Gdk_Color _fg_color; 00058 Gdk_Color _bg_color; 00059 00060 int _width; 00061 int _height; 00062 00063 Gdk_GC _gc; 00064 Gdk_GC _reverse_gc; 00065 }; 00066 00067 #endif 00068