diff options
author | Daniel Burrows <dburrows@debian.org> | 2007-10-03 21:38:59 -0700 |
---|---|---|
committer | Daniel Burrows <dburrows@debian.org> | 2007-10-03 21:38:59 -0700 |
commit | fd835baf8311b2200e7cf47e357adc0bb18435fd (patch) | |
tree | d28d8ba90a0271d7ed0e8ad199b52d6161cb0bf5 /src/pkg_subtree.h | |
parent | 685c53b269ef05a1c0f3c4d96a4093e84190f3d3 (diff) | |
download | aptitude-fd835baf8311b2200e7cf47e357adc0bb18435fd.tar.gz |
Use a signal instead of a virtual method to communicate changes in whether a tree item is highlighted.
The original design required less memory, but it turns out that
the common patterns of operation that I ended up using are much
easier to implement using signals. In particular, some design
work I've been doing to overhaul the configuration UI will be a
LOT easier to implement with this change.
Diffstat (limited to 'src/pkg_subtree.h')
-rw-r--r-- | src/pkg_subtree.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/pkg_subtree.h b/src/pkg_subtree.h index dc29c437..6fe3c0ab 100644 --- a/src/pkg_subtree.h +++ b/src/pkg_subtree.h @@ -1,6 +1,6 @@ // pkg_subtree.h (this is -*-c++-*-) // -// Copyright 1999-2002, 2004-2005 Daniel Burrows +// Copyright 1999-2002, 2004-2005, 2007 Daniel Burrows // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -33,6 +33,8 @@ class pkg_subtree:public vs_subtree<pkg_tree_node>, std::wstring description; // This is like a Description: field. sigc::signal1<void, std::wstring> *info_signal; + + void do_highlighted_changed(bool highlighted); protected: void set_label(const std::wstring &_name) {name=_name;} public: @@ -41,12 +43,15 @@ public: bool _expanded=false): vs_subtree<pkg_tree_node>(_expanded), name(_name), description(_description), info_signal(_info_signal) - {} + { + highlighted_changed.connect(sigc::mem_fun(this, &pkg_subtree::do_highlighted_changed)); + } pkg_subtree(std::wstring _name, bool _expanded): vs_subtree<pkg_tree_node>(_expanded), name(_name), description(L""), info_signal(NULL) { + highlighted_changed.connect(sigc::mem_fun(this, &pkg_subtree::do_highlighted_changed)); } virtual void paint(vs_tree *win, int y, bool hierarchical, @@ -62,9 +67,6 @@ public: virtual void reinstall(undo_group *undo); virtual void set_auto(bool isauto, undo_group *undo); - virtual void highlighted(vs_tree *win); - virtual void unhighlighted(vs_tree *win); - std::wstring get_name() {return name;} std::wstring get_description() {return description;} |