22 GtkStatsLabelStack() {
23 _widget = gtk_vbox_new(FALSE, 0);
24 _highlight_label = -1;
31 ~GtkStatsLabelStack() {
48 get_label_y(
int label_index, GtkWidget *target_widget)
const {
49 nassertr(label_index >= 0 && label_index < (
int)_labels.size(), 0);
52 int height = _labels[0]->get_height();
53 int start_y = _widget->allocation.height - height * label_index;
56 gtk_widget_translate_coordinates(_widget, target_widget,
66 nassertr(label_index >= 0 && label_index < (
int)_labels.size(), 0);
67 return _labels[label_index]->get_height();
75 nassertr(label_index >= 0 && label_index < (
int)_labels.size(), -1);
76 return _labels[label_index]->get_collector_index();
85 for (li = _labels.begin(); li != _labels.end(); ++li) {
88 gtk_container_remove(GTK_CONTAINER(_widget), label->
get_widget());
100 int thread_index,
int collector_index,
bool use_fullname) {
102 new GtkStatsLabel(monitor, graph, thread_index, collector_index, use_fullname);
104 gtk_box_pack_end(GTK_BOX(_widget), label->
get_widget(),
107 int label_index = (int)_labels.size();
108 _labels.push_back(label);
118 return _labels.size();
128 if (_highlight_label != collector_index) {
129 _highlight_label = collector_index;
131 for (li = _labels.begin(); li != _labels.end(); ++li) {
int add_label(GtkStatsMonitor *monitor, GtkStatsGraph *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.
GtkWidget * get_widget() const
Returns the widget for this stack.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void clear_labels(bool delete_widgets=true)
Removes the set of labels and starts a new set.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void highlight_label(int collector_index)
Draws a highlight around the label representing the indicated collector, and removes the highlight fr...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
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.
int get_collector_index() const
Returns the collector this label represents.
GtkWidget * get_widget() const
Returns the widget for this label.
A text label that will draw in color appropriate for a particular collector.
int get_label_collector_index(int label_index) const
Returns the collector index associated with the indicated label.
int get_label_height(int label_index) const
Returns the height of the indicated label.
int get_num_labels() const
Returns the number of labels in the stack.
int get_label_y(int label_index, GtkWidget *target_widget) const
Returns the y position of the indicated label's bottom edge, relative to the indicated target widget.