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 #include <windows.h>
20 
21 class WinStatsMonitor;
22 class WinStatsGraph;
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  ~WinStatsLabel();
34 
35  void setup(HWND parent_window);
36  void set_pos(int x, int y, int width);
37 
38  int get_x() const;
39  int get_y() const;
40  int get_width() const;
41  int get_height() const;
42  int get_ideal_width() const;
43 
44  int get_collector_index() const;
45 
46  void set_highlight(bool highlight);
47  bool get_highlight() const;
48 
49 private:
50  void set_mouse_within(bool mouse_within);
51 
52  void create_window(HWND parent_window);
53  static void register_window_class(HINSTANCE application);
54 
55  static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
56  LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
57 
58  WinStatsMonitor *_monitor;
59  WinStatsGraph *_graph;
60  int _thread_index;
61  int _collector_index;
62  std::string _text;
63  HWND _window;
64  COLORREF _bg_color;
65  COLORREF _fg_color;
66  HBRUSH _bg_brush;
67  HBRUSH _highlight_brush;
68 
69  int _x;
70  int _y;
71  int _width;
72  int _height;
73  int _ideal_width;
74  bool _highlight;
75  bool _mouse_within;
76 
77  static int _left_margin, _right_margin;
78  static int _top_margin, _bottom_margin;
79 
80  static bool _window_class_registered;
81  static const char * const _window_class_name;
82 };
83 
84 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_x() const
Returns the x position of the label on its parent.
int get_height() const
Returns the height of the label as we requested it.
A text label that will draw in color appropriate for a particular collector.
Definition: winStatsLabel.h:29
int get_width() const
Returns the width of the label as we requested it.
void set_highlight(bool highlight)
Enables or disables the visual highlight for this label.
bool get_highlight() const
Returns true if the visual highlight for this label is enabled.
int get_ideal_width() const
Returns the width the label would really prefer to be.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: winStatsGraph.h:29
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.
int get_y() const
Returns the y position of the label on its parent.
void setup(HWND parent_window)
Creates the actual window.
void set_pos(int x, int y, int width)
Sets the position of the label on its parent.