paragui-cvs
[Top][All Lists]
Advanced

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

[paragui-cvs] CVS: paragui/test/colorselector main.cpp,1.1.2.1,1.1.2.2 p


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/test/colorselector main.cpp,1.1.2.1,1.1.2.2 pgcolorselector.cpp,1.1.2.3,1.1.2.4 pgcolorselector.h,1.1.2.3,1.1.2.4
Date: Fri, 12 Jul 2002 06:12:17 -0400

Update of /cvsroot/paragui/paragui/test/colorselector
In directory subversions:/tmp/cvs-serv13359/test/colorselector

Modified Files:
      Tag: devel-1-0
        main.cpp pgcolorselector.cpp pgcolorselector.h 
Log Message:
added PG_ThemeWidget::SetBackgroundColor
made colorselector workingi, somehow



Index: main.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/colorselector/Attic/main.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** main.cpp    12 Jul 2002 06:10:21 -0000      1.1.2.1
--- main.cpp    12 Jul 2002 10:12:14 -0000      1.1.2.2
***************
*** 23,28 ****
        }
  
!       PG_ColorSelector colorsel(NULL, PG_Rect(10,10,300,150));
!       colorsel.Show();
        
        app.SetEmergencyQuit(true);
--- 23,49 ----
        }
  
!       PG_ColorSelector colorsel1(NULL, PG_Rect(10,10,300,150));
!       colorsel1.Show();
! 
!       PG_Gradient g;
!       g.colors[0].r = 255;
!       g.colors[0].g = 0;
!       g.colors[0].b = 0;
!       
!       g.colors[1].r = 0;
!       g.colors[1].g = 255;
!       g.colors[1].b = 0;
!       
!       g.colors[2].r = 0;
!       g.colors[2].g = 0;
!       g.colors[2].b = 255;
!       
!       g.colors[3].r = 255;
!       g.colors[3].g = 255;
!       g.colors[3].b = 255;
!       
!       PG_ColorSelector colorsel2(NULL, PG_Rect(10,170,300,150));
!       colorsel2.SetColorGradient(g);
!       colorsel2.Show();
        
        app.SetEmergencyQuit(true);

Index: pgcolorselector.cpp
===================================================================
RCS file: 
/cvsroot/paragui/paragui/test/colorselector/Attic/pgcolorselector.cpp,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** pgcolorselector.cpp 12 Jul 2002 09:33:42 -0000      1.1.2.3
--- pgcolorselector.cpp 12 Jul 2002 10:12:14 -0000      1.1.2.4
***************
*** 113,117 ****
        my_colorslider->SetBackground((SDL_Surface*)NULL);
        my_colorslider->SetSimpleBackground(false);
! 
        SetBaseColor(my_colorbox->GetBaseColor());
  }
--- 113,121 ----
        my_colorslider->SetBackground((SDL_Surface*)NULL);
        my_colorslider->SetSimpleBackground(false);
!       my_colorslider->SetEventObject(MSG_SLIDE, this, 
(MSG_CALLBACK_OBJ)&PG_ColorSelector::handle_colorslide, NULL);
!       
!       my_colorresult = new PG_ThemeWidget(this, PG_Rect(r.h+20,r.h/2,r.w - 
((r.h+20)+5), r.h - (5+r.h/2)));
!       my_colorresult->SetSimpleBackground(true);
!       
        SetBaseColor(my_colorbox->GetBaseColor());
  }
***************
*** 145,147 ****
--- 149,166 ----
  
        my_colorslider->SetGradient(g);
+       
+       float v = my_colorslider->GetPosition();
+       
+       SDL_Color r;
+       r.r = (Uint8)(((float)c.r / 255.0) * (255.0 - v));
+       r.g = (Uint8)(((float)c.g / 255.0) * (255.0 - v));
+       r.b = (Uint8)(((float)c.b / 255.0) * (255.0 - v));
+       
+       my_colorresult->SetBackgroundColor(r);
+       my_colorresult->Update();
+ }
+ 
+ PARAGUI_CALLBACK(PG_ColorSelector::handle_colorslide) {
+       SetBaseColor(my_colorbox->GetBaseColor());
+       return true;
  }

Index: pgcolorselector.h
===================================================================
RCS file: /cvsroot/paragui/paragui/test/colorselector/Attic/pgcolorselector.h,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** pgcolorselector.h   12 Jul 2002 09:33:42 -0000      1.1.2.3
--- pgcolorselector.h   12 Jul 2002 10:12:14 -0000      1.1.2.4
***************
*** 3,9 ****
  
  #include "pgthemewidget.h"
  #include "pgslider.h"
  
! class DECLSPEC PG_ColorSelector : public PG_ThemeWidget {
  protected:
        
--- 3,10 ----
  
  #include "pgthemewidget.h"
+ #include "pgeventobject.h"
  #include "pgslider.h"
  
! class DECLSPEC PG_ColorSelector : public PG_ThemeWidget, public 
PG_EventObject {
  protected:
        
***************
*** 26,30 ****
                bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
                bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
!                               
        private:
                
--- 27,31 ----
                bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
                bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
!               
        private:
                
***************
*** 40,49 ****
--- 41,57 ----
        void SetColor(const SDL_Color& c);
        
+       inline void SetColorGradient(PG_Gradient g) {
+               my_colorbox->SetGradient(g);
+       }
+ 
  protected:
        
+       PARAGUI_CALLBACK(handle_colorslide);
+ 
        void SetBaseColor(const SDL_Color& c);
        
        PG_ColorBox* my_colorbox;
        PG_Slider* my_colorslider;
+       PG_ThemeWidget* my_colorresult;
        
        SDL_Color my_color;




reply via email to

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