pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2593 - in trunk/src: editor gui


From: jave27
Subject: [Pingus-CVS] r2593 - in trunk/src: editor gui
Date: Mon, 16 Jan 2006 03:53:16 +0100

Author: jave27
Date: 2006-01-16 03:52:31 +0100 (Mon, 16 Jan 2006)
New Revision: 2593

Modified:
   trunk/src/editor/panel_buttons.cxx
   trunk/src/gui/combobox.cxx
   trunk/src/gui/combobox.hxx
Log:
Gave Combobox class a "selected" highlight box when it's in drop-down 
mode.
Removed test output from groundpiece button.



Modified: trunk/src/editor/panel_buttons.cxx
===================================================================
--- trunk/src/editor/panel_buttons.cxx  2006-01-16 02:35:07 UTC (rev 2592)
+++ trunk/src/editor/panel_buttons.cxx  2006-01-16 02:52:31 UTC (rev 2593)
@@ -157,7 +157,6 @@
        for (unsigned i = 0; i < groundpieces.size(); i++)
        {
                panel->get_combobox(1)->add(new GUI::ComboItem(1, 
groundpieces[i]));
-               std::cout << groundpieces[i] << std::endl;
        }
        
        panel->get_combobox(1)->set_enabled(true);

Modified: trunk/src/gui/combobox.cxx
===================================================================
--- trunk/src/gui/combobox.cxx  2006-01-16 02:35:07 UTC (rev 2592)
+++ trunk/src/gui/combobox.cxx  2006-01-16 02:52:31 UTC (rev 2593)
@@ -32,7 +32,8 @@
        drop_down(false),
        pos(p),
        enabled(false),
-       label(l)
+       label(l),
+       hover(false)
 {
        // Default to 20 characters wide.
        width = Fonts::smallfont.get_width('O') * 20.0f;
@@ -147,8 +148,9 @@
 
        if (drop_down && item_list.size() > 0)
        {
-               // FIXME: Implement - Draw the "highlighted" rectangle.
-               // FIXME: Need to have the mouse pointer x,y coordinates for 
this function.
+               // Draw the highlighted box
+               int y_offset = int(int(((mouse_pos.y - pos.y - 
height)/height)+1) * height);
+               gc.draw_fillrect(pos.x, y_offset, pos.x + get_width(), y_offset 
+ height, CL_Color::gray);
                
                // Draw all of the items
                for (unsigned i = 0; i < item_list.size(); i++)

Modified: trunk/src/gui/combobox.hxx
===================================================================
--- trunk/src/gui/combobox.hxx  2006-01-16 02:35:07 UTC (rev 2592)
+++ trunk/src/gui/combobox.hxx  2006-01-16 02:52:31 UTC (rev 2593)
@@ -89,6 +89,12 @@
        /** Whether or not the list is showing right now */
        bool drop_down;
 
+       /** Is the mouse hovering over this object? */
+       bool hover;
+
+       /** Where the mouse is located */
+       Vector mouse_pos;
+
        /** Width of the Combobox */
        float width;
 
@@ -149,6 +155,10 @@
       same component */
   virtual void on_primary_button_click (int x, int y);
        
+       virtual void on_pointer_enter() { hover = true; }
+       virtual void on_pointer_leave() { hover = false; }
+       virtual void on_pointer_move(int x, int y) { mouse_pos = Vector(x, y); }
+       
        /** Sets whether or not this combobox is clickable */
        virtual void set_enabled(bool e) { enabled = e; }
        





reply via email to

[Prev in Thread] Current Thread [Next in Thread]