mail[Wesnoth-commits] r20307 - in /trunk/src/widgets: menu.cpp menu.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by alinktomine on September 11, 2007 - 18:22:
Author: alink
Date: Tue Sep 11 18:22:23 2007
New Revision: 20307

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20307&view=rev
Log:
Remove the mouseover-highlighting in menus when the mouse is not on it

Modified:
    trunk/src/widgets/menu.cpp
    trunk/src/widgets/menu.hpp

Modified: trunk/src/widgets/menu.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/widgets/menu.cpp?rev=20307&r1=20306&r2=20307&view=diff
==============================================================================
--- trunk/src/widgets/menu.cpp (original)
+++ trunk/src/widgets/menu.cpp Tue Sep 11 18:22:23 2007
@@ -159,7 +159,7 @@
           max_height_(max_height), max_width_(max_width), max_items_(-1), 
item_height_(-1),
                  heading_height_(-1),
          cur_help_(-1,-1), help_string_(-1),
-         selected_(0), click_selects_(click_selects),
+         selected_(0), click_selects_(click_selects), out_(false),
          previous_button_(true), show_result_(false),
          double_clicked_(false),
          num_selects_(true),
@@ -657,8 +657,14 @@
        } else if(event.type == SDL_MOUSEMOTION) {
                if(click_selects_) {
                        const int item = hit(event.motion.x,event.motion.y);
-                       if (item != -1)
+                       const bool out = (item == -1);
+                       if (out_ != out) {
+                                       out_ = out;
+                                       invalidate_row_pos(selected_);
+                       }
+                       if (item != -1) {
                                move_selection_to(item);
+                       }
                }
 
                const int heading_item = 
hit_heading(event.motion.x,event.motion.y);
@@ -933,7 +939,8 @@
        style_->draw_row(*this,0,heading_rect,HEADING_ROW);
 
        for(size_t i = 0; i != item_pos_.size(); ++i) {
-               
style_->draw_row(*this,item_pos_[i],get_item_rect(i),item_pos_[i] == 
selected_ ? SELECTED_ROW : NORMAL_ROW);
+               style_->draw_row(*this,item_pos_[i],get_item_rect(i),
+                        (!out_ && item_pos_[i] == selected_) ? SELECTED_ROW 
: NORMAL_ROW);
        }
 }
 
@@ -956,7 +963,8 @@
                                const unsigned int pos = item_pos_[*i];
                                const SDL_Rect& rect = get_item_rect(*i);
                                bg_restore(rect);
-                               style_->draw_row(*this,pos,rect,pos == 
selected_ ? SELECTED_ROW : NORMAL_ROW);
+                               style_->draw_row(*this,pos,rect,
+                                       (!out_ && pos == selected_) ? 
SELECTED_ROW : NORMAL_ROW);
                                update_rect(rect);
                        }
                }

Modified: trunk/src/widgets/menu.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/widgets/menu.hpp?rev=20307&r1=20306&r2=20307&view=diff
==============================================================================
--- trunk/src/widgets/menu.hpp (original)
+++ trunk/src/widgets/menu.hpp Tue Sep 11 18:22:23 2007
@@ -237,6 +237,7 @@
 
        size_t selected_;
        bool click_selects_;
+       bool out_;
        bool previous_button_;
        //std::set<size_t> undrawn_items_;
 




Related Messages


Powered by MHonArc, Updated Tue Sep 11 18:40:30 2007