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

Daniel Burrows dburrows@costa.debian.org
Mon, 27 Jun 2005 15:49:01 +0000


Author: dburrows
Date: Mon Jun 27 15:48:58 2005
New Revision: 3477

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vscreen_widget.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vscreen_widget.h
Log:
Use the new key type in the key-handling methods.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Jun 27 15:48:58 2005
@@ -1,5 +1,9 @@
 2005-06-27  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vscreen_widget.cc, src/vscreen/vscreen_widget.h:
+
+	  Make the key-handling methods take keys instead of wint_ts.
+
 	* src/vscreen/config/keybindings.cc, src/vscreen/config/keybindings.h:
 
 	  First crack at revising the keybinding routines to handle

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vscreen_widget.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vscreen_widget.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vscreen_widget.cc	Mon Jun 27 15:48:58 2005
@@ -193,14 +193,14 @@
   return !auxillary_bindings.empty();
 }
 
-bool vscreen_widget::handle_char(wint_t ch)
+bool vscreen_widget::handle_key(const key &k)
 {
   bool rval=false;
 
   for(key_connection i=auxillary_post_bindings.begin();
       i!=auxillary_post_bindings.end();
       i++)
-    if(i->bindings->key_matches(ch, i->keyname))
+    if(i->bindings->key_matches(k, i->keyname))
       {
 	i->slot();
 	rval=true;
@@ -209,20 +209,20 @@
   return rval;
 }
 
-bool vscreen_widget::dispatch_char(wint_t ch)
+bool vscreen_widget::dispatch_key(const key &k)
 {
   bool rval=false;
 
   for(key_connection i=auxillary_bindings.begin();
       i!=auxillary_bindings.end();
       i++)
-    if(i->bindings->key_matches(ch, i->keyname))
+    if(i->bindings->key_matches(k, i->keyname))
       {
 	i->slot();
 	rval=true;
       }
 
-  return rval || handle_char(ch);
+  return rval || handle_char(k);
 }
 
 void vscreen_widget::dispatch_mouse(short id, int x, int y, int z,

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vscreen_widget.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vscreen_widget.h	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vscreen_widget.h	Mon Jun 27 15:48:58 2005
@@ -125,9 +125,14 @@
    */
   virtual void paint(const style &st)=0;
 
-  // Returns true if it consumed the character (otherwise, it'll be processed
-  // further)
-  virtual bool handle_char(wint_t ch);
+  /** Handles a keypress in this widget.
+   *
+   *  \param k the key that was pressed (see keybindings.h).
+   *
+   *  \return \b true if the key was consumed; if \b false is
+   *  returned, further processing of the key will be performed.
+   */
+  virtual bool handle_key(const key &k);
 public:
   static void handle_pending_deletes();
 
@@ -159,9 +164,9 @@
 
   virtual ~vscreen_widget();
 
-  // This should be called when an arbitrary widget is to have a character
-  // sent to it.
-  bool dispatch_char(wint_t);
+  // This should be called when an arbitrary widget is to have a
+  // keypress sent to it.
+  bool dispatch_key(const key & k);
 
   // This should be called when an arbitrary widget is to have a mouse event
   // sent to it.  Override it to change mousing behavior.