paragui-cvs
[Top][All Lists]
Advanced

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

[paragui-cvs] CVS: paragui/src/widgets pgdropdown.cpp,1.3,1.3.6.1 pglist


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/widgets pgdropdown.cpp,1.3,1.3.6.1 pglistboxbaseitem.cpp,1.3.6.4,1.3.6.5pgwidget.cpp,1.4.4.16,1.4.4.17
Date: Sun, 30 Mar 2003 11:31:00 -0500

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

Modified Files:
      Tag: devel-1-0
        pgdropdown.cpp pglistboxbaseitem.cpp pgwidget.cpp 
Log Message:
- converted wrong CR/LF to LF (UNIX style)
- applied patches from "H. C." <address@hidden>
  access functions for PG_Application::enableAppIdleCalls
  added functions to set the windowtitle of the log-console



Index: pgdropdown.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgdropdown.cpp,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -C2 -r1.3 -r1.3.6.1
*** pgdropdown.cpp      15 Apr 2002 13:35:36 -0000      1.3
--- pgdropdown.cpp      30 Mar 2003 16:30:57 -0000      1.3.6.1
***************
*** 1,164 ****
! /*
!     ParaGUI - crossplatform widgetset
!     Copyright (C) 2000,2001,2002  Alexander Pipelka
!  
!     This library is free software; you can redistribute it and/or
!     modify it under the terms of the GNU Library General Public
!     License as published by the Free Software Foundation; either
!     version 2 of the License, or (at your option) any later version.
!  
!     This library is distributed in the hope that it will be useful,
!     but WITHOUT ANY WARRANTY; without even the implied warranty of
!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
!     Library General Public License for more details.
!  
!     You should have received a copy of the GNU Library General Public
!     License along with this library; if not, write to the Free
!     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
!  
!     Alexander Pipelka
!     address@hidden
!  
!     Last Update:      $Author$
!     Update Date:      $Date$
!     Source File:      $Source$
!     CVS/RCS Revision: $Revision$
!     Status:           $State$
! */
! 
! #include <cmath>
! 
! #include "pgdropdown.h"
! #include "pglog.h"
! 
! PG_DropDown::PG_DropDown(PG_Widget* parent, int id, const PG_Rect& r, const 
char* style) : PG_Widget(parent, r) {
!       PG_Rect rect(0, 0, r.my_width - r.my_height, r.my_height);
! 
!       SetID(id);
! 
!       my_EditBox = new PG_LineEdit(this, rect, style);
! 
!       PG_Rect rbutton(abs(r.my_width - r.my_height), 0, r.my_height, 
r.my_height);
!       my_DropButton = new PG_Button(this, PG_IDDROPDOWN_BOX, rbutton, NULL, 
style);
! 
!       PG_Rect rlist(r.my_xpos, r.my_ypos + r.my_height +1, r.my_width, 
r.my_height * 5);
!       my_DropList = new PG_ListBox(NULL, rlist, style);
!       my_DropList->SetEventObject(MSG_SELECTITEM, this, 
(MSG_CALLBACK_OBJ)&PG_DropDown::select_handler);
! 
!       //LoadThemeStyle(style);
! }
! 
! PG_DropDown::~PG_DropDown() {
!       delete my_DropList;
! }
! 
! void PG_DropDown::LoadThemeStyle(const char* style) {
!       my_EditBox->LoadThemeStyle(style);
!       my_DropButton->LoadThemeStyle(style);
!       my_DropList->LoadThemeStyle(style);
! }
! 
! void PG_DropDown::AddItem(const char* text, void* userdata) {
!       Uint16 h;
! 
!       PG_FontEngine::GetTextSize(text, GetFont(), NULL, NULL, NULL, NULL, &h);
! 
!       PG_ListBoxItem* item = new PG_ListBoxItem(h+2, text, NULL, userdata);
!       my_DropList->AddItem(item);
! }
! 
! void PG_DropDown::RemoveAll() {
!       my_DropList->RemoveAll();
! }
! 
! void PG_DropDown::DeleteAll() {
!       my_DropList->DeleteAll();
! }
! 
! void PG_DropDown::eventShow() {
!       my_DropList->SetVisible(false);
! }
! 
! void PG_DropDown::eventHide() {
!       my_DropList->Hide();
! }
! 
! bool PG_DropDown::eventButtonClick (int id, PG_Widget* widget) {
!       if(id != PG_IDDROPDOWN_BOX) {
!               return false;
!       }
! 
!       if(my_DropList->IsVisible()) {
!               my_DropList->Hide();
!       } else {
!               my_DropList->MoveRect(my_xpos, my_ypos+my_height);
!               my_DropList->Show();
!               my_DropList->BringToFront();
!       }
! 
!       return true;
! }
! 
! void PG_DropDown::SetIndent(int indent) {
!       my_DropList->SetIndent(indent);
! }
! 
! void PG_DropDown::SetEditable(bool edit) {
!       my_EditBox->SetEditable(edit);
! }
! 
! bool PG_DropDown::GetEditable() {
!       return my_EditBox->GetEditable();
! }
! 
! const char* PG_DropDown::GetText() {
!       return my_EditBox->GetText();
! }
! 
! void PG_DropDown::SetText(const char* new_text) {
!       my_EditBox->SetText(new_text);
! }
! 
! bool PG_DropDown::eventSelectItem(PG_ListBoxBaseItem* item) {
!       return false;
! }
! 
! // TODO: Fill me with code :)
! void PG_DropDown::eventSizeWidget(Uint16 w, Uint16 h) {}
! 
! void PG_DropDown::eventMoveWidget(int x, int y) {
!       if(my_DropList->IsVisible()) {
!               my_DropList->Hide();
!       }
! }
! 
! PARAGUI_CALLBACK(PG_DropDown::select_handler) {
!       PG_ListBoxItem* item = (PG_ListBoxItem*)data;
! 
!       my_EditBox->SetText(item->GetText());
!       item->Select(false);
!       my_DropList->SelectItem(NULL);
!       my_DropList->Hide();
! 
!       if(GetParent()) {
!               GetParent()->RemoveChild(my_DropList);
!       }
! 
!       eventSelectItem(item);
!       SendMessage(NULL, MSG_SELECTITEM, GetID(), (unsigned long)item);
! 
!       return true;
! }
! 
! // 1. try to fix the problems when running PG_DropDown in a modal loop
! // still not working -- Alex
! bool PG_DropDown::ProcessEvent(const SDL_Event * event, bool bModal) {
! 
!       if(bModal && my_DropList->IsVisible()) {
!               if(my_DropList->ProcessEvent(event, true)) {
!                       return true;
!               }
!       }
! 
!       return PG_Widget::ProcessEvent(event, bModal);
! }
--- 1,164 ----
! /*
!     ParaGUI - crossplatform widgetset
!     Copyright (C) 2000,2001,2002  Alexander Pipelka
!  
!     This library is free software; you can redistribute it and/or
!     modify it under the terms of the GNU Library General Public
!     License as published by the Free Software Foundation; either
!     version 2 of the License, or (at your option) any later version.
!  
!     This library is distributed in the hope that it will be useful,
!     but WITHOUT ANY WARRANTY; without even the implied warranty of
!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
!     Library General Public License for more details.
!  
!     You should have received a copy of the GNU Library General Public
!     License along with this library; if not, write to the Free
!     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
!  
!     Alexander Pipelka
!     address@hidden
!  
!     Last Update:      $Author$
!     Update Date:      $Date$
!     Source File:      $Source$
!     CVS/RCS Revision: $Revision$
!     Status:           $State$
! */
! 
! #include <cmath>
! 
! #include "pgdropdown.h"
! #include "pglog.h"
! 
! PG_DropDown::PG_DropDown(PG_Widget* parent, int id, const PG_Rect& r, const 
char* style) : PG_Widget(parent, r) {
!       PG_Rect rect(0, 0, r.my_width - r.my_height, r.my_height);
! 
!       SetID(id);
! 
!       my_EditBox = new PG_LineEdit(this, rect, style);
! 
!       PG_Rect rbutton(abs(r.my_width - r.my_height), 0, r.my_height, 
r.my_height);
!       my_DropButton = new PG_Button(this, PG_IDDROPDOWN_BOX, rbutton, NULL, 
style);
! 
!       PG_Rect rlist(r.my_xpos, r.my_ypos + r.my_height +1, r.my_width, 
r.my_height * 5);
!       my_DropList = new PG_ListBox(NULL, rlist, style);
!       my_DropList->SetEventObject(MSG_SELECTITEM, this, 
(MSG_CALLBACK_OBJ)&PG_DropDown::select_handler);
! 
!       //LoadThemeStyle(style);
! }
! 
! PG_DropDown::~PG_DropDown() {
!       delete my_DropList;
! }
! 
! void PG_DropDown::LoadThemeStyle(const char* style) {
!       my_EditBox->LoadThemeStyle(style);
!       my_DropButton->LoadThemeStyle(style);
!       my_DropList->LoadThemeStyle(style);
! }
! 
! void PG_DropDown::AddItem(const char* text, void* userdata) {
!       Uint16 h;
! 
!       PG_FontEngine::GetTextSize(text, GetFont(), NULL, NULL, NULL, NULL, &h);
! 
!       PG_ListBoxItem* item = new PG_ListBoxItem(h+2, text, NULL, userdata);
!       my_DropList->AddItem(item);
! }
! 
! void PG_DropDown::RemoveAll() {
!       my_DropList->RemoveAll();
! }
! 
! void PG_DropDown::DeleteAll() {
!       my_DropList->DeleteAll();
! }
! 
! void PG_DropDown::eventShow() {
!       my_DropList->SetVisible(false);
! }
! 
! void PG_DropDown::eventHide() {
!       my_DropList->Hide();
! }
! 
! bool PG_DropDown::eventButtonClick (int id, PG_Widget* widget) {
!       if(id != PG_IDDROPDOWN_BOX) {
!               return false;
!       }
! 
!       if(my_DropList->IsVisible()) {
!               my_DropList->Hide();
!       } else {
!               my_DropList->MoveRect(my_xpos, my_ypos+my_height);
!               my_DropList->Show();
!               my_DropList->BringToFront();
!       }
! 
!       return true;
! }
! 
! void PG_DropDown::SetIndent(int indent) {
!       my_DropList->SetIndent(indent);
! }
! 
! void PG_DropDown::SetEditable(bool edit) {
!       my_EditBox->SetEditable(edit);
! }
! 
! bool PG_DropDown::GetEditable() {
!       return my_EditBox->GetEditable();
! }
! 
! const char* PG_DropDown::GetText() {
!       return my_EditBox->GetText();
! }
! 
! void PG_DropDown::SetText(const char* new_text) {
!       my_EditBox->SetText(new_text);
! }
! 
! bool PG_DropDown::eventSelectItem(PG_ListBoxBaseItem* item) {
!       return false;
! }
! 
! // TODO: Fill me with code :)
! void PG_DropDown::eventSizeWidget(Uint16 w, Uint16 h) {}
! 
! void PG_DropDown::eventMoveWidget(int x, int y) {
!       if(my_DropList->IsVisible()) {
!               my_DropList->Hide();
!       }
! }
! 
! PARAGUI_CALLBACK(PG_DropDown::select_handler) {
!       PG_ListBoxItem* item = (PG_ListBoxItem*)data;
! 
!       my_EditBox->SetText(item->GetText());
!       item->Select(false);
!       my_DropList->SelectItem(NULL);
!       my_DropList->Hide();
! 
!       if(GetParent()) {
!               GetParent()->RemoveChild(my_DropList);
!       }
! 
!       eventSelectItem(item);
!       SendMessage(NULL, MSG_SELECTITEM, GetID(), (unsigned long)item);
! 
!       return true;
! }
! 
! // 1. try to fix the problems when running PG_DropDown in a modal loop
! // still not working -- Alex
! bool PG_DropDown::ProcessEvent(const SDL_Event * event, bool bModal) {
! 
!       if(bModal && my_DropList->IsVisible()) {
!               if(my_DropList->ProcessEvent(event, true)) {
!                       return true;
!               }
!       }
! 
!       return PG_Widget::ProcessEvent(event, bModal);
! }

Index: pglistboxbaseitem.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pglistboxbaseitem.cpp,v
retrieving revision 1.3.6.4
retrieving revision 1.3.6.5
diff -C2 -r1.3.6.4 -r1.3.6.5
*** pglistboxbaseitem.cpp       21 Mar 2003 20:04:58 -0000      1.3.6.4
--- pglistboxbaseitem.cpp       30 Mar 2003 16:30:57 -0000      1.3.6.5
***************
*** 1,115 ****
! /*
!     ParaGUI - crossplatform widgetset
!     Copyright (C) 2000,2001,2002  Alexander Pipelka
!  
!     This library is free software; you can redistribute it and/or
!     modify it under the terms of the GNU Library General Public
!     License as published by the Free Software Foundation; either
!     version 2 of the License, or (at your option) any later version.
!  
!     This library is distributed in the hope that it will be useful,
!     but WITHOUT ANY WARRANTY; without even the implied warranty of
!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
!     Library General Public License for more details.
!  
!     You should have received a copy of the GNU Library General Public
!     License along with this library; if not, write to the Free
!     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
!  
!     Alexander Pipelka
!     address@hidden
!  
!     Last Update:      $Author$
!     Update Date:      $Date$
!     Source File:      $Source$
!     CVS/RCS Revision: $Revision$
!     Status:           $State$
! */
! 
! #include "pglistboxbaseitem.h"
! #include "pglistbox.h"
! #include "pglog.h"
! 
! PG_ListBoxBaseItem::PG_ListBoxBaseItem(int height, void* userdata) : 
PG_Label(NULL, PG_Rect(0,0,100,20), NULL) {
!       my_userdata = userdata;
!       my_selected = false;
!       my_hover = false;
!       my_itemheight = height;
! 
!       SetAlignment(PG_TA_LEFT);
! }
! 
! PG_ListBoxBaseItem::~PG_ListBoxBaseItem() {
!       if(GetParent()->GetSelectedItem() == this) {
!               GetParent()->SelectItem(NULL);
!               GetParent()->RemoveWidget(this, true, true);
!       }
! }
! 
! void PG_ListBoxBaseItem::SetUserData(void* userdata) {
!       my_userdata = userdata;
! }
! 
! void* PG_ListBoxBaseItem::GetUserData() {
!       return my_userdata;
! }
! 
! bool PG_ListBoxBaseItem::IsSelected() {
!       return my_selected;
! }
! 
! void PG_ListBoxBaseItem::Select(bool select) {
!       my_selected = select;
! 
!       if(GetParent() != NULL) {
!               if(select) {
!                       GetParent()->SelectItem(this);
!               }
!       }
! }
! 
! int PG_ListBoxBaseItem::Height() {
!       return my_itemheight;
! }
! 
! void PG_ListBoxBaseItem::eventSizeWidget(Uint16 w, Uint16 h) {
!       my_itemheight = h;
! }
! 
! void PG_ListBoxBaseItem::eventMouseEnter() {
!       my_hover = true;
!       Update();
! }
! 
! void PG_ListBoxBaseItem::eventMouseLeave() {
!       my_hover = false;
!       PG_Label::eventMouseLeave();
!       Update();
! }
! 
! void PG_ListBoxBaseItem::eventHide() {
!       my_hover = false;
! }
! 
! bool PG_ListBoxBaseItem::eventMouseButtonUp(const SDL_MouseButtonEvent* 
button) {
! 
!       if(button->button != 1) {
!               return false;
!       }
! 
!       if(GetParent() == NULL) {
!               return true;
!       }
! 
!       if(GetParent()->GetMultiSelect()) {
!               Select(!IsSelected());
!       } else {
!               Select(true);
!       }
! 
!       return true;
! }
! 
! PG_ListBox* PG_ListBoxBaseItem::GetParent() {
!       return (PG_ListBox*)(PG_Label::GetParent());
! }
--- 1,115 ----
! /*
!     ParaGUI - crossplatform widgetset
!     Copyright (C) 2000,2001,2002  Alexander Pipelka
!  
!     This library is free software; you can redistribute it and/or
!     modify it under the terms of the GNU Library General Public
!     License as published by the Free Software Foundation; either
!     version 2 of the License, or (at your option) any later version.
!  
!     This library is distributed in the hope that it will be useful,
!     but WITHOUT ANY WARRANTY; without even the implied warranty of
!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
!     Library General Public License for more details.
!  
!     You should have received a copy of the GNU Library General Public
!     License along with this library; if not, write to the Free
!     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
!  
!     Alexander Pipelka
!     address@hidden
!  
!     Last Update:      $Author$
!     Update Date:      $Date$
!     Source File:      $Source$
!     CVS/RCS Revision: $Revision$
!     Status:           $State$
! */
! 
! #include "pglistboxbaseitem.h"
! #include "pglistbox.h"
! #include "pglog.h"
! 
! PG_ListBoxBaseItem::PG_ListBoxBaseItem(int height, void* userdata) : 
PG_Label(NULL, PG_Rect(0,0,100,20), NULL) {
!       my_userdata = userdata;
!       my_selected = false;
!       my_hover = false;
!       my_itemheight = height;
! 
!       SetAlignment(PG_TA_LEFT);
! }
! 
! PG_ListBoxBaseItem::~PG_ListBoxBaseItem() {
!       if(GetParent()->GetSelectedItem() == this) {
!               GetParent()->SelectItem(NULL);
!               GetParent()->RemoveWidget(this, true, true);
!       }
! }
! 
! void PG_ListBoxBaseItem::SetUserData(void* userdata) {
!       my_userdata = userdata;
! }
! 
! void* PG_ListBoxBaseItem::GetUserData() {
!       return my_userdata;
! }
! 
! bool PG_ListBoxBaseItem::IsSelected() {
!       return my_selected;
! }
! 
! void PG_ListBoxBaseItem::Select(bool select) {
!       my_selected = select;
! 
!       if(GetParent() != NULL) {
!               if(select) {
!                       GetParent()->SelectItem(this);
!               }
!       }
! }
! 
! int PG_ListBoxBaseItem::Height() {
!       return my_itemheight;
! }
! 
! void PG_ListBoxBaseItem::eventSizeWidget(Uint16 w, Uint16 h) {
!       my_itemheight = h;
! }
! 
! void PG_ListBoxBaseItem::eventMouseEnter() {
!       my_hover = true;
!       Update();
! }
! 
! void PG_ListBoxBaseItem::eventMouseLeave() {
!       my_hover = false;
!       PG_Label::eventMouseLeave();
!       Update();
! }
! 
! void PG_ListBoxBaseItem::eventHide() {
!       my_hover = false;
! }
! 
! bool PG_ListBoxBaseItem::eventMouseButtonUp(const SDL_MouseButtonEvent* 
button) {
! 
!       if(button->button != 1) {
!               return false;
!       }
! 
!       if(GetParent() == NULL) {
!               return true;
!       }
! 
!       if(GetParent()->GetMultiSelect()) {
!               Select(!IsSelected());
!       } else {
!               Select(true);
!       }
! 
!       return true;
! }
! 
! PG_ListBox* PG_ListBoxBaseItem::GetParent() {
!       return (PG_ListBox*)(PG_Label::GetParent());
! }

Index: pgwidget.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/widgets/pgwidget.cpp,v
retrieving revision 1.4.4.16
retrieving revision 1.4.4.17
diff -C2 -r1.4.4.16 -r1.4.4.17
*** pgwidget.cpp        28 Mar 2003 19:59:42 -0000      1.4.4.16
--- pgwidget.cpp        30 Mar 2003 16:30:57 -0000      1.4.4.17
***************
*** 1498,1501 ****
--- 1498,1506 ----
  }
  
+ bool PG_Widget::WillQuitModal()
+ {
+       return my_internaldata->quitModalLoop;
+ }
+ 
  int PG_Widget::RunModal() {
        SDL_Event event;





reply via email to

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