Panda3D
 All Classes Functions Variables Enumerations
winStatsLabelStack.h
1 // Filename: winStatsLabelStack.h
2 // Created by: drose (07Jan04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef WINSTATSLABELSTACK_H
16 #define WINSTATSLABELSTACK_H
17 
18 #include "pandatoolbase.h"
19 #include "pvector.h"
20 
21 #include <windows.h>
22 
23 class WinStatsLabel;
24 class WinStatsMonitor;
25 class WinStatsGraph;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : WinStatsLabelStack
29 // Description : A window that contains a stack of labels from bottom
30 // to top.
31 ////////////////////////////////////////////////////////////////////
33 public:
36 
37  void setup(HWND parent_window);
38  bool is_setup() const;
39  void set_pos(int x, int y, int width, int height);
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_label_y(int label_index) const;
48  int get_label_height(int label_index) const;
49  int get_label_collector_index(int label_index) const;
50 
51  void clear_labels();
52  int add_label(WinStatsMonitor *monitor, WinStatsGraph *graph,
53  int thread_index, int collector_index, bool use_fullname);
54  int get_num_labels() const;
55 
56  void highlight_label(int collector_index);
57 
58 private:
59  void create_window(HWND parent_window);
60  static void register_window_class(HINSTANCE application);
61 
62  static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
63  LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
64 
65  HWND _window;
66  int _x;
67  int _y;
68  int _width;
69  int _height;
70  int _ideal_width;
71  int _highlight_label;
72 
74  Labels _labels;
75 
76  static bool _window_class_registered;
77  static const char * const _window_class_name;
78 };
79 
80 #endif
81 
int get_y() const
Returns the y position of the stack on its parent.
int get_label_collector_index(int label_index) const
Returns the collector index associated with the indicated label.
int get_ideal_width() const
Returns the width the stack would really prefer to be.
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:32
int get_num_labels() const
Returns the number of labels in the stack.
int get_x() const
Returns the x position of the stack on its parent.
A window that contains a stack of labels from bottom to top.
int get_label_height(int label_index) const
Returns the height of the indicated label.
int get_label_y(int label_index) const
Returns the y position of the indicated label&#39;s bottom edge, relative to the label stack&#39;s parent win...
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: winStatsGraph.h:32
void clear_labels()
Removes the set of labels and starts a new set.
bool is_setup() const
Returns true if the label stack has been set up, false otherwise.
This class represents a connection to a PStatsClient and manages the data exchange with the client...
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.
int get_width() const
Returns the width of the stack as we requested it.
int get_height() const
Returns the height of the stack as we requested it.
void set_pos(int x, int y, int width, int height)
Sets the position and size of the label stack on its parent.
void highlight_label(int collector_index)
Draws a highlight around the label representing the indicated collector, and removes the highlight fr...