Panda3D
winStatsLabelStack.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 winStatsLabelStack.h
10  * @author drose
11  * @date 2004-01-07
12  */
13 
14 #ifndef WINSTATSLABELSTACK_H
15 #define WINSTATSLABELSTACK_H
16 
17 #include "pandatoolbase.h"
18 #include "pvector.h"
19 
20 #include <windows.h>
21 
22 class WinStatsLabel;
23 class WinStatsMonitor;
24 class WinStatsGraph;
25 
26 /**
27  * A window that contains a stack of labels from bottom to top.
28  */
30 public:
33 
34  void setup(HWND parent_window);
35  bool is_setup() const;
36  void set_pos(int x, int y, int width, int height);
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_label_y(int label_index) const;
45  int get_label_height(int label_index) const;
46  int get_label_collector_index(int label_index) const;
47 
48  void clear_labels();
49  int add_label(WinStatsMonitor *monitor, WinStatsGraph *graph,
50  int thread_index, int collector_index, bool use_fullname);
51  int get_num_labels() const;
52 
53  void highlight_label(int collector_index);
54 
55 private:
56  void create_window(HWND parent_window);
57  static void register_window_class(HINSTANCE application);
58 
59  static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
60  LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
61 
62  HWND _window;
63  int _x;
64  int _y;
65  int _width;
66  int _height;
67  int _ideal_width;
68  int _highlight_label;
69 
71  Labels _labels;
72 
73  static bool _window_class_registered;
74  static const char * const _window_class_name;
75 };
76 
77 #endif
bool is_setup() const
Returns true if the label stack has been set up, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_y() const
Returns the y position of the stack on its parent.
void setup(HWND parent_window)
Creates the actual window object.
A text label that will draw in color appropriate for a particular collector.
Definition: winStatsLabel.h:29
int get_label_height(int label_index) const
Returns the height of the indicated label.
int get_ideal_width() const
Returns the width the stack would really prefer to be.
A window that contains a stack of labels from bottom to top.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: winStatsGraph.h:29
void clear_labels()
Removes the set of labels and starts a new set.
This class represents a connection to a PStatsClient and manages the data exchange with the client.
int get_height() const
Returns the height of the stack as we requested it.
int add_label(WinStatsMonitor *monitor, WinStatsGraph *graph, int thread_index, int collector_index, bool use_fullname)
Adds a new label to the top of the stack; returns the new label index.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_label_y(int label_index) const
Returns the y position of the indicated label's bottom edge, relative to the label stack's parent win...
void set_pos(int x, int y, int width, int height)
Sets the position and size of the label stack on its parent.
int get_x() const
Returns the x position of the stack on its parent.
int get_width() const
Returns the width of the stack as we requested it.
void highlight_label(int collector_index)
Draws a highlight around the label representing the indicated collector, and removes the highlight fr...
int get_num_labels() const
Returns the number of labels in the stack.
int get_label_collector_index(int label_index) const
Returns the collector index associated with the indicated label.