[Aptitude-svn-commit] r3317 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows@costa.debian.org
Mon, 06 Jun 2005 17:56:40 +0000


Author: dburrows
Date: Mon Jun  6 17:56:38 2005
New Revision: 3317

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.h
   branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_togglebutton.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_togglebutton.h
Log:
Update the vs_togglebutton widget for the new display protocol.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Jun  6 17:56:38 2005
@@ -1,5 +1,9 @@
 2005-06-06  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vs_togglebutton.cc:
+
+	Update the vs_togglebutton widget for the new display protocol.
+
 	* src/vscreen/vs_size_box.cc:
 
 	Update the size-box to use set_opaque() instead of set_bg().

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.cc	Mon Jun  6 17:56:38 2005
@@ -96,14 +96,14 @@
       }
 }
 
-void vs_stacked::paint()
+void vs_stacked::paint(const style &st)
 {
   // Go through the children back-to-front (reverse order)
   for(childlist::reverse_iterator i=children.rbegin();
       i!=children.rend();
       i++)
     if(i->w->get_visible())
-      i->w->display();
+      i->w->display(st);
 }
 
 void vs_stacked::dispatch_mouse(short id, int x, int y, int z, mmask_t bstate)

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.h	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.h	Mon Jun  6 17:56:38 2005
@@ -42,7 +42,7 @@
 
   void hide_widget();
 protected:
-  void paint();
+  void paint(const style &st);
 public:
   // The size passed in is used as a preferred size.  (what we get might be
   // larger or smaller)

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.cc	Mon Jun  6 17:56:38 2005
@@ -65,7 +65,7 @@
 {
   // Wasteful: calculate the contents and throw them away.
   if(f!=NULL)
-    return f->layout(w, w).size();
+    return f->layout(w, w, style()).size();
   else
     return 0;
 }
@@ -159,7 +159,7 @@
 {
   if(stale || lastw != getmaxx())
     {
-      contents=f->layout(getmaxx(), getmaxx());
+      contents=f->layout(getmaxx(), getmaxx(), style());
       stale=false;
       lastw=getmaxx();
 

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_togglebutton.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_togglebutton.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_togglebutton.cc	Mon Jun  6 17:56:38 2005
@@ -41,29 +41,23 @@
   return point(0, getmaxy()/2);
 }
 
-void vs_togglebutton::paint()
+void vs_togglebutton::paint(const style &st)
 {
   const size_t labelw=getmaxx()>=4?getmaxx()-4:0;
-  const fragment_contents lines=get_label()->layout(labelw, labelw);
+  const fragment_contents lines=get_label()->layout(labelw, labelw, st);
   const size_t checkheight=getmaxy()/2;
 
+  const style button_style=get_isfocussed()?st+style_attrs_flip(A_REVERSE):st;
+
   for(size_t i=0; i<min<size_t>(lines.size(), getmaxy()); ++i)
     {
       if(i==checkheight)
 	{
-	  if(get_isfocussed())
-	    {
-	      bkgdset(get_bg()^A_REVERSE);
-	      attrset(get_bg()^A_REVERSE);
-	    }
+	  apply_style(button_style);
 
 	  paint_check(i);
 
-	  if(get_isfocussed())
-	    {
-	      bkgdset(get_bg());
-	      attrset(get_bg());
-	    }
+	  apply_style(st);
 	}
 
       mvaddnstr(i, 4, lines[i], lines[i].size());

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_togglebutton.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_togglebutton.h	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_togglebutton.h	Mon Jun  6 17:56:38 2005
@@ -31,7 +31,7 @@
 
   point get_cursorloc();
 
-  void paint();
+  void paint(const style &st);
 
   bool get_checked() {return checked;}
   void set_checked(bool _checked)