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

Daniel Burrows dburrows@costa.debian.org
Sat, 04 Jun 2005 17:34:11 +0000


Author: dburrows
Date: Sat Jun  4 17:34:09 2005
New Revision: 3306

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_label.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_label.h
Log:
Update the label for the new style system.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Jun  4 17:34:09 2005
@@ -1,5 +1,9 @@
 2005-06-04  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vs_label.cc, src/vscreen/vs_label.h:
+
+	Update the label widget to the new display protocol.
+
 	* src/vscreen/vs_editline.cc:
 
 	Update the edit-line widget to the new display protocol.

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_label.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_label.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_label.cc	Sat Jun  4 17:34:09 2005
@@ -16,10 +16,10 @@
   txt=new fragment_cache(f);
 }
 
-vs_label::vs_label(const string &_txt, int _attr)
-  :txt(new fragment_cache(text_fragment(_txt, _attr)))
+vs_label::vs_label(const string &_txt, const style &st)
+  :txt(new fragment_cache(text_fragment(_txt)))
 {
-  set_bg(_attr);
+  set_bg_style(st);
 }
 
 vs_label::vs_label(const string &_txt)
@@ -42,14 +42,15 @@
   return point(0,0);
 }
 
-void vs_label::set_text(const string &_txt, int attr)
+void vs_label::set_text(const string &_txt, const style &st)
 {
-  set_text(text_fragment(_txt, attr));
+  set_text(text_fragment(_txt));
+  set_bg_style(st);
 }
 
 void vs_label::set_text(const string &_txt)
 {
-  set_text(_txt, get_bg());
+  set_text(_txt);
 }
 
 void vs_label::set_text(fragment *f)
@@ -60,9 +61,9 @@
   vscreen_queuelayout();
 }
 
-void vs_label::paint()
+void vs_label::paint(const style &st)
 {
-  fragment_contents lines=txt->layout(getmaxx(), getmaxx());
+  fragment_contents lines=txt->layout(getmaxx(), getmaxx(), st);
 
   for(size_t i=0; i<lines.size() && i<(unsigned) getmaxy(); ++i)
     mvaddnstr(i, 0, lines[i], lines[i].size());
@@ -75,10 +76,9 @@
 
 int vs_label::height_request(int width)
 {
-  return txt->layout(width, width).size();
+  return txt->layout(width, width, style()).size();
 }
 
-
 bool vs_transientlabel::handle_char(chtype ch)
 {
   destroy();

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_label.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_label.h	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_label.h	Sat Jun  4 17:34:09 2005
@@ -13,7 +13,7 @@
   fragment_cache *txt;
 public:
   vs_label(fragment *f);
-  vs_label(const std::string &_txt, int attr);
+  vs_label(const std::string &_txt, const style &st);
   vs_label(const std::string &_txt);
   ~vs_label();
 
@@ -26,8 +26,8 @@
   /** \return the number of lines in the label. */
   int height_request(int width);
 
-  void paint();
-  void set_text(const std::string &_txt, int attr);
+  void paint(const style &st);
+  void set_text(const std::string &_txt, const style &st);
   void set_text(const std::string &_txt);
   void set_text(fragment *f);
 };
@@ -39,8 +39,8 @@
 protected:
   virtual bool handle_char(chtype ch);
 public:
-  vs_transientlabel(std::string _msg, int _attr)
-    :vs_label(_msg, _attr)
+  vs_transientlabel(std::string msg, const style &st)
+    :vs_label(msg, st)
   {
   }