Panda3D
 All Classes Functions Variables Enumerations
winStatsLabel.h
00001 // Filename: winStatsLabel.h
00002 // Created by:  drose (07Jan04)
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 WINSTATSLABEL_H
00016 #define WINSTATSLABEL_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include <windows.h>
00021 
00022 class WinStatsMonitor;
00023 class WinStatsGraph;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : WinStatsLabel
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 WinStatsLabel {
00033 public:
00034   WinStatsLabel(WinStatsMonitor *monitor, WinStatsGraph *graph,
00035                 int thread_index, int collector_index, bool use_fullname);
00036   ~WinStatsLabel();
00037 
00038   void setup(HWND parent_window);
00039   void set_pos(int x, int y, int width);
00040 
00041   int get_x() const;
00042   int get_y() const;
00043   int get_width() const;
00044   int get_height() const;
00045   int get_ideal_width() const;
00046 
00047   int get_collector_index() const;
00048 
00049   void set_highlight(bool highlight);
00050   bool get_highlight() const;
00051 
00052 private:
00053   void set_mouse_within(bool mouse_within);
00054 
00055   void create_window(HWND parent_window);
00056   static void register_window_class(HINSTANCE application);
00057 
00058   static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00059   LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00060 
00061   WinStatsMonitor *_monitor;
00062   WinStatsGraph *_graph;
00063   int _thread_index;
00064   int _collector_index;
00065   string _text;
00066   HWND _window;
00067   COLORREF _bg_color;
00068   COLORREF _fg_color;
00069   HBRUSH _bg_brush;
00070   HBRUSH _highlight_brush;
00071 
00072   int _x;
00073   int _y;
00074   int _width;
00075   int _height;
00076   int _ideal_width;
00077   bool _highlight;
00078   bool _mouse_within;
00079 
00080   static int _left_margin, _right_margin;
00081   static int _top_margin, _bottom_margin;
00082 
00083   static bool _window_class_registered;
00084   static const char * const _window_class_name;
00085 };
00086 
00087 #endif
00088 
 All Classes Functions Variables Enumerations