Panda3D
winStatsLabel.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 winStatsLabel.h
10  * @author drose
11  * @date 2004-01-07
12  */
13 
14 #ifndef WINSTATSLABEL_H
15 #define WINSTATSLABEL_H
16 
17 #include "pandatoolbase.h"
18 
19 #ifndef WIN32_LEAN_AND_MEAN
20 #define WIN32_LEAN_AND_MEAN 1
21 #endif
22 #include <windows.h>
23 
24 class WinStatsMonitor;
25 class WinStatsGraph;
26 
27 /**
28  * A text label that will draw in color appropriate for a particular
29  * collector. It also responds when the user double-clicks on it. This is
30  * handy for putting colored labels on strip charts.
31  */
33 public:
35  int thread_index, int collector_index, bool use_fullname);
36  ~WinStatsLabel();
37 
38  void setup(HWND parent_window);
39  void set_pos(int x, int y, int width);
40 
41  int get_x() const;
42  int get_y() const;
43  int get_width() const;
44  int get_height() const;
45  int get_ideal_width() const;
46 
47  int get_collector_index() const;
48 
49  void set_highlight(bool highlight);
50  bool get_highlight() const;
51 
52 private:
53  void set_mouse_within(bool mouse_within);
54 
55  void create_window(HWND parent_window);
56  static void register_window_class(HINSTANCE application);
57 
58  static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
59  LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
60 
61  WinStatsMonitor *_monitor;
62  WinStatsGraph *_graph;
63  int _thread_index;
64  int _collector_index;
65  std::string _text;
66  HWND _window;
67  COLORREF _bg_color;
68  COLORREF _fg_color;
69  HBRUSH _bg_brush;
70  HBRUSH _highlight_brush;
71 
72  int _x;
73  int _y;
74  int _width;
75  int _height;
76  int _ideal_width;
77  bool _highlight;
78  bool _mouse_within;
79 
80  static int _left_margin, _right_margin;
81  static int _top_margin, _bottom_margin;
82 
83  static bool _window_class_registered;
84  static const char * const _window_class_name;
85 };
86 
87 #endif
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: winStatsGraph.h:32
A text label that will draw in color appropriate for a particular collector.
Definition: winStatsLabel.h:32
void setup(HWND parent_window)
Creates the actual window.
int get_y() const
Returns the y position of the label on its parent.
int get_ideal_width() const
Returns the width the label would really prefer to be.
int get_width() const
Returns the width of the label as we requested it.
int get_x() const
Returns the x position of the label on its parent.
bool get_highlight() const
Returns true if the visual highlight for this label is enabled.
int get_collector_index() const
Returns the collector this label represents.
int get_height() const
Returns the height of the label as we requested it.
void set_pos(int x, int y, int width)
Sets the position of the label on its parent.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.