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

Daniel Burrows dburrows@costa.debian.org
Sun, 08 May 2005 12:49:38 +0000


Author: dburrows
Date: Sun May  8 12:49:34 2005
New Revision: 3269

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/config/style.h
Log:
Add some routines to make it easy to generate canned styles.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun May  8 12:49:34 2005
@@ -1,3 +1,9 @@
+2005-05-08  Daniel Burrows  <dburrows@debian.org>
+
+	* src/vscreen/config/style.h:
+
+	Add factory routines to make it easy to generate canned styles.
+
 2005-05-07  Daniel Burrows  <dburrows@debian.org>
 
 	* src/vscreen/config/colors.cc, src/vscreen/config/colors.h:

Modified: branches/aptitude-0.3/aptitude/src/vscreen/config/style.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/config/style.h	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/config/style.h	Sun May  8 12:49:34 2005
@@ -141,6 +141,55 @@
   }
 };
 
+// To allow styles to be built functionally, the following
+// 'constructors' are provided.  The main idea here is to make
+// default-setting more compact and less obscure.
+
+/** \return a style that just sets the foreground color to the
+ *          given value.
+ */
+inline style style_fg(short fg)
+{
+  style rval;
+  rval.set_fg(fg);
+  return rval;
+}
+
+/** \return a style that just sets the background color to the
+ *          given value.
+ */
+inline style style_bg(short bg)
+{
+  style rval;
+  rval.set_bg(bg);
+  return rval;
+}
+
+/** \return a style that just sets the given attributes.
+ */
+inline style style_attr_on(attr_t attrs)
+{
+  style rval;
+  rval.attr_on(attrs);
+  return rval;
+}
+
+/** \return a style that just clears the given attributes. */
+inline style style_attr_off(attr_t attrs)
+{
+  style rval;
+  rval.attr_off(attrs);
+  return rval;
+}
+
+/** \return a style that just flips the given attributes. */
+inline style style_attr_flip(attr_t attrs)
+{
+  style rval;
+  rval.attr_flip(attrs);
+  return rval;
+}
+
 /** Look up a style in the global registry.  If there is no style
  *  registered by this name, returns the empty style.
  *