Author: baufo
Date: Sat Feb  7 15:25:22 2009
New Revision: 32638

URL: http://svn.gna.org/viewcvs/wesnoth?rev=32638&view=rev
Log:
hacking two more virtual functions of the makeshift password box - hopefully it 
behaves correctly now.

Modified:
    trunk/src/gui/widgets/password_box.cpp
    trunk/src/gui/widgets/password_box.hpp

Modified: trunk/src/gui/widgets/password_box.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/password_box.cpp?rev=32638&r1=32637&r2=32638&view=diff
==============================================================================
--- trunk/src/gui/widgets/password_box.cpp (original)
+++ trunk/src/gui/widgets/password_box.cpp Sat Feb  7 15:25:22 2009
@@ -34,6 +34,38 @@
 void tpassword_box::delete_char(const bool before_cursor) {
        pre_function();
        ttext_box::delete_char(before_cursor);
+       post_function();
+}
+
+void tpassword_box::handle_key_backspace(SDLMod modifier, bool& handled) {
+       pre_function();
+
+       // Copy & paste from ttext_::handle_key_backspace()
+       DBG_G_E << "Text: key press: backspace.\n";
+
+       handled = true;
+       if(get_selection_length() != 0) {
+               delete_selection();
+       } else if(get_selection_start()){
+               delete_char(true);
+       }
+
+       post_function();
+}
+
+void tpassword_box::handle_key_delete(SDLMod modifier, bool& handled) {
+       pre_function();
+
+       // Copy & paste from ttext_::handle_key_delete()
+       DBG_G_E << "Text: key press: delete.\n";
+
+       handled = true;
+       if(get_selection_length() != 0) {
+               delete_selection();
+       } else if (get_selection_start() < text().size()) {
+               delete_char(false);
+       }
+
        post_function();
 }
 

Modified: trunk/src/gui/widgets/password_box.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/password_box.hpp?rev=32638&r1=32637&r2=32638&view=diff
==============================================================================
--- trunk/src/gui/widgets/password_box.hpp (original)
+++ trunk/src/gui/widgets/password_box.hpp Sat Feb  7 15:25:22 2009
@@ -66,6 +66,9 @@
        // actually want it to copy just the stars
 
 private:
+       void handle_key_backspace(SDLMod modifier, bool& handled);
+       void handle_key_delete(SDLMod modifier, bool& handled);
+
        void pre_function();
        void post_function();
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to