paragui-cvs
[Top][All Lists]
Advanced

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

[paragui-cvs] CVS: paragui/src/widgets Makefile.am,1.1.1.1,1.2 pgbutton.


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/widgets Makefile.am,1.1.1.1,1.2 pgbutton.cpp,1.1.1.1,1.2 pgbuttongroup.cpp,1.1.1.1,1.2 pgcheckbutton.cpp,1.1.1.1,1.2 pgcolumnitem.cpp,1.1.1.1,1.2 pgdropdown.cpp,1.1.1.1,1.2 pgimage.cpp,1.1.1.1,1.2 pglabel.cpp,1.1.1.1,1.2 pglineedit.cpp,1.1.1.1,1.2 pglistbox.cpp,1.1.1.1,1.2 pglistboxbaseitem.cpp,1.1.1.1,1.2 pglistboxitem.cpp,1.1.1.1,1.2 pgmaskedit.cpp,1.1.1.1,1.2 pgmessagebox.cpp,1.1.1.1,1.2 pgnotebook.cpp,1.1.1.1,1.2 pgpopupmenu.cpp,1.1.1.1,1.2 pgprogressbar.cpp,1.1.1.1,1.2 pgradiobutton.cpp,1.1.1.1,1.2 pgrichedit.cpp,1.1.1.1,1.2 pgscrollbar.cpp,1.1.1.1,1.2 pgslider.cpp,1.1.1.1,1.2 pgspinnerbox.cpp,1.1.1.1,1.2 pgthemewidget.cpp,1.1.1.1,1.2 pgwidget.cpp,1.1.1.1,1.2 pgwidgetdnd.cpp,1.1.1.1,1.2 pgwidgetlist.cpp,1.1.1.1,1.2 pgwidgetlistex.cpp,1.1.1.1,1.2 pgwindow.cpp,1.1.1.1,1.2
Date: Mon, 15 Apr 2002 09:31:36 -0400

Update of /cvsroot/paragui/paragui/src/widgets
In directory subversions:/tmp/cvs-serv21582/src/widgets

Modified Files:
        Makefile.am pgbutton.cpp pgbuttongroup.cpp pgcheckbutton.cpp 
        pgcolumnitem.cpp pgdropdown.cpp pgimage.cpp pglabel.cpp 
        pglineedit.cpp pglistbox.cpp pglistboxbaseitem.cpp 
        pglistboxitem.cpp pgmaskedit.cpp pgmessagebox.cpp 
        pgnotebook.cpp pgpopupmenu.cpp pgprogressbar.cpp 
        pgradiobutton.cpp pgrichedit.cpp pgscrollbar.cpp pgslider.cpp 
        pgspinnerbox.cpp pgthemewidget.cpp pgwidget.cpp 
        pgwidgetdnd.cpp pgwidgetlist.cpp pgwidgetlistex.cpp 
        pgwindow.cpp 
Log Message:
imported version 1.0.1



Index: Makefile.am
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/Makefile.am,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Makefile.am 15 Apr 2002 13:22:16 -0000      1.1.1.1
--- Makefile.am 15 Apr 2002 13:31:31 -0000      1.2
***************
*** 35,38 ****
--- 35,39 ----
  
  INCLUDES = \
+       $(EXPAT_INCLUDE) \
        $(SDL_CFLAGS) \
        -I$(top_srcdir)/include

Index: pgbutton.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgbutton.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pgbutton.cpp        15 Apr 2002 13:22:16 -0000      1.1.1.1
--- pgbutton.cpp        15 Apr 2002 13:31:31 -0000      1.2
***************
*** 33,37 ****
  #include "pgdraw.h"
  
! typedef struct PG_ButtonDataInternal {
        SDL_Surface* srf_normal;
        SDL_Surface* srf_high;
--- 33,37 ----
  #include "pgdraw.h"
  
! struct PG_ButtonDataInternal {
        SDL_Surface* srf_normal;
        SDL_Surface* srf_high;
***************
*** 604,606 ****
--- 604,614 ----
  
        DrawBorder(PG_Rect(0, 0, Width(), Height()), my_bordersize[my_state], 
i1);
+ }
+ 
+ void PG_Button::SetBlendLevel(int mode, Uint8 blend) {
+       my_internaldata->backBlend[mode] = blend;
+ }
+ 
+ Uint8 PG_Button::GetBlendLevel(int mode) {
+       return my_internaldata->backBlend[mode];
  }

Index: pgbuttongroup.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgbuttongroup.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgcheckbutton.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgcheckbutton.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgcolumnitem.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgcolumnitem.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgdropdown.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgdropdown.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgimage.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgimage.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pglabel.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pglabel.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pglineedit.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pglineedit.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pglistbox.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pglistbox.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pglistbox.cpp       15 Apr 2002 13:22:16 -0000      1.1.1.1
--- pglistbox.cpp       15 Apr 2002 13:31:31 -0000      1.2
***************
*** 69,75 ****
  
        if(item == NULL) {
!               my_selectedItem->Select(false);
!               my_selectedItem->Update();
!               my_selectedItem = NULL;
                return;
        }
--- 69,77 ----
  
        if(item == NULL) {
!               if(my_selectedItem != NULL) {
!                       my_selectedItem->Select(false);
!                       my_selectedItem->Update();
!                       my_selectedItem = NULL;
!               }
                return;
        }

Index: pglistboxbaseitem.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pglistboxbaseitem.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pglistboxitem.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pglistboxitem.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pglistboxitem.cpp   15 Apr 2002 13:22:15 -0000      1.1.1.1
--- pglistboxitem.cpp   15 Apr 2002 13:31:31 -0000      1.2
***************
*** 31,35 ****
  
  PG_ListBoxItem::PG_ListBoxItem(int height, const char* text, SDL_Surface* 
icon, void* userdata, const char* style) : PG_ListBoxBaseItem(height, userdata) 
{
! 
        for(int i=0; i<3; i++) {
                my_background[i] = NULL;
--- 31,35 ----
  
  PG_ListBoxItem::PG_ListBoxItem(int height, const char* text, SDL_Surface* 
icon, void* userdata, const char* style) : PG_ListBoxBaseItem(height, userdata) 
{
!       
        for(int i=0; i<3; i++) {
                my_background[i] = NULL;
***************
*** 54,57 ****
--- 54,59 ----
                             my_bkmode[1],
                             my_blend[1]);
+                            
+       my_srfIcon = icon;
  }
  

Index: pgmaskedit.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgmaskedit.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgmessagebox.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgmessagebox.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgnotebook.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgnotebook.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgpopupmenu.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgpopupmenu.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgprogressbar.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgprogressbar.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgradiobutton.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgradiobutton.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgrichedit.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgrichedit.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgscrollbar.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgscrollbar.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgslider.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgslider.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgspinnerbox.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgspinnerbox.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgthemewidget.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgthemewidget.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pgthemewidget.cpp   15 Apr 2002 13:22:16 -0000      1.1.1.1
--- pgthemewidget.cpp   15 Apr 2002 13:31:31 -0000      1.2
***************
*** 34,38 ****
  static PG_SurfaceCache my_SurfaceCache;
  
! typedef struct PG_WidgetDataInternal{
        SDL_Surface* cachesurface;
        SDL_Color backgroundcolor;
--- 34,38 ----
  static PG_SurfaceCache my_SurfaceCache;
  
! struct PG_WidgetDataInternal{
        SDL_Surface* cachesurface;
        SDL_Color backgroundcolor;
***************
*** 197,200 ****
--- 197,236 ----
  }
  
+ bool PG_ThemeWidget::SetBackground(const char* filename, int mode, Uint32 
colorkey) {
+       // try to load the file
+       SDL_Surface* temp = PG_Application::LoadSurface(filename, true);
+ 
+       // success ?
+       if(!temp) {
+               return false;
+       }
+ 
+       // free previous surface
+       FreeSurface();
+ 
+       // mark my_background to be freed on destruction
+       my_backgroundFree = true;
+       my_backgroundMode = mode;
+       my_background = temp;
+ 
+       if(my_background == NULL) {
+               return false;
+       }
+ 
+       Uint32 c = SDL_MapRGB(
+               my_background->format, 
+               (colorkey>>16) & 0xFF,
+               (colorkey>>8) & 0xFF,
+               colorkey & 0xFF);
+               
+       SDL_SetColorKey(my_background, SDL_SRCCOLORKEY, c);
+        
+       if(my_srfObject == NULL) {
+               CreateSurface();
+       }
+ 
+       return (my_background != NULL);
+ }
+ 
  bool PG_ThemeWidget::SetBackground(const char* filename, int mode) {
  
***************
*** 431,435 ****
  
        if(background != NULL) {
!               if(background->format->BitsPerPixel > 8) {
                        bpp = background->format->BitsPerPixel;
                        Rmask = background->format->Rmask;
--- 467,471 ----
  
        if(background != NULL) {
!               if((background->format->Amask != 0) || ((bpp < 
background->format->BitsPerPixel) && (bpp <= 8))) {
                        bpp = background->format->BitsPerPixel;
                        Rmask = background->format->Rmask;
***************
*** 450,453 ****
--- 486,492 ----
                                   Amask
                               );
+                              
+       if ( bpp == 8 )
+               SDL_SetPalette ( surface, SDL_LOGPAL, 
screen->format->palette->colors, 0, 256 );
  
        if(surface) {

Index: pgwidget.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgwidget.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pgwidget.cpp        15 Apr 2002 13:22:15 -0000      1.1.1.1
--- pgwidget.cpp        15 Apr 2002 13:31:31 -0000      1.2
***************
*** 44,48 ****
  typedef std::map<std::string, PG_Widget*> PG_NameToWidgetMap;
  
! typedef struct PG_WidgetDataInternal{
  
        PG_Font* font;
--- 44,48 ----
  typedef std::map<std::string, PG_Widget*> PG_NameToWidgetMap;
  
! struct PG_WidgetDataInternal{
  
        PG_Font* font;
***************
*** 748,752 ****
  
  void PG_Widget::Blit(bool recursive, bool restore) {
! 
        if(!my_internaldata->visible) {
                return;
--- 748,754 ----
  
  void PG_Widget::Blit(bool recursive, bool restore) {
!       static PG_Rect src;
!       static PG_Rect dst;
!       
        if(!my_internaldata->visible) {
                return;
***************
*** 769,774 ****
  
        // get source & destination rectangles
!       PG_Rect src(my_internaldata->rectClip.x - my_xpos, 
my_internaldata->rectClip.y - my_ypos, my_internaldata->rectClip.w, 
my_internaldata->rectClip.h);
!       PG_Rect dst = my_internaldata->rectClip;
  
        // call the blit handler
--- 771,776 ----
  
        // get source & destination rectangles
!       src.SetRect(my_internaldata->rectClip.x - my_xpos, 
my_internaldata->rectClip.y - my_ypos, my_internaldata->rectClip.w, 
my_internaldata->rectClip.h);
!       dst = my_internaldata->rectClip;
  
        // call the blit handler
***************
*** 788,792 ****
  /**  */
  void PG_Widget::Update(bool doBlit) {
! 
        if(PG_Application::GetBulkMode()) {
                return;
--- 790,796 ----
  /**  */
  void PG_Widget::Update(bool doBlit) {
!       static PG_Rect src;
!       static PG_Rect dst;
!       
        if(PG_Application::GetBulkMode()) {
                return;
***************
*** 811,816 ****
                RestoreBackground(&my_internaldata->rectClip);
  
!               PG_Rect src(my_internaldata->rectClip.x - my_xpos, 
my_internaldata->rectClip.y - my_ypos, my_internaldata->rectClip.w, 
my_internaldata->rectClip.h);
!               PG_Rect dst = my_internaldata->rectClip;
  
                eventBlit(my_srfObject, src, dst);
--- 815,820 ----
                RestoreBackground(&my_internaldata->rectClip);
  
!               src.SetRect(my_internaldata->rectClip.x - my_xpos, 
my_internaldata->rectClip.y - my_ypos, my_internaldata->rectClip.w, 
my_internaldata->rectClip.h);
!               dst = my_internaldata->rectClip;
  
                eventBlit(my_srfObject, src, dst);
***************
*** 828,835 ****
                                index = children->FindIndexOf(this);
                                if(index != -1) {
-                                       //PG_RectList frontlist = 
children->Intersect(&my_internaldata->rectClip, index+1, -1);
                                        SDL_SetClipRect(my_srfScreen, 
&my_internaldata->rectClip);
                                        
children->Intersect(&my_internaldata->rectClip, index+1, 
-1).Blit(my_internaldata->rectClip);
-                                       
//frontlist.Blit(my_internaldata->rectClip);
                                }
                        }
--- 832,837 ----
***************
*** 843,850 ****
  
                if(index != -1) {
-                       //PG_RectList frontlist = 
widgetList.Intersect(&my_internaldata->rectClip, index+1, -1);
                        SDL_SetClipRect(my_srfScreen, 
&my_internaldata->rectClip);
                        widgetList.Intersect(&my_internaldata->rectClip, 
index+1, -1).Blit(my_internaldata->rectClip);
-                       //frontlist.Blit(my_internaldata->rectClip);
                }
  
--- 845,850 ----
***************
*** 878,882 ****
  
  void PG_Widget::StartWidgetDrag() {
!         int x, y;
        
        SDL_GetMouseState(&x, &y);
--- 878,882 ----
  
  void PG_Widget::StartWidgetDrag() {
!       int x, y;
        
        SDL_GetMouseState(&x, &y);
***************
*** 1094,1099 ****
                if(index != -1) {
                        SDL_SetClipRect(my_srfScreen, clip);
-                       //PG_RectList backlist = widgetList.Intersect(clip, 0, 
index);
-                       //backlist.Blit(*clip);
                        widgetList.Intersect(clip, 0, index).Blit(*clip);
                }
--- 1094,1097 ----
***************
*** 1149,1156 ****
  
        PG_Application::RedrawBackground(r);
-       //PG_RectList list = widgetList.Intersect((PG_Rect*)&r);
        SDL_SetClipRect(screen, (PG_Rect*)&r);
        widgetList.Intersect((PG_Rect*)&r).Blit(r);
-       //list.Blit(r);
        SDL_SetClipRect(screen, NULL);
  }
--- 1147,1152 ----
***************
*** 1484,1487 ****
--- 1480,1487 ----
  }
  
+ void PG_Widget::QuitModal() {
+               SendMessage(this, MSG_MODALQUIT, 0, 0);
+ }
+ 
  int PG_Widget::RunModal() {
        SDL_Event event;
***************
*** 1603,1619 ****
  
  void PG_Widget::DrawHLine(int x, int y, int w, Uint8 r, Uint8 g, Uint8 b) {
!       int x1 = x + w;
  
!       for (int x0 = x; x0 < x1; x0++) {
!               SetPixel(x0, y, r, g, b/*, surface*/);
        }
  }
  
  void PG_Widget::DrawVLine(int x, int y, int h, Uint8 r, Uint8 g, Uint8 b) {
!       int y1 = y + h;
  
!       for (int y0 = y; y0 < y1; y0++) {
!               SetPixel(x, y0, r, g, b/*, surface*/);
        }
  }
  
--- 1603,1693 ----
  
  void PG_Widget::DrawHLine(int x, int y, int w, Uint8 r, Uint8 g, Uint8 b) {
!       static PG_Rect rect;
!       SDL_Surface* surface = my_srfObject;
!       
!       if(my_srfObject == NULL) {
!               surface = my_srfScreen;
!       }
!       
!       x += my_xpos;
!       y += my_ypos;
  
!       if((y < my_internaldata->rectClip.y) || (y >= 
(my_internaldata->rectClip.y+my_internaldata->rectClip.h))) {
!               return;
        }
+       
+       SDL_GetClipRect(surface, &rect);
+ 
+       if((y < rect.y) || (y >= (rect.y+rect.h))) {
+               return;
+       }
+ 
+       // clip to widget cliprect
+       int x0 = PG_MAX(x, my_internaldata->rectClip.x);
+       int x1 = PG_MIN(x+w, 
my_internaldata->rectClip.x+my_internaldata->rectClip.w);
+       Uint32 c = SDL_MapRGB(surface->format, r, g, b);
+ 
+       // clip to surface cliprect
+       x0 = PG_MAX(x0, rect.x);
+       x1 = PG_MIN(x1, rect.x+rect.w);
+ 
+       int wl = (x1-x0);
+       
+       if(wl <= 0) {
+               return;
+       }
+       
+       if(my_srfObject != NULL) {
+               x0 -= my_xpos;
+               y -= my_ypos;
+       }
+ 
+       rect.SetRect(x0, y, wl, 1);
+       SDL_FillRect(surface, &rect, c);
  }
  
  void PG_Widget::DrawVLine(int x, int y, int h, Uint8 r, Uint8 g, Uint8 b) {
!       static PG_Rect rect;
!       SDL_Surface* surface = my_srfObject;
!       
!       if(my_srfObject == NULL) {
!               surface = my_srfScreen;
!       }
!       
!       x += my_xpos;
!       y += my_ypos;
! 
!       if((x < my_internaldata->rectClip.x) || (x >= 
(my_internaldata->rectClip.x+my_internaldata->rectClip.w))) {
!               return;
!       }
!       
!       SDL_GetClipRect(surface, &rect);
  
!       if((x < rect.x) || (x >= (rect.x+rect.w))) {
!               return;
        }
+ 
+       // clip to widget cliprect
+       int y0 = PG_MAX(y, my_internaldata->rectClip.y);
+       int y1 = PG_MIN(y+h, 
my_internaldata->rectClip.y+my_internaldata->rectClip.h);
+       Uint32 c = SDL_MapRGB(surface->format, r, g, b);
+ 
+       // clip to surface cliprect
+       y0 = PG_MAX(y0, rect.y);
+       y1 = PG_MIN(y1, rect.y+rect.h);
+ 
+       int hl = (y1-y0);
+       
+       if(hl <= 0) {
+               return;
+       }
+       
+       if(my_srfObject != NULL) {
+               y0 -= my_ypos;
+               x -= my_xpos;
+       }
+ 
+       rect.SetRect(x, y0, 1, hl);
+       SDL_FillRect(surface, &rect, c);
  }
  

Index: pgwidgetdnd.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgwidgetdnd.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgwidgetlist.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgwidgetlist.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pgwidgetlist.cpp    15 Apr 2002 13:22:16 -0000      1.1.1.1
--- pgwidgetlist.cpp    15 Apr 2002 13:31:31 -0000      1.2
***************
*** 29,32 ****
--- 29,38 ----
  #include "pgwidgetlist.h"
  #include "pgapplication.h"
+ #include "pglog.h"
+ 
+ struct PG_WidgetListDataInternal{
+       int my_scrolldeltax;
+       int my_scrolldeltay;
+ };
  
  PG_WidgetList::PG_WidgetList(PG_Widget* parent, const PG_Rect& r, const char* 
style) : PG_ThemeWidget(parent, r, style) {
***************
*** 38,50 ****
        my_widthScrollbar = my_heightHorizontalScrollbar = 5;
  
!         // It is important to make sure that the substractions below won't
        // render values < 0 and, eventually,
        // surface widths such as 32768 or 65535 when cast to an unsigned type.
        // This can lead to segfaults later on in, for example, DrawGradient...
!         if (my_widthScrollbar > r.my_width)
!           my_widthScrollbar = r.my_width;
            
        if (my_heightHorizontalScrollbar > r.my_height)
!           my_heightHorizontalScrollbar = r.my_height;
  
        my_rectVerticalScrollbar.SetRect(
--- 44,60 ----
        my_widthScrollbar = my_heightHorizontalScrollbar = 5;
  
!       my_internaldata = new PG_WidgetListDataInternal;
!       my_internaldata->my_scrolldeltax = 0;
!       my_internaldata->my_scrolldeltay = 0;
! 
!       // It is important to make sure that the substractions below won't
        // render values < 0 and, eventually,
        // surface widths such as 32768 or 65535 when cast to an unsigned type.
        // This can lead to segfaults later on in, for example, DrawGradient...
!       if (my_widthScrollbar > r.my_width)
!               my_widthScrollbar = r.my_width;
            
        if (my_heightHorizontalScrollbar > r.my_height)
!               my_heightHorizontalScrollbar = r.my_height;
  
        my_rectVerticalScrollbar.SetRect(
***************
*** 83,87 ****
  PG_WidgetList::~PG_WidgetList() {
        DeleteAll();
!       //delete my_objScrollbar;
  }
  
--- 93,97 ----
  PG_WidgetList::~PG_WidgetList() {
        DeleteAll();
!       delete my_internaldata;
  }
  
***************
*** 155,159 ****
        }
  
!       return PG_ThemeWidget::eventScrollPos(id, widget, data);
  }
  
--- 165,169 ----
        }
  
!       return true; //PG_ThemeWidget::eventScrollPos(id, widget, data);
  }
  
***************
*** 169,173 ****
        }
  
!       return PG_ThemeWidget::eventScrollTrack(id, widget, data);
  }
  
--- 179,183 ----
        }
  
!       return true; // PG_ThemeWidget::eventScrollTrack(id, widget, data);
  }
  
***************
*** 217,220 ****
--- 227,234 ----
  
  void PG_WidgetList::DeleteAll() {
+       if(my_widgetList.size() == 0) {
+               return;
+       }
+       
        std::vector<PG_Widget*>::iterator list = my_widgetList.begin();
        PG_Widget* w = NULL;
***************
*** 241,245 ****
  
  Sint32 PG_WidgetList::ScrollToY(Sint32 position) {
-       static int delta = 0;
  
        PG_Rect r;
--- 255,258 ----
***************
*** 253,262 ****
                position = 0;
  
!       delta -= position;
  
        for(int i=0; i<my_widgetCount; i++) {
                r = *(my_widgetList[i]);
  
!               r.my_ypos += delta;
                if(r.my_ypos < -32000) {
                        r.my_ypos = -32000;
--- 266,275 ----
                position = 0;
  
!       my_internaldata->my_scrolldeltay -= position;
  
        for(int i=0; i<my_widgetCount; i++) {
                r = *(my_widgetList[i]);
  
!               r.my_ypos += my_internaldata->my_scrolldeltay;
                if(r.my_ypos < -32000) {
                        r.my_ypos = -32000;
***************
*** 269,278 ****
  
        Update();
!       delta = position;
        return position;
  }
  
  Sint32 PG_WidgetList::ScrollToX(Sint32 position) {
-       static int delta = 0;
  
        PG_Rect r;
--- 282,290 ----
  
        Update();
!       my_internaldata->my_scrolldeltay = position;
        return position;
  }
  
  Sint32 PG_WidgetList::ScrollToX(Sint32 position) {
  
        PG_Rect r;
***************
*** 286,295 ****
                position = 0;
  
!       delta -= position;
  
        for(int i=0; i<my_widgetCount; i++) {
                r = *(my_widgetList[i]);
  
!               r.my_xpos += delta;
                if(r.my_xpos < -32000) {
                        r.my_xpos = -32000;
--- 298,307 ----
                position = 0;
  
!       my_internaldata->my_scrolldeltax -= position;
  
        for(int i=0; i<my_widgetCount; i++) {
                r = *(my_widgetList[i]);
  
!               r.my_xpos += my_internaldata->my_scrolldeltax;
                if(r.my_xpos < -32000) {
                        r.my_xpos = -32000;
***************
*** 302,306 ****
  
        Update();
!       delta = position;
        return position;
  }
--- 314,318 ----
  
        Update();
!       my_internaldata->my_scrolldeltax = position;
        return position;
  }

Index: pgwidgetlistex.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgwidgetlistex.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2

Index: pgwindow.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgwindow.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pgwindow.cpp        15 Apr 2002 13:22:16 -0000      1.1.1.1
--- pgwindow.cpp        15 Apr 2002 13:31:31 -0000      1.2
***************
*** 94,98 ****
        my_labelTitle->SizeWidget(w, my_heightTitlebar);
  
!       my_buttonClose->MoveWidget(PG_Rect(my_width - my_heightTitlebar, 0, 
my_heightTitlebar, my_heightTitlebar));
        my_buttonMinimize->MoveWidget(PG_Rect(0, 0, my_heightTitlebar, 
my_heightTitlebar));
  
--- 94,98 ----
        my_labelTitle->SizeWidget(w, my_heightTitlebar);
  
!       my_buttonClose->MoveWidget(PG_Rect(w - my_heightTitlebar, 0, 
my_heightTitlebar, my_heightTitlebar));
        my_buttonMinimize->MoveWidget(PG_Rect(0, 0, my_heightTitlebar, 
my_heightTitlebar));
  




reply via email to

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