[Aptitude-svn-commit] r3307 - in branches/aptitude-0.3/aptitude: . src/vscreen
Daniel Burrows
dburrows@costa.debian.org
Sat, 04 Jun 2005 17:54:14 +0000
Author: dburrows
Date: Sat Jun 4 17:54:12 2005
New Revision: 3307
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.cc
branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.h
branches/aptitude-0.3/aptitude/src/vscreen/vs_treeitem.cc
branches/aptitude-0.3/aptitude/src/vscreen/vs_treeitem.h
Log:
Update the core tree code.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Sat Jun 4 17:54:12 2005
@@ -1,5 +1,9 @@
2005-06-04 Daniel Burrows <dburrows@debian.org>
+ * src/vscreen/vs_tree.cc, src/vscreen/vs_tree.h, src/vscreen/vs_treeitem.cc, src/vscreen/vs_treeitem.h:
+
+ Update the core tree code to the new display protocol.
+
* src/vscreen/vs_label.cc, src/vscreen/vs_label.h:
Update the label widget to the new display protocol.
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.cc (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.cc Sat Jun 4 17:54:12 2005
@@ -731,7 +731,7 @@
}
}
-void vs_tree::paint()
+void vs_tree::paint(const style &st)
{
int width,height;
int selectedln=line_of(selected);
@@ -791,7 +791,7 @@
while(todisp.size()<(unsigned) width)
todisp+=" ";
- attrset(get_color("ScreenHeaderColor"));
+ apply_style(st+get_style("ScreenHeader"));
mvaddnstr(y, 0, todisp.c_str(), width);
++y;
@@ -805,11 +805,11 @@
vs_treeitem *curr=&*i;
if(get_isfocussed() && i==selected && i->get_selectable())
- attrset(curr->get_highlight_attr());
+ apply_style(st+curr->get_highlight_style());
else
- attrset(curr->get_normal_attr());
+ apply_style(st+curr->get_normal_style());
- curr->paint(this, y, hierarchical);
+ curr->paint(this, y, hierarchical, st);
if(hierarchical)
++i;
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.h (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.h Sat Jun 4 17:54:12 2005
@@ -1,6 +1,6 @@
// vs_tree.h (this is -*-c++-*-)
//
-// Copyright 1999 Daniel Burrows
+// Copyright 1999-2001, 2004-2005 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
@@ -126,7 +126,7 @@
bool vs_tree::get_cursorvisible();
point vs_tree::get_cursorloc();
virtual bool focus_me() {return true;}
- virtual void paint();
+ virtual void paint(const style &st);
virtual void dispatch_mouse(short id, int x, int y, int z, mmask_t bstate);
void set_selection(vs_treeiterator to);
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_treeitem.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_treeitem.cc (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_treeitem.cc Sat Jun 4 17:54:12 2005
@@ -13,8 +13,8 @@
{
}
-void vs_treeitem::paint(vs_tree *win, int y, bool hierarchical, string str,
- int depth_shift)
+void vs_treeitem::paint(vs_tree *win, int y, bool hierarchical,
+ const string &str, int depth_shift)
{
int width, height;
int basex=hierarchical?depth_shift*get_depth():0;
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_treeitem.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_treeitem.h (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_treeitem.h Sat Jun 4 17:54:12 2005
@@ -106,17 +106,32 @@
public:
vs_treeitem(bool _selectable=true):depth(0),selectable(_selectable) {}
- virtual void paint(vs_tree *win, int y, bool hierarchical)=0;
- // Obviously used to display the item. Note that, contrary to how many
- // such display systems work, subtrees do NOT display their children here!
- // When this routine is called, the colors are correct for the current
- // state (eg, highlighted or unhighlighted)
- //
- // If "hierarchical" is false, we're displaying the objects as a
- // Yahoo-style tree.
-
+ /** Display this item and this item only (does not descend to the
+ * children of the item, if any). The current style of the
+ * corresponding tree widget will be initialized using
+ * get_normal_style() and/or get_highlight_style() prior to the
+ * invocation of this method.
+ *
+ * \param win the tree in which to paint this item
+ * \param y the y location at which to paint this item
+ * \param hierarchical if \b true, paint this item as an
+ * entry in a 'hierarchical' tree.
+ * \param st the style with which this item is being displayed.
+ */
+ virtual void paint(vs_tree *win, int y, bool hierarchical,
+ const style &st)=0;
+
+ /** Display the given text as the label of this item at the given
+ * shifted depth.
+ *
+ * \param win the tree in which to paint this item
+ * \param y the y location at which to paint this item
+ * \param hierarchical if \b true, paint this item as an
+ * entry in a 'hierarchical' tree
+ * \param st the style with which this item is to be displayed.
+ */
void paint(vs_tree *win, int y, bool hierarchical,
- std::string str, int depth_shift=2);
+ const std::string &str, int depth_shift=2);
virtual const char *tag() const =0;
// The tag that this item should be sorted by [for the trivial version of
@@ -128,7 +143,7 @@
bool get_selectable() {return selectable;}
virtual style get_normal_style() {return style();}
- virtual style get_highlight_style() {return style_attrs_flip(A_REVERSE);}
+ virtual style get_highlight_style() {return get_normal_style()+style_attrs_flip(A_REVERSE);}
virtual void sort(const sortpolicy &sort_method) {}
// Sorts an item's subtree using the given method.