From aa61d3525370a9b9fa8c797d9b7f89d96994db5f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 23 Mar 2006 22:05:23 +0000 Subject: [PATCH] replaced all int/size_t indices in wxControlWithItems API with unsigned int (committing on behalf of ABX) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 10 +-- docs/latex/wx/checklst.tex | 15 ++++- docs/latex/wx/choice.tex | 25 ++++--- docs/latex/wx/ctrlsub.tex | 22 +++---- docs/latex/wx/radiobox.tex | 22 +++++-- docs/latex/wx/treectrl.tex | 6 +- include/wx/checklst.h | 4 +- include/wx/cocoa/checklst.h | 8 +-- include/wx/cocoa/choice.h | 20 +++--- include/wx/cocoa/combobox.h | 20 +++--- include/wx/cocoa/listbox.h | 18 ++--- include/wx/cocoa/radiobox.h | 10 +-- include/wx/ctrlsub.h | 51 +++++++-------- include/wx/gtk/checklst.h | 8 +-- include/wx/gtk/choice.h | 22 +++---- include/wx/gtk/combobox.h | 20 +++--- include/wx/gtk/listbox.h | 20 +++--- include/wx/gtk/radiobox.h | 14 ++-- include/wx/gtk1/checklst.h | 4 +- include/wx/gtk1/choice.h | 22 +++---- include/wx/gtk1/combobox.h | 20 +++--- include/wx/gtk1/listbox.h | 18 ++--- include/wx/gtk1/radiobox.h | 14 ++-- include/wx/listbox.h | 14 ++-- include/wx/mac/carbon/checklst.h | 14 ++-- include/wx/mac/carbon/choice.h | 18 ++--- include/wx/mac/carbon/combobox.h | 18 ++--- include/wx/mac/carbon/listbox.h | 20 +++--- include/wx/mac/carbon/radiobox.h | 12 ++-- include/wx/mac/classic/checklst.h | 14 ++-- include/wx/mac/classic/choice.h | 18 ++--- include/wx/mac/classic/combobox.h | 18 ++--- include/wx/mac/classic/listbox.h | 20 +++--- include/wx/mac/classic/radiobox.h | 12 ++-- include/wx/motif/checklst.h | 10 +-- include/wx/motif/choice.h | 20 +++--- include/wx/motif/combobox.h | 8 +-- include/wx/motif/listbox.h | 20 +++--- include/wx/motif/radiobox.h | 14 ++-- include/wx/msw/checklst.h | 8 +-- include/wx/msw/choice.h | 18 ++--- include/wx/msw/listbox.h | 20 +++--- include/wx/msw/radiobox.h | 14 ++-- include/wx/msw/wince/checklst.h | 22 +++---- include/wx/msw/wince/choicece.h | 18 ++--- include/wx/os2/checklst.h | 12 ++-- include/wx/os2/choice.h | 26 +++----- include/wx/os2/listbox.h | 26 ++++---- include/wx/os2/radiobox.h | 20 +++--- include/wx/palmos/checklst.h | 8 +-- include/wx/palmos/choice.h | 18 ++--- include/wx/palmos/listbox.h | 18 ++--- include/wx/palmos/radiobox.h | 10 +-- include/wx/radiobox.h | 22 +++---- include/wx/univ/checklst.h | 9 ++- include/wx/univ/combobox.h | 18 ++--- include/wx/univ/listbox.h | 20 +++--- include/wx/univ/radiobox.h | 15 +++-- samples/widgets/combobox.cpp | 12 ++-- src/cocoa/checklst.mm | 10 +-- src/cocoa/choice.mm | 26 ++++---- src/cocoa/combobox.mm | 26 ++++---- src/cocoa/listbox.mm | 22 +++---- src/cocoa/radiobox.mm | 10 +-- src/common/ctrlsub.cpp | 26 ++++---- src/common/lboxcmn.cpp | 6 +- src/common/radiocmn.cpp | 2 +- src/gtk/checklst.cpp | 10 +-- src/gtk/choice.cpp | 54 +++++++-------- src/gtk/combobox.cpp | 46 +++++++------ src/gtk/listbox.cpp | 52 +++++++-------- src/gtk/radiobox.cpp | 20 +++--- src/gtk1/checklst.cpp | 4 +- src/gtk1/choice.cpp | 54 +++++++-------- src/gtk1/combobox.cpp | 32 ++++----- src/gtk1/listbox.cpp | 32 ++++----- src/gtk1/radiobox.cpp | 20 +++--- src/mac/carbon/checklst.cpp | 26 ++++---- src/mac/carbon/choice.cpp | 38 +++++------ src/mac/carbon/combobox.cpp | 32 ++++----- src/mac/carbon/combobxc.cpp | 36 +++++----- src/mac/carbon/listbox.cpp | 56 ++++++++-------- src/mac/carbon/radiobox.cpp | 52 ++++++--------- src/mac/classic/checklst.cpp | 16 ++--- src/mac/classic/choice.cpp | 32 ++++----- src/mac/classic/combobox.cpp | 35 +++++----- src/mac/classic/listbox.cpp | 80 +++++++++++------------ src/mac/classic/radiobox.cpp | 61 ++++++++--------- src/motif/checklst.cpp | 18 +++-- src/motif/choice.cpp | 36 +++++----- src/motif/combobox.cpp | 10 +-- src/motif/combobox_native.cpp | 12 ++-- src/motif/listbox.cpp | 36 +++++----- src/motif/radiobox.cpp | 30 ++++----- src/msw/checklst.cpp | 105 +++++++++++++++--------------- src/msw/choice.cpp | 42 ++++++------ src/msw/listbox.cpp | 70 ++++++++++---------- src/msw/radiobox.cpp | 34 +++++----- src/msw/wince/checklst.cpp | 34 +++++----- src/msw/wince/choicece.cpp | 24 +++---- src/os2/checklst.cpp | 25 ++++--- src/os2/choice.cpp | 60 +++++++---------- src/os2/listbox.cpp | 77 ++++++++++------------ src/os2/radiobox.cpp | 52 +++++++-------- src/palmos/checklst.cpp | 11 ++-- src/palmos/choice.cpp | 22 +++---- src/palmos/listbox.cpp | 22 +++---- src/palmos/radiobox.cpp | 32 ++++----- src/univ/checklst.cpp | 22 +++---- src/univ/combobox.cpp | 22 +++---- src/univ/listbox.cpp | 62 +++++++++--------- src/univ/radiobox.cpp | 36 +++++----- 112 files changed, 1370 insertions(+), 1417 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d7d6427cde..d8fcd463b4 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -45,11 +45,11 @@ All: - Added support for wxLongLong in wx stream classes (Mark Junker). - wxSOCKET_REUSEADDR can be used with wxSocketClient. - Overloaded Connect() and SetLocal() methods for binding to local address/port. -- All GetCount() methods now return size_t and not int. -- Albanian translation added (Besnik Bleta). -- Assert messages now show the function in which assert failed. -- wxApp::OnAssertFailure() should now be used instead the old wxApp::OnAssert(). -- Fixed several bugs in wxDateTime::ParseDate(). +- All GetCount() methods now return unsigned int and not int +- Albanian translation added (Besnik Bleta) +- Assert messages now show the function in which assert failed +- wxApp::OnAssertFailure() should now be used instead the old wxApp::OnAssert() +- Fixed several bugs in wxDateTime::ParseDate() All (GUI): diff --git a/docs/latex/wx/checklst.tex b/docs/latex/wx/checklst.tex index 4fceff32ec..8098222dc6 100644 --- a/docs/latex/wx/checklst.tex +++ b/docs/latex/wx/checklst.tex @@ -1,3 +1,14 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: checklst.tex +%% Purpose: wxCheckListBox documentation +%% Author: wxWidgets Team +%% Modified by: +%% Created: +%% RCS-ID: $Id$ +%% Copyright: (c) wxWidgets Team +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section{\class{wxCheckListBox}}\label{wxchecklistbox} A checklistbox is like a listbox, but allows items to be checked or unchecked. @@ -107,12 +118,10 @@ wxEVT\_COMMAND\_CHECKLISTBOX\_TOGGLE being emitted. \membersection{wxCheckListBox::IsChecked}\label{wxchecklistboxischecked} -\constfunc{bool}{IsChecked}{\param{int}{ item}} +\constfunc{bool}{IsChecked}{\param{unsigned int}{ item}} Returns true if the given item is checked, false otherwise. \wxheading{Parameters} \docparam{item}{Index of item whose check status is to be returned.} - - diff --git a/docs/latex/wx/choice.tex b/docs/latex/wx/choice.tex index f810c735a0..43ec4d0ae6 100644 --- a/docs/latex/wx/choice.tex +++ b/docs/latex/wx/choice.tex @@ -1,3 +1,14 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: treectrl.tex +%% Purpose: wxChoice documentation +%% Author: wxWidgets Team +%% Modified by: +%% Created: +%% RCS-ID: $Id$ +%% Copyright: (c) wxWidgets Team +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section{\class{wxChoice}}\label{wxchoice} A choice item is used to select one of a list of strings. Unlike a @@ -113,17 +124,6 @@ Destructor, destroying the choice item. Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoicector}. -\membersection{wxChoice::Delete}\label{wxchoicedelete} - -\func{void}{Delete}{\param{int }{n}} - -Deletes the item with the given index from the control. - -\wxheading{Parameters} - -\docparam{n}{The item to delete.} - - \membersection{wxChoice::GetColumns}\label{wxchoicegetcolumns} \constfunc{int}{GetColumns}{\void} @@ -147,7 +147,7 @@ That is, while the dropdown list is shown, it returns the currently selected item in it. When it is not shown, its result is the same as for the other function. -\newsince{2.6.2} (before this version +\newsince{2.6.2} (before this version \helpref{GetSelection}{wxcontrolwithitemsgetselection} itself behaved like this). @@ -166,4 +166,3 @@ Sets the number of columns in this choice item. This is implemented for Motif only and doesn't do anything under other platforms. - diff --git a/docs/latex/wx/ctrlsub.tex b/docs/latex/wx/ctrlsub.tex index 032f4b9af4..517e3f5830 100644 --- a/docs/latex/wx/ctrlsub.tex +++ b/docs/latex/wx/ctrlsub.tex @@ -88,7 +88,7 @@ by the control. \membersection{wxControlWithItems::Delete}\label{wxcontrolwithitemsdelete} -\func{void}{Delete}{\param{int}{ n}} +\func{void}{Delete}{\param{unsigned int}{ n}} Deletes an item from the control. The client data associated with the item will be also deleted if it is owned by the control. @@ -125,7 +125,7 @@ not found. \membersection{wxControlWithItems::GetClientData}\label{wxcontrolwithitemsgetclientdata} -\constfunc{void *}{GetClientData}{\param{int}{ n}} +\constfunc{void *}{GetClientData}{\param{unsigned int}{ n}} Returns a pointer to the client data associated with the given item (if any). It is an error to call this function for a control which doesn't have untyped @@ -143,7 +143,7 @@ A pointer to the client data, or {\tt NULL} if not present. \membersection{wxControlWithItems::GetClientObject}\label{wxcontrolwithitemsgetclientobject} -\constfunc{wxClientData *}{GetClientObject}{\param{int}{ n}} +\constfunc{wxClientData *}{GetClientObject}{\param{unsigned int}{ n}} Returns a pointer to the client data associated with the given item (if any). It is an error to call this function for a control which doesn't have typed @@ -161,7 +161,7 @@ A pointer to the client data, or {\tt NULL} if not present. \membersection{wxControlWithItems::GetCount}\label{wxcontrolwithitemsgetcount} -\constfunc{size\_t}{GetCount}{\void} +\constfunc{unsigned int}{GetCount}{\void} Returns the number of items in the control. @@ -195,7 +195,7 @@ with {\tt wxLB\_MULTIPLE} style. \membersection{wxControlWithItems::GetString}\label{wxcontrolwithitemsgetstring} -\constfunc{wxString}{GetString}{\param{int}{ n}} +\constfunc{wxString}{GetString}{\param{unsigned int}{ n}} Returns the label of the item with the given index. @@ -222,14 +222,14 @@ selected. \membersection{wxControlWithItems::Insert}\label{wxcontrolwithitemsinsert} -\func{int}{Insert}{\param{const wxString\& }{ item}, \param{int }{pos}} +\func{int}{Insert}{\param{const wxString\& }{ item}, \param{unsigned int }{pos}} Inserts the item into the list before pos. Not valid for {\tt wxLB\_SORT} or {\tt wxCB\_SORT} styles, use Append instead. -\func{int}{Insert}{\param{const wxString\& }{ item}, \param{int }{pos}, \param{void *}{clientData}} +\func{int}{Insert}{\param{const wxString\& }{ item}, \param{unsigned int }{pos}, \param{void *}{clientData}} -\func{int}{Insert}{\param{const wxString\& }{ item}, \param{int }{pos}, \param{wxClientData *}{clientData}} +\func{int}{Insert}{\param{const wxString\& }{ item}, \param{unsigned int }{pos}, \param{wxClientData *}{clientData}} Inserts the item into the list before pos, associating the given, typed or untyped, client data pointer with the item. @@ -282,7 +282,7 @@ multiple selection. \membersection{wxControlWithItems::SetClientData}\label{wxcontrolwithitemssetclientdata} -\func{void}{SetClientData}{\param{int}{ n}, \param{void *}{data}} +\func{void}{SetClientData}{\param{unsigned int}{ n}, \param{void *}{data}} Associates the given untyped client data pointer with the given item. Note that it is an error to call this function if any typed client data pointers had been @@ -297,7 +297,7 @@ associated with the control items before. \membersection{wxControlWithItems::SetClientObject}\label{wxcontrolwithitemssetclientobject} -\func{void}{SetClientObject}{\param{int}{ n}, \param{wxClientData *}{data}} +\func{void}{SetClientObject}{\param{unsigned int}{ n}, \param{wxClientData *}{data}} Associates the given typed client data pointer with the given item: the {\it data} object will be deleted when the item is deleted (either explicitly @@ -336,7 +336,7 @@ deselect any other items in the controls which support multiple selections. \membersection{wxControlWithItems::SetString}\label{wxcontrolwithitemssetstring} -\func{void}{SetString}{\param{int}{ n}, \param{const wxString\& }{ string}} +\func{void}{SetString}{\param{unsigned int}{ n}, \param{const wxString\& }{ string}} Sets the label for the given item. diff --git a/docs/latex/wx/radiobox.tex b/docs/latex/wx/radiobox.tex index 12e7d28587..6dd954b8a3 100644 --- a/docs/latex/wx/radiobox.tex +++ b/docs/latex/wx/radiobox.tex @@ -149,7 +149,7 @@ for further details. Enables or disables the entire radiobox. -\func{virtual bool}{Enable}{\param{int}{ n}, \param{bool}{ enable = {\tt true}}} +\func{virtual bool}{Enable}{\param{unsigned int}{ n}, \param{bool}{ enable = {\tt true}}} Enables or disables an individual button in the radiobox. @@ -188,7 +188,7 @@ Finds a button matching the given string, returning the position if found, or \membersection{wxRadioBox::GetColumnCount}\label{wxradioboxgetcolumncount} -\constfunc{int}{GetColumnCount}{\void} +\constfunc{unsigned int}{GetColumnCount}{\void} Returns the number of columns in the radiobox. @@ -218,7 +218,7 @@ implements the following methods:\par \membersection{wxRadioBox::GetRowCount}\label{wxradioboxgetrowcount} -\constfunc{int}{GetRowCount}{\void} +\constfunc{unsigned int}{GetRowCount}{\void} Returns the number of rows in the radiobox. @@ -239,7 +239,7 @@ Returns the selected string. \membersection{wxRadioBox::GetString}\label{wxradioboxgetstring} -\constfunc{wxString}{GetString}{\param{int}{ n}} +\constfunc{wxString}{GetString}{\param{unsigned int}{ n}} Returns the label for the button at the given position. @@ -250,7 +250,7 @@ Returns the label for the button at the given position. \membersection{wxRadioBox::IsItemEnabled}\label{wxradioboxisitemenabled} -\constfunc{bool}{IsItemEnabled}{\void} +\constfunc{bool}{IsItemEnabled}{\param{unsigned int}{ n}} Returns \true if the item is enabled or \false if it was disabled using \helpref{Enable(n, false)}{wxradioboxenable}. @@ -258,10 +258,14 @@ Returns \true if the item is enabled or \false if it was disabled using {\bf Platform note:} Currently only implemented in wxMSW, wxGTK and wxUniversal and always returns \true in the other ports. +\wxheading{Parameters} + +\docparam{n}{The zero-based button position.} + \membersection{wxRadioBox::IsItemShown}\label{wxradioboxisitemshown} -\constfunc{bool}{IsItemShown}{\void} +\constfunc{bool}{IsItemShown}{\param{unsigned int}{ n}} Returns \true if the item is currently shown or \false if it was hidden using \helpref{Show(n, false)}{wxradioboxshow}. @@ -272,6 +276,10 @@ if the entire radiobox is not currently shown. {\bf Platform note:} Currently only implemented in wxMSW, wxGTK and wxUniversal and always returns \true in the other ports. +\wxheading{Parameters} + +\docparam{n}{The zero-based button position.} + \membersection{wxRadioBox::SetLabel}\label{wxradioboxsetlabel} @@ -325,7 +333,7 @@ a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted. Shows or hides the entire radiobox. -\func{virtual bool}{Show}{\param{int}{ item}, \param{const bool}{ show = {\tt true}}} +\func{virtual bool}{Show}{\param{unsigned int}{ item}, \param{const bool}{ show = {\tt true}}} Shows or hides individual buttons. diff --git a/docs/latex/wx/treectrl.tex b/docs/latex/wx/treectrl.tex index 8147946ad9..0351701970 100644 --- a/docs/latex/wx/treectrl.tex +++ b/docs/latex/wx/treectrl.tex @@ -362,7 +362,7 @@ This function is only available in the generic version. \membersection{wxTreeCtrl::GetChildrenCount}\label{wxtreectrlgetchildrencount} -\constfunc{size\_t}{GetChildrenCount}{\param{const wxTreeItemId\&}{ item}, \param{bool}{ recursively = {\tt true}}} +\constfunc{unsigned int}{GetChildrenCount}{\param{const wxTreeItemId\&}{ item}, \param{bool}{ recursively = {\tt true}}} Returns the number of items in the branch. If {\it recursively} is {\tt true}, returns the total number of descendants, otherwise only one level of children is counted. @@ -370,7 +370,7 @@ of descendants, otherwise only one level of children is counted. \membersection{wxTreeCtrl::GetCount}\label{wxtreectrlgetcount} -\constfunc{size\_t}{GetCount}{\void} +\constfunc{unsigned int}{GetCount}{\void} Returns the number of items in the control. @@ -631,7 +631,7 @@ this style. \membersection{wxTreeCtrl::GetSelections}\label{wxtreectrlgetselections} -\constfunc{size\_t}{GetSelections}{\param{wxArrayTreeItemIds\& }{selection}} +\constfunc{unsigned int}{GetSelections}{\param{wxArrayTreeItemIds\& }{selection}} Fills the array of tree items passed in with the currently selected items. This function can be called only if the control has the wxTR\_MULTIPLE style. diff --git a/include/wx/checklst.h b/include/wx/checklst.h index f976b0c1f4..d30003320e 100644 --- a/include/wx/checklst.h +++ b/include/wx/checklst.h @@ -32,8 +32,8 @@ public: wxCheckListBoxBase() { } // check list box specific methods - virtual bool IsChecked(size_t item) const = 0; - virtual void Check(size_t item, bool check = true) = 0; + virtual bool IsChecked(unsigned int item) const = 0; + virtual void Check(unsigned int item, bool check = true) = 0; DECLARE_NO_COPY_CLASS(wxCheckListBoxBase) }; diff --git a/include/wx/cocoa/checklst.h b/include/wx/cocoa/checklst.h index 0e6507d163..1f00752868 100644 --- a/include/wx/cocoa/checklst.h +++ b/include/wx/cocoa/checklst.h @@ -4,9 +4,9 @@ // Author: David Elliott // Modified by: // Created: 2003/03/16 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WX_COCOA_CHECKLST_H__ @@ -73,8 +73,8 @@ protected: // ------------------------------------------------------------------------ public: // check list box specific methods - virtual bool IsChecked(size_t item) const; - virtual void Check(size_t item, bool check = TRUE); + virtual bool IsChecked(unsigned int item) const; + virtual void Check(unsigned int item, bool check = true); }; #endif // __WX_COCOA_CHECKLST_H__ diff --git a/include/wx/cocoa/choice.h b/include/wx/cocoa/choice.h index a6c53ef892..ae177c71da 100644 --- a/include/wx/cocoa/choice.h +++ b/include/wx/cocoa/choice.h @@ -81,19 +81,19 @@ protected: // ------------------------------------------------------------------------ public: virtual void Clear(); - virtual void Delete(int); - virtual size_t GetCount() const; - virtual wxString GetString(int) const; - virtual void SetString(int, const wxString&); + virtual void Delete(unsigned int n); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int) const; + virtual void SetString(unsigned int pos, const wxString&); virtual int FindString(const wxString& s, bool bCase = false) const; virtual int GetSelection() const; virtual int DoAppend(const wxString&); - virtual int DoInsert(const wxString&, int); - virtual void DoSetItemClientData(int, void*); - virtual void* DoGetItemClientData(int) const; - virtual void DoSetItemClientObject(int, wxClientData*); - virtual wxClientData* DoGetItemClientObject(int) const; - virtual void SetSelection(int); + virtual int DoInsert(const wxString&, unsigned int pos); + virtual void DoSetItemClientData(unsigned int, void*); + virtual void* DoGetItemClientData(unsigned int) const; + virtual void DoSetItemClientObject(unsigned int, wxClientData*); + virtual wxClientData* DoGetItemClientObject(unsigned int) const; + virtual void SetSelection(int pos); protected: wxSortedArrayString *m_sortedStrings; wxArrayPtrVoid m_itemsClientData; diff --git a/include/wx/cocoa/combobox.h b/include/wx/cocoa/combobox.h index cc1dc9ab6f..cc262de82d 100644 --- a/include/wx/cocoa/combobox.h +++ b/include/wx/cocoa/combobox.h @@ -102,23 +102,23 @@ protected: // ------------------------------------------------------------------------ public: // wxCombobox methods - virtual void SetSelection(int); + virtual void SetSelection(int pos); // Overlapping methods virtual wxString GetStringSelection(); // wxItemContainer virtual void Clear(); - virtual void Delete(int); - virtual size_t GetCount() const; - virtual wxString GetString(int) const; - virtual void SetString(int, const wxString&); + virtual void Delete(unsigned int n); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int) const; + virtual void SetString(unsigned int pos, const wxString&); virtual int FindString(const wxString& s, bool bCase = false) const; virtual int GetSelection() const; virtual int DoAppend(const wxString&); - virtual int DoInsert(const wxString&, int); - virtual void DoSetItemClientData(int, void*); - virtual void* DoGetItemClientData(int) const; - virtual void DoSetItemClientObject(int, wxClientData*); - virtual wxClientData* DoGetItemClientObject(int) const; + virtual int DoInsert(const wxString&, unsigned int pos); + virtual void DoSetItemClientData(unsigned int, void*); + virtual void* DoGetItemClientData(unsigned int) const; + virtual void DoSetItemClientObject(unsigned int, wxClientData*); + virtual wxClientData* DoGetItemClientObject(unsigned int) const; // wxComboBoxBase pure virtuals virtual wxString GetValue() const { return wxTextCtrl::GetValue(); } diff --git a/include/wx/cocoa/listbox.h b/include/wx/cocoa/listbox.h index d5cf9502f4..0002435bbc 100644 --- a/include/wx/cocoa/listbox.h +++ b/include/wx/cocoa/listbox.h @@ -84,7 +84,7 @@ public: virtual bool IsSelected(int n) const; virtual int GetSelections(wxArrayInt& aSelections) const; protected: - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); virtual void DoSetSelection(int n, bool select); @@ -93,20 +93,20 @@ protected: public: // deleting items virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int n); // accessing strings - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual int FindString(const wxString& s, bool bCase = false) const; // selection virtual int GetSelection() const; protected: virtual int DoAppend(const wxString& item); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; }; #endif // __WX_COCOA_LISTBOX_H__ diff --git a/include/wx/cocoa/radiobox.h b/include/wx/cocoa/radiobox.h index 0faacf6ccd..9caf5afcf1 100644 --- a/include/wx/cocoa/radiobox.h +++ b/include/wx/cocoa/radiobox.h @@ -85,12 +85,12 @@ public: virtual void SetSelection(int n); virtual int GetSelection() const; // string access - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& label); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& label); // change the individual radio button state - virtual bool Enable(int n, bool enable = true); - virtual bool Show(int n, bool show = true); + virtual bool Enable(unsigned int n, bool enable = true); + virtual bool Show(unsigned int n, bool show = true); protected: virtual wxSize DoGetBestSize() const; }; diff --git a/include/wx/ctrlsub.h b/include/wx/ctrlsub.h index 216ab3ab4a..d27f0102ed 100644 --- a/include/wx/ctrlsub.h +++ b/include/wx/ctrlsub.h @@ -38,24 +38,24 @@ public: // accessing strings // ----------------- - virtual size_t GetCount() const = 0; + virtual unsigned int GetCount() const = 0; bool IsEmpty() const { return GetCount() == 0; } - virtual wxString GetString(int n) const = 0; + virtual wxString GetString(unsigned int n) const = 0; wxArrayString GetStrings() const; - virtual void SetString(int n, const wxString& s) = 0; + virtual void SetString(unsigned int n, const wxString& s) = 0; // finding string natively is either case sensitive or insensitive // but never both so fall back to this base version for not // supported search type virtual int FindString(const wxString& s, bool bCase = false) const { - size_t count = GetCount(); + unsigned int count = GetCount(); - for ( size_t i = 0; i < count ; ++i ) + for ( unsigned int i = 0; i < count ; ++i ) { if (GetString(i).IsSameAs( s , bCase )) - return i; + return (int)i; } return wxNOT_FOUND; @@ -82,9 +82,8 @@ public: protected: // check that the index is valid - // FIXME: once api will move to size_t, drop >= 0 check - inline bool IsValid(int n) const { return n >= 0 && (size_t)n < GetCount(); } - inline bool IsValidInsert(int n) const { return n >= 0 && (size_t)n <= GetCount(); } + inline bool IsValid(unsigned int n) const { return n < GetCount(); } + inline bool IsValidInsert(unsigned int n) const { return n <= GetCount(); } }; class WXDLLEXPORT wxItemContainer : public wxItemContainerImmutable @@ -110,26 +109,26 @@ public: // append several items at once to the control void Append(const wxArrayString& strings); - int Insert(const wxString& item, int pos) + int Insert(const wxString& item, unsigned int pos) { return DoInsert(item, pos); } - int Insert(const wxString& item, int pos, void *clientData); - int Insert(const wxString& item, int pos, wxClientData *clientData); + int Insert(const wxString& item, unsigned int pos, void *clientData); + int Insert(const wxString& item, unsigned int pos, wxClientData *clientData); // deleting items // -------------- virtual void Clear() = 0; - virtual void Delete(int n) = 0; + virtual void Delete(unsigned int n) = 0; // misc // ---- // client data stuff - void SetClientData(int n, void* clientData); - void* GetClientData(int n) const; + void SetClientData(unsigned int n, void* clientData); + void* GetClientData(unsigned int n) const; - void SetClientObject(int n, wxClientData* clientData); - wxClientData* GetClientObject(int n) const; + void SetClientObject(unsigned int n, wxClientData* clientData); + wxClientData* GetClientObject(unsigned int n) const; bool HasClientObjectData() const { return m_clientDataItemsType == wxClientData_Object; } @@ -138,12 +137,12 @@ public: protected: virtual int DoAppend(const wxString& item) = 0; - virtual int DoInsert(const wxString& item, int pos) = 0; + virtual int DoInsert(const wxString& item, unsigned int pos) = 0; - virtual void DoSetItemClientData(int n, void* clientData) = 0; - virtual void* DoGetItemClientData(int n) const = 0; - virtual void DoSetItemClientObject(int n, wxClientData* clientData) = 0; - virtual wxClientData* DoGetItemClientObject(int n) const = 0; + virtual void DoSetItemClientData(unsigned int n, void* clientData) = 0; + virtual void* DoGetItemClientData(unsigned int n) const = 0; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData) = 0; + virtual wxClientData* DoGetItemClientObject(unsigned int n) const = 0; // the type of the client data for the items wxClientDataType m_clientDataItemsType; @@ -162,13 +161,13 @@ protected: { wxControl::SetClientObject(data); } \ wxClientData *GetClientObject() const \ { return wxControl::GetClientObject(); } \ - void SetClientData(int n, void* clientData) \ + void SetClientData(unsigned int n, void* clientData) \ { wxItemContainer::SetClientData(n, clientData); } \ - void* GetClientData(int n) const \ + void* GetClientData(unsigned int n) const \ { return wxItemContainer::GetClientData(n); } \ - void SetClientObject(int n, wxClientData* clientData) \ + void SetClientObject(unsigned int n, wxClientData* clientData) \ { wxItemContainer::SetClientObject(n, clientData); } \ - wxClientData* GetClientObject(int n) const \ + wxClientData* GetClientObject(unsigned int n) const \ { return wxItemContainer::GetClientObject(n); } class WXDLLEXPORT wxControlWithItems : public wxControl, public wxItemContainer diff --git a/include/wx/gtk/checklst.h b/include/wx/gtk/checklst.h index 42f7cfd345..057a0388f3 100644 --- a/include/wx/gtk/checklst.h +++ b/include/wx/gtk/checklst.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: checklst.h +// Name: wx/gtk/checklst.h // Purpose: wxCheckListBox class // Author: Robert Roebling // Modified by: @@ -52,11 +52,11 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); - bool IsChecked( int index ) const; - void Check( int index, bool check = TRUE ); + bool IsChecked(unsigned int index) const; + void Check(unsigned int index, bool check = true); int GetItemHeight() const; - + #if wxUSE_NATIVEGTKCHECKLIST void DoCreateCheckList(); #endif diff --git a/include/wx/gtk/choice.h b/include/wx/gtk/choice.h index 1ae716df6f..12d9a3a5fb 100644 --- a/include/wx/gtk/choice.h +++ b/include/wx/gtk/choice.h @@ -62,17 +62,17 @@ public: const wxString& name = wxChoiceNameStr ); // implement base class pure virtuals - void Delete(int n); + void Delete(unsigned int n); void Clear(); int GetSelection() const; int GetCurrentSelection() const { return GetSelection(); } - void SetSelection( int n ); + void SetSelection(int n); - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual int FindString(const wxString& s, bool bCase = false) const; - wxString GetString( int n ) const; - void SetString( int n, const wxString& string ); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& string); static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -84,18 +84,18 @@ protected: void DoApplyWidgetStyle(GtkRcStyle *style); virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); + virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual wxSize DoGetBestSize() const; private: // common part of Create() and DoAppend() - int GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item); + int GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item); // this array is only used for controls with wxCB_SORT style, so only // allocate it if it's needed (hence using pointer) diff --git a/include/wx/gtk/combobox.h b/include/wx/gtk/combobox.h index 5852b7403c..a98cc3eb79 100644 --- a/include/wx/gtk/combobox.h +++ b/include/wx/gtk/combobox.h @@ -81,16 +81,16 @@ public: const wxString& name = wxComboBoxNameStr); void Clear(); - void Delete( int n ); + void Delete(unsigned int n); virtual int FindString(const wxString& s, bool bCase = false) const; int GetSelection() const; int GetCurrentSelection() const; - wxString GetString( int n ) const; + virtual wxString GetString(unsigned int n) const; wxString GetStringSelection() const; - virtual size_t GetCount() const; - void SetSelection( int n ); - void SetString(int n, const wxString &text); + virtual unsigned int GetCount() const; + virtual void SetSelection(int n); + virtual void SetString(unsigned int n, const wxString &text); wxString GetValue() const; void SetValue(const wxString& value); @@ -160,12 +160,12 @@ public: protected: void DoApplyWidgetStyle(GtkRcStyle *style); virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); + virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual wxSize DoGetBestSize() const; diff --git a/include/wx/gtk/listbox.h b/include/wx/gtk/listbox.h index 92df4f2497..00adce243d 100644 --- a/include/wx/gtk/listbox.h +++ b/include/wx/gtk/listbox.h @@ -63,11 +63,11 @@ public: // implement base class pure virtuals virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int n); - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual int FindString(const wxString& s, bool bCase = false) const; virtual bool IsSelected(int n) const; @@ -99,20 +99,20 @@ public: struct _GtkTreeEntry* GtkGetEntry(int pos) const; void GtkInsertItems(const wxArrayString& items, - void** clientData, size_t pos); + void** clientData, unsigned int pos); void GtkSetSelection(int n, const bool select, const bool blockEvent); protected: virtual wxSize DoGetBestSize() const; virtual void DoSetSelection(int n, bool select); virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual int DoListHitTest(const wxPoint& point) const; void DoApplyWidgetStyle(GtkRcStyle *style); diff --git a/include/wx/gtk/radiobox.h b/include/wx/gtk/radiobox.h index d2d9104b74..1f2fb13bf5 100644 --- a/include/wx/gtk/radiobox.h +++ b/include/wx/gtk/radiobox.h @@ -81,21 +81,21 @@ public: // implement wxItemContainerImmutable methods - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual void SetSelection(int n); virtual int GetSelection() const; // implement wxRadioBoxBase methods - virtual bool Show(int n, bool show = true); - virtual bool Enable(int n, bool enable = true); + virtual bool Show(unsigned int n, bool show = true); + virtual bool Enable(unsigned int n, bool enable = true); - virtual bool IsItemEnabled(int n) const; - virtual bool IsItemShown(int n) const; + virtual bool IsItemEnabled(unsigned int n) const; + virtual bool IsItemShown(unsigned int n) const; // override some base class methods to operate on radiobox itself too diff --git a/include/wx/gtk1/checklst.h b/include/wx/gtk1/checklst.h index 3bd0b0f1c0..ba0368baae 100644 --- a/include/wx/gtk1/checklst.h +++ b/include/wx/gtk1/checklst.h @@ -48,8 +48,8 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); - bool IsChecked( int index ) const; - void Check( int index, bool check = TRUE ); + bool IsChecked(unsigned int index) const; + void Check(unsigned int index, bool check = true); int GetItemHeight() const; diff --git a/include/wx/gtk1/choice.h b/include/wx/gtk1/choice.h index 55acb8d49a..7369005ed9 100644 --- a/include/wx/gtk1/choice.h +++ b/include/wx/gtk1/choice.h @@ -62,17 +62,17 @@ public: const wxString& name = wxChoiceNameStr ); // implement base class pure virtuals - void Delete(int n); + void Delete(unsigned int n); void Clear(); int GetSelection() const; int GetCurrentSelection() const { return GetSelection(); } - void SetSelection( int n ); + virtual void SetSelection(int n); - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual int FindString(const wxString& s, bool bCase = false) const; - wxString GetString( int n ) const; - void SetString( int n, const wxString& string ); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& string); static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -82,12 +82,12 @@ protected: void DoApplyWidgetStyle(GtkRcStyle *style); virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); + virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual wxSize DoGetBestSize() const; @@ -95,7 +95,7 @@ protected: private: // common part of Create() and DoAppend() - int GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item); + int GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item); // this array is only used for controls with wxCB_SORT style, so only // allocate it if it's needed (hence using pointer) diff --git a/include/wx/gtk1/combobox.h b/include/wx/gtk1/combobox.h index a3a3d2a178..2e85af60cf 100644 --- a/include/wx/gtk1/combobox.h +++ b/include/wx/gtk1/combobox.h @@ -81,16 +81,16 @@ public: const wxString& name = wxComboBoxNameStr); void Clear(); - void Delete( int n ); + void Delete(unsigned int n); virtual int FindString(const wxString& s, bool bCase = false) const; int GetSelection() const; int GetCurrentSelection() const; - wxString GetString( int n ) const; + virtual wxString GetString(unsigned int n) const; wxString GetStringSelection() const; - virtual size_t GetCount() const; - void SetSelection( int n ); - void SetString(int n, const wxString &text); + virtual unsigned int GetCount() const; + virtual void SetSelection(int n); + virtual void SetString(unsigned int n, const wxString &text); wxString GetValue() const; void SetValue(const wxString& value); @@ -160,12 +160,12 @@ public: protected: virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); + virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual wxSize DoGetBestSize() const; diff --git a/include/wx/gtk1/listbox.h b/include/wx/gtk1/listbox.h index 92b6e8203e..7f9768d4a8 100644 --- a/include/wx/gtk1/listbox.h +++ b/include/wx/gtk1/listbox.h @@ -68,11 +68,11 @@ public: // implement base class pure virtuals virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int n); - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual int FindString(const wxString& s, bool bCase = false) const; virtual bool IsSelected(int n) const; @@ -81,15 +81,15 @@ public: virtual int GetSelections(wxArrayInt& aSelections) const; virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); diff --git a/include/wx/gtk1/radiobox.h b/include/wx/gtk1/radiobox.h index a2fc5ece73..88db4fbe3e 100644 --- a/include/wx/gtk1/radiobox.h +++ b/include/wx/gtk1/radiobox.h @@ -81,21 +81,21 @@ public: // implement wxItemContainerImmutable methods - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual void SetSelection(int n); virtual int GetSelection() const; // implement wxRadioBoxBase methods - virtual bool Show(int n, bool show = true); - virtual bool Enable(int n, bool enable = true); + virtual bool Show(unsigned int n, bool show = true); + virtual bool Enable(unsigned int n, bool enable = true); - virtual bool IsItemEnabled(int n) const; - virtual bool IsItemShown(int n) const; + virtual bool IsItemEnabled(unsigned int n) const; + virtual bool IsItemShown(unsigned int n) const; // override some base class methods to operate on radiobox itself too diff --git a/include/wx/listbox.h b/include/wx/listbox.h index d22b0f47d3..219eccff38 100644 --- a/include/wx/listbox.h +++ b/include/wx/listbox.h @@ -44,15 +44,15 @@ public: // all generic methods are in wxControlWithItems, except for the following // ones which are not yet implemented by wxChoice/wxComboBox - void Insert(const wxString& item, int pos) + void Insert(const wxString& item, unsigned int pos) { DoInsert(item, pos); } - void Insert(const wxString& item, int pos, void *clientData) + void Insert(const wxString& item, unsigned int pos, void *clientData) { DoInsert(item, pos); SetClientData(pos, clientData); } - void Insert(const wxString& item, int pos, wxClientData *clientData) + void Insert(const wxString& item, unsigned int pos, wxClientData *clientData) { DoInsert(item, pos); SetClientObject(pos, clientData); } - void InsertItems(int nItems, const wxString *items, int pos); - void InsertItems(const wxArrayString& items, int pos) + void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos); + void InsertItems(const wxArrayString& items, unsigned int pos) { DoInsertItems(items, pos); } void Set(int n, const wxString* items, void **clientData = NULL); @@ -113,11 +113,11 @@ public: protected: // NB: due to wxGTK implementation details, DoInsert() is implemented // using DoInsertItems() and not the other way round - virtual int DoInsert(const wxString& item, int pos) + virtual int DoInsert(const wxString& item, unsigned int pos) { InsertItems(1, &item, pos); return pos; } // to be implemented in derived classes - virtual void DoInsertItems(const wxArrayString& items, int pos) = 0; + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos) = 0; virtual void DoSetItems(const wxArrayString& items, void **clientData) = 0; virtual void DoSetFirstItem(int n) = 0; diff --git a/include/wx/mac/carbon/checklst.h b/include/wx/mac/carbon/checklst.h index 1334905f47..a98604bcdc 100644 --- a/include/wx/mac/carbon/checklst.h +++ b/include/wx/mac/carbon/checklst.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: checklst.h +// Name: wx/mac/carbon/checklst.h // Purpose: wxCheckListBox class - a listbox with checkable items // Note: this is an optional class. // Author: Stefan Csomor @@ -13,10 +13,6 @@ #ifndef _WX_CHECKLST_H_ #define _WX_CHECKLST_H_ -#if !defined(__MWERKS__) && !defined(__UNIX__) -typedef unsigned int size_t; -#endif - class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase { DECLARE_DYNAMIC_CLASS(wxCheckListBox) @@ -70,19 +66,19 @@ public: const wxString& name = wxListBoxNameStr); // items may be checked - bool IsChecked(size_t uiIndex) const; - void Check(size_t uiIndex, bool bCheck = TRUE); + bool IsChecked(unsigned int uiIndex) const; + void Check(unsigned int uiIndex, bool bCheck = true); // override all methods which add/delete items to update m_checks array as // well - virtual void Delete(int n); + virtual void Delete(unsigned int n); // the array containing the checked status of the items wxArrayInt m_checks; protected: virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoClear(); // common part of all ctors diff --git a/include/wx/mac/carbon/choice.h b/include/wx/mac/carbon/choice.h index 3dbe9c23af..aa7fd46ac3 100644 --- a/include/wx/mac/carbon/choice.h +++ b/include/wx/mac/carbon/choice.h @@ -69,28 +69,28 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual void Clear(); - virtual size_t GetCount() const ; + virtual unsigned int GetCount() const ; virtual int GetSelection() const ; virtual void SetSelection(int n); int GetCurrentSelection() const { return GetSelection(); } virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(int n) const ; - virtual void SetString( int , const wxString& s ) ; + virtual wxString GetString(unsigned int n) const ; + virtual void SetString(unsigned int pos, const wxString& s); virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; protected: virtual wxSize DoGetBestSize() const ; virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); + virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; // free all memory we have (used by Clear() and dtor) // prevent collision with some BSD definitions of macro Free() diff --git a/include/wx/mac/carbon/combobox.h b/include/wx/mac/carbon/combobox.h index f9007107bb..1622c07a18 100644 --- a/include/wx/mac/carbon/combobox.h +++ b/include/wx/mac/carbon/combobox.h @@ -85,16 +85,16 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase const wxString& name = wxComboBoxNameStr); // List functions - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual void Clear(); virtual int GetSelection() const; int GetCurrentSelection() const { return GetSelection(); } virtual void SetSelection(int n); virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(int n) const; + virtual wxString GetString(unsigned int n) const; virtual wxString GetStringSelection() const; - virtual void SetString(int n, const wxString& s); + virtual void SetString(unsigned int n, const wxString& s); // Text field functions virtual wxString GetValue() const; @@ -114,7 +114,7 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase virtual void SetEditable(bool editable); virtual bool IsEditable() const; - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual void Undo(); virtual void Redo(); @@ -143,12 +143,12 @@ protected: virtual void DoMoveWindow(int x, int y, int width, int height); virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); + virtual int DoInsert(const wxString& item, unsigned int pos); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void * DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData * DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void * DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData * DoGetItemClientObject(unsigned int n) const; // the subcontrols wxComboBoxText* m_text; diff --git a/include/wx/mac/carbon/listbox.h b/include/wx/mac/carbon/listbox.h index 090fc5b728..a0521f0e40 100644 --- a/include/wx/mac/carbon/listbox.h +++ b/include/wx/mac/carbon/listbox.h @@ -75,11 +75,11 @@ public: // implement base class pure virtuals virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int n); - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual int FindString(const wxString& s, bool bCase = false) const; virtual bool IsSelected(int n) const; @@ -105,13 +105,13 @@ public: protected: virtual void DoSetSelection(int n, bool select); virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); virtual int DoListHitTest(const wxPoint& point) const; @@ -132,7 +132,7 @@ protected: // prevent collision with some BSD definitions of macro Free() void FreeData(); - size_t m_noItems; + unsigned int m_noItems; int m_selected; bool m_suppressSelection ; wxString m_typeIn ; diff --git a/include/wx/mac/carbon/radiobox.h b/include/wx/mac/carbon/radiobox.h index 0f5d7d53ac..016e42ebd7 100644 --- a/include/wx/mac/carbon/radiobox.h +++ b/include/wx/mac/carbon/radiobox.h @@ -58,13 +58,13 @@ public: virtual void SetSelection(int item); virtual int GetSelection() const; - virtual size_t GetCount() const { return m_noItems; } ; + virtual unsigned int GetCount() const { return m_noItems; } - virtual wxString GetString(int item) const; - virtual void SetString(int item, const wxString& label) ; + virtual wxString GetString(unsigned int item) const; + virtual void SetString(unsigned int item, const wxString& label); - virtual bool Enable(int item, bool enable = true); - virtual bool Show(int item, bool show = true); + virtual bool Enable(unsigned int item, bool enable = true); + virtual bool Show(unsigned int item, bool show = true); virtual bool Enable(bool enable = true); virtual wxString GetLabel() const; @@ -84,7 +84,7 @@ public: protected: wxRadioButton *m_radioButtonCycle; - size_t m_noItems; + unsigned int m_noItems; int m_noRowsOrCols; // Internal functions diff --git a/include/wx/mac/classic/checklst.h b/include/wx/mac/classic/checklst.h index 8c256fda1a..3d4912fddf 100644 --- a/include/wx/mac/classic/checklst.h +++ b/include/wx/mac/classic/checklst.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: checklst.h +// Name: wx/mac/classic/checklst.h // Purpose: wxCheckListBox class - a listbox with checkable items // Note: this is an optional class. // Author: Stefan Csomor @@ -13,10 +13,6 @@ #ifndef _WX_CHECKLST_H_ #define _WX_CHECKLST_H_ -#if !defined(__MWERKS__) && !defined(__UNIX__) -typedef unsigned int size_t; -#endif - class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase { DECLARE_DYNAMIC_CLASS(wxCheckListBox) @@ -70,8 +66,8 @@ public: const wxString& name = wxListBoxNameStr); // items may be checked - bool IsChecked(size_t uiIndex) const; - void Check(size_t uiIndex, bool bCheck = TRUE); + bool IsChecked(unsigned int uiIndex) const; + void Check(unsigned int uiIndex, bool bCheck = true); void OnChar(wxKeyEvent& event) ; void OnLeftClick(wxMouseEvent& event) ; @@ -85,10 +81,10 @@ public: // override all methods which add/delete items to update m_checks array as // well - virtual void Delete(int n); + virtual void Delete(unsigned int n); protected: virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoClear(); // common part of all ctors diff --git a/include/wx/mac/classic/choice.h b/include/wx/mac/classic/choice.h index 8a2fa8ae0c..652a15cce5 100644 --- a/include/wx/mac/classic/choice.h +++ b/include/wx/mac/classic/choice.h @@ -71,26 +71,26 @@ public: // implement base class pure virtuals virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); - virtual void Delete(int n); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void Delete(unsigned int n); virtual void Clear(); - virtual size_t GetCount() const ; + virtual unsigned int GetCount() const ; virtual int GetSelection() const ; virtual void SetSelection(int n); - virtual wxString GetString(int n) const ; - virtual void SetString( int , const wxString& s ) ; + virtual wxString GetString(unsigned int n) const ; + virtual void SetString(unsigned int pos, const wxString& s); void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; protected: virtual wxSize DoGetBestSize() const ; public: // for wxComboBox only - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData ); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; protected: // free all memory we have (used by Clear() and dtor) diff --git a/include/wx/mac/classic/combobox.h b/include/wx/mac/classic/combobox.h index 278606b73a..d0b20cfb8a 100644 --- a/include/wx/mac/classic/combobox.h +++ b/include/wx/mac/classic/combobox.h @@ -78,15 +78,15 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase const wxString& name = wxComboBoxNameStr); // List functions - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual void Clear(); virtual int GetSelection() const ; virtual void SetSelection(int n); virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(int n) const ; + virtual wxString GetString(unsigned int n) const ; virtual wxString GetStringSelection() const ; - virtual void SetString(int n, const wxString& s) ; + virtual void SetString(unsigned int n, const wxString& s); // Text field functions virtual wxString GetValue() const ; @@ -104,7 +104,7 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase virtual void Remove(long from, long to); virtual void SetSelection(long from, long to); virtual void SetEditable(bool editable); - virtual size_t GetCount() const { return m_choice->GetCount() ; } + virtual unsigned int GetCount() const { return m_choice->GetCount() ; } virtual bool IsEditable() const ; @@ -124,12 +124,12 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase protected: virtual int DoAppend(const wxString& item) ; - virtual int DoInsert(const wxString& item, int pos) ; + virtual int DoInsert(const wxString& item, unsigned int pos) ; - virtual void DoSetItemClientData(int n, void* clientData) ; - virtual void* DoGetItemClientData(int n) const ; - virtual void DoSetItemClientObject(int n, wxClientData* clientData) ; - virtual wxClientData* DoGetItemClientObject(int n) const ; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const ; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const ; void FreeData(); diff --git a/include/wx/mac/classic/listbox.h b/include/wx/mac/classic/listbox.h index 3e77885df7..b6a52434e0 100644 --- a/include/wx/mac/classic/listbox.h +++ b/include/wx/mac/classic/listbox.h @@ -85,11 +85,11 @@ public: // implement base class pure virtuals virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int n); - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual int FindString(const wxString& s, bool bCase = false) const; virtual bool IsSelected(int n) const; @@ -98,15 +98,15 @@ public: virtual int GetSelections(wxArrayInt& aSelections) const; virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ; // wxCheckListBox support @@ -156,7 +156,7 @@ protected: // prevent collision with some BSD definitions of macro Free() void FreeData(); - size_t m_noItems; + unsigned int m_noItems; int m_selected; wxString m_typeIn ; long m_lastTypeIn ; diff --git a/include/wx/mac/classic/radiobox.h b/include/wx/mac/classic/radiobox.h index 4f184209ce..fc40c6aa5c 100644 --- a/include/wx/mac/classic/radiobox.h +++ b/include/wx/mac/classic/radiobox.h @@ -58,13 +58,13 @@ public: virtual void SetSelection(int item); virtual int GetSelection() const; - virtual size_t GetCount() const { return m_noItems; } ; + virtual unsigned int GetCount() const { return m_noItems; } - virtual wxString GetString(int item) const; - virtual void SetString(int item, const wxString& label) ; + virtual wxString GetString(unsigned int item) const; + virtual void SetString(unsigned int item, const wxString& label); - virtual bool Enable(int item, bool enable = true); - virtual bool Show(int item, bool show = true); + virtual bool Enable(unsigned int item, bool enable = true); + virtual bool Show(unsigned int item, bool show = true); virtual bool Enable(bool enable = true); virtual wxString GetLabel() const; @@ -84,7 +84,7 @@ public: protected: wxRadioButton *m_radioButtonCycle; - size_t m_noItems; + unsigned int m_noItems; int m_noRowsOrCols; // Internal functions diff --git a/include/wx/motif/checklst.h b/include/wx/motif/checklst.h index 3577dcc551..78bb982180 100644 --- a/include/wx/motif/checklst.h +++ b/include/wx/motif/checklst.h @@ -56,16 +56,16 @@ public: const wxString& name = wxListBoxNameStr); // items may be checked - bool IsChecked(size_t uiIndex) const; - void Check(size_t uiIndex, bool bCheck = true); + bool IsChecked(unsigned int uiIndex) const; + void Check(unsigned int uiIndex, bool bCheck = true); // override base class functions virtual int DoAppend(const wxString& item); virtual int FindString(const wxString& s, bool bCase = false) const; - virtual void SetString(int n, const wxString& s); - virtual wxString GetString(int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); private: void DoToggleItem( int item, int x ); diff --git a/include/wx/motif/choice.h b/include/wx/motif/choice.h index 731a3b8f94..34d562dc74 100644 --- a/include/wx/motif/choice.h +++ b/include/wx/motif/choice.h @@ -71,18 +71,18 @@ public: const wxString& name = wxChoiceNameStr); // implementation of wxControlWithItems - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual int GetSelection() const; - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual void Clear(); - virtual void SetString(int n, const wxString& s); - virtual wxString GetString(int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; // implementation of wxChoiceBase virtual void SetSelection(int n); @@ -112,7 +112,7 @@ protected: // common part of all contructors void Init(); - size_t m_noStrings; + unsigned int m_noStrings; WXWidget m_menuWidget; WXWidget m_buttonWidget; wxWidgetArray m_widgetArray; diff --git a/include/wx/motif/combobox.h b/include/wx/motif/combobox.h index eb5cc9cc34..fcdf4094f9 100644 --- a/include/wx/motif/combobox.h +++ b/include/wx/motif/combobox.h @@ -71,14 +71,14 @@ public: // implementation of wxControlWithItems virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); - virtual void Delete(int n); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void Delete(unsigned int n); virtual void Clear(); virtual int GetSelection() const ; virtual void SetSelection(int n); virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(int n) const ; - virtual void SetString(int n, const wxString& s); + virtual wxString GetString(unsigned int n) const ; + virtual void SetString(unsigned int n, const wxString& s); // Text field functions virtual wxString GetValue() const ; diff --git a/include/wx/motif/listbox.h b/include/wx/motif/listbox.h index 002c80de52..c0c4d1b56f 100644 --- a/include/wx/motif/listbox.h +++ b/include/wx/motif/listbox.h @@ -66,22 +66,22 @@ public: ~wxListBox(); // implementation of wxControlWithItems - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual int DoAppend(const wxString& item); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual int GetSelection() const; - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual int FindString(const wxString& s, bool bCase = false) const; virtual void Clear(); - virtual void SetString(int n, const wxString& s); - virtual wxString GetString(int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; // implementation of wxListBoxbase virtual void DoSetSelection(int n, bool select); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); virtual int GetSelections(wxArrayInt& aSelections) const; @@ -101,7 +101,7 @@ public: protected: virtual wxSize DoGetBestSize() const; - size_t m_noItems; + unsigned int m_noItems; // List mapping positions->client data wxClientDataDictionary m_clientDataDict; diff --git a/include/wx/motif/radiobox.h b/include/wx/motif/radiobox.h index 6284a8033c..f85602f8f8 100644 --- a/include/wx/motif/radiobox.h +++ b/include/wx/motif/radiobox.h @@ -72,19 +72,19 @@ public: const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); - void SetSelection(int N); + virtual void SetSelection(int n); int GetSelection() const; - void SetString(int item, const wxString& label) ; - wxString GetString(int item) const; + virtual void SetString(unsigned int item, const wxString& label); + virtual wxString GetString(unsigned int item) const; virtual bool Enable(bool enable = true); - virtual bool Enable(int item, bool enable = true); - virtual bool Show(int item, bool show = true); + virtual bool Enable(unsigned int item, bool enable = true); + virtual bool Show(unsigned int item, bool show = true); virtual bool Show(bool show = true); virtual wxString GetStringSelection() const; virtual bool SetStringSelection(const wxString& s); - virtual size_t GetCount() const { return m_noItems; } ; + virtual unsigned int GetCount() const { return m_noItems; } ; void Command(wxCommandEvent& event); int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } @@ -103,7 +103,7 @@ protected: int width, int height, int sizeFlags = wxSIZE_AUTO); - size_t m_noItems; + unsigned int m_noItems; int m_noRowsOrCols; int m_selectedButton; diff --git a/include/wx/msw/checklst.h b/include/wx/msw/checklst.h index 23665f2793..e347ba14fe 100644 --- a/include/wx/msw/checklst.h +++ b/include/wx/msw/checklst.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: checklst.h +// Name: wx/msw/checklst.h // Purpose: wxCheckListBox class - a listbox with checkable items // Author: Vadim Zeitlin // Modified by: @@ -56,13 +56,13 @@ public: const wxString& name = wxListBoxNameStr); // override base class virtuals - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual bool SetFont( const wxFont &font ); // items may be checked - virtual bool IsChecked(size_t uiIndex) const; - virtual void Check(size_t uiIndex, bool bCheck = true); + virtual bool IsChecked(unsigned int uiIndex) const; + virtual void Check(unsigned int uiIndex, bool bCheck = true); // return the index of the item at this position or wxNOT_FOUND int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); } diff --git a/include/wx/msw/choice.h b/include/wx/msw/choice.h index f5f10b665e..a2ca016367 100644 --- a/include/wx/msw/choice.h +++ b/include/wx/msw/choice.h @@ -66,17 +66,17 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual void Clear(); - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual int GetSelection() const; virtual int GetCurrentSelection() const; virtual void SetSelection(int n); virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); // MSW only virtual bool MSWCommand(WXUINT param, WXWORD id); @@ -90,12 +90,12 @@ protected: void Init() { m_lastAcceptedSelection = wxID_NONE; } virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); + virtual int DoInsert(const wxString& item, unsigned int pos); virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; // MSW implementation virtual wxSize DoGetBestSize() const; diff --git a/include/wx/msw/listbox.h b/include/wx/msw/listbox.h index 0e9cf02d40..bd32aa8401 100644 --- a/include/wx/msw/listbox.h +++ b/include/wx/msw/listbox.h @@ -79,11 +79,11 @@ public: // implement base class pure virtuals virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int n); - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual int FindString(const wxString& s, bool bCase = false) const; virtual bool IsSelected(int n) const; @@ -135,19 +135,19 @@ public: protected: virtual void DoSetSelection(int n, bool select); virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual int DoListHitTest(const wxPoint& point) const; // free memory (common part of Clear() and dtor) void Free(); - size_t m_noItems; + unsigned int m_noItems; int m_selected; virtual wxSize DoGetBestSize() const; diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index d286147126..c02598fa6c 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -85,13 +85,13 @@ public: // implement the radiobox interface virtual void SetSelection(int n); virtual int GetSelection() const { return m_selectedButton; } - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& label); - virtual bool Enable(int n, bool enable = true); - virtual bool Show(int n, bool show = true); - virtual bool IsItemEnabled(int n) const; - virtual bool IsItemShown(int n) const; + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& label); + virtual bool Enable(unsigned int n, bool enable = true); + virtual bool Show(unsigned int n, bool show = true); + virtual bool IsItemEnabled(unsigned int n) const; + virtual bool IsItemShown(unsigned int n) const; // override some base class methods virtual bool Show(bool show = true); diff --git a/include/wx/msw/wince/checklst.h b/include/wx/msw/wince/checklst.h index 5cc5ff0fbe..01f0c23319 100644 --- a/include/wx/msw/wince/checklst.h +++ b/include/wx/msw/wince/checklst.h @@ -50,20 +50,20 @@ public: const wxString& name = wxListBoxNameStr); // override base class virtuals - virtual void Delete(int n); + virtual void Delete(unsigned int n); // items may be checked - virtual bool IsChecked(size_t uiIndex) const; - virtual void Check(size_t uiIndex, bool bCheck = true); + virtual bool IsChecked(unsigned int uiIndex) const; + virtual void Check(unsigned int uiIndex, bool bCheck = true); // public interface derived from wxListBox and lower classes virtual void Clear(); - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual int GetSelection() const; virtual int GetSelections(wxArrayInt& aSelections) const; - virtual wxString GetString(int n) const; + virtual wxString GetString(unsigned int n) const; virtual bool IsSelected(int n) const; - virtual void SetString(int n, const wxString& s); + virtual void SetString(unsigned int n, const wxString& s); // Implementation virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); @@ -73,12 +73,12 @@ protected: // protected interface derived from wxListBox and lower classes virtual int DoAppend(const wxString& item); - virtual void* DoGetItemClientData(int n) const; - virtual wxClientData* DoGetItemClientObject(int n) const; - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void DoSetItemClientObject(int n, wxClientData* clientData); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetSelection(int n, bool select); // convert our styles to Windows diff --git a/include/wx/msw/wince/choicece.h b/include/wx/msw/wince/choicece.h index 027837225a..60558e4d08 100644 --- a/include/wx/msw/wince/choicece.h +++ b/include/wx/msw/wince/choicece.h @@ -79,17 +79,17 @@ public: // implement base class pure virtuals virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); - virtual void Delete(int n); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void Delete(unsigned int n); virtual void Clear() ; - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual int GetSelection() const; virtual void SetSelection(int n); virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); // get the subclassed window proc of the buddy list of choices WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } @@ -100,10 +100,10 @@ public: virtual bool MSWCommand(WXUINT param, WXWORD id); protected: - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; // MSW implementation virtual void DoGetPosition(int *x, int *y) const; diff --git a/include/wx/os2/checklst.h b/include/wx/os2/checklst.h index c689208517..2a23c9645d 100644 --- a/include/wx/os2/checklst.h +++ b/include/wx/os2/checklst.h @@ -49,17 +49,15 @@ public: // // Override base class virtuals // - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual bool SetFont(const wxFont &rFont); // // Items may be checked // - bool IsChecked(size_t uiIndex) const; - void Check( size_t uiIndex - ,bool bCheck = true - ); + bool IsChecked(unsigned int uiIndex) const; + void Check(unsigned int uiIndex, bool bCheck = true); // // Accessors @@ -74,7 +72,7 @@ protected: virtual wxOwnerDrawn* CreateItem(size_t n); virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); // // Pressing space or clicking the check box toggles the item @@ -83,7 +81,7 @@ protected: void OnLeftClick(wxMouseEvent& rEvent); private: - size_t m_nItemHeight; // height of checklistbox items (the same for all) + size_t m_nItemHeight; // height of checklistbox items (the same for all) DECLARE_DYNAMIC_CLASS(wxCheckListBox) DECLARE_EVENT_TABLE() diff --git a/include/wx/os2/choice.h b/include/wx/os2/choice.h index 4040e66663..6f7feec581 100644 --- a/include/wx/os2/choice.h +++ b/include/wx/os2/choice.h @@ -90,18 +90,16 @@ public: // Implement base class virtuals // virtual int DoAppend(const wxString& rsItem); - virtual int DoInsert(const wxString& rsItem, int pos); - virtual void Delete(int n); + virtual int DoInsert(const wxString& rsItem, unsigned int pos); + virtual void Delete(unsigned int n); virtual void Clear(void); - virtual size_t GetCount() const; - virtual int GetSelection(void) const ; + virtual unsigned int GetCount() const; + virtual int GetSelection(void) const; virtual void SetSelection(int n); - virtual wxString GetString(int n) const ; - virtual void SetString( int n - ,const wxString& rsStr - ); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& rsStr); // // OS2 only @@ -115,14 +113,10 @@ public: ); protected: - virtual void DoSetItemClientData( int n - ,void* pClientData - ); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject( int n - ,wxClientData* pClientData - ); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* pClientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* pClientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; virtual wxSize DoGetBestSize(void) const; virtual void DoSetSize( int nX ,int nY diff --git a/include/wx/os2/listbox.h b/include/wx/os2/listbox.h index 01070daa9e..aad4af0780 100644 --- a/include/wx/os2/listbox.h +++ b/include/wx/os2/listbox.h @@ -104,11 +104,11 @@ public: // Implement base class pure virtuals // virtual void Clear(void); - virtual void Delete(int n); + virtual void Delete(unsigned int n); - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& rsString); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& rsString); virtual bool IsSelected(int n) const; virtual void DoSetSelection(int n, bool bSelect); @@ -116,21 +116,17 @@ public: virtual int GetSelections(wxArrayInt& raSelections) const; virtual int DoAppend(const wxString& rsItem); - virtual void DoInsertItems( const wxArrayString& raItems, int rPos ); + virtual void DoInsertItems( const wxArrayString& raItems, unsigned int rPos ); virtual void DoSetItems( const wxArrayString& raItems ,void ** ppClientData ); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData( int n - ,void* pClientData - ); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject( int n - ,wxClientData* pClientData - ); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* pClientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* pClientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; // // wxCheckListBox support @@ -154,8 +150,8 @@ protected: bool HasMultipleSelection(void) const; virtual wxSize DoGetBestSize(void) const; - size_t m_nNumItems; - int m_nSelected; + unsigned int m_nNumItems; + int m_nSelected; #if wxUSE_OWNER_DRAWN // diff --git a/include/wx/os2/radiobox.h b/include/wx/os2/radiobox.h index 24419a2803..196bbbbc0b 100644 --- a/include/wx/os2/radiobox.h +++ b/include/wx/os2/radiobox.h @@ -102,7 +102,7 @@ public: void Command(wxCommandEvent& rEvent); bool ContainsHWND(WXHWND hWnd) const; virtual bool Enable(bool bEnable = true); - virtual bool Enable(int nItem, bool bEnable = true); + virtual bool Enable(unsigned int nItem, bool bEnable = true); virtual WXHBRUSH OnCtlColor( WXHDC hDC ,WXHWND hWnd @@ -115,7 +115,7 @@ public: ,WXWORD wId ); void SendNotificationEvent(void); - virtual bool Show(int nItem, bool bShow = true); + virtual bool Show(unsigned int nItem, bool bShow = true); virtual bool Show(bool bShow = true); MRESULT WindowProc( WXUINT uMsg ,WXWPARAM wParam @@ -125,24 +125,20 @@ public: - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; inline WXHWND* GetRadioButtons(void) const { return m_ahRadioButtons; } int GetSelection(void) const; - void GetSize( int* pnX - ,int* pnY - ) const; + void GetSize(int* pnX, int* pnY) const; inline int GetSizeFlags(void) const { return m_nSizeFlags; } - wxString GetString(int nIndex) const; + virtual wxString GetString(unsigned int nIndex) const; virtual wxString GetStringSelection(void) const; inline void SetButtonFont(const wxFont& rFont) { SetFont(rFont); } void SetFocus(void); virtual bool SetFont(const wxFont& rFont); inline void SetLabelFont(const wxFont& WXUNUSED(font)) {}; - void SetSelection(int nIndex); - virtual void SetString( int nNum - ,const wxString& rsLabel - ); + virtual void SetSelection(int nIndex); + virtual void SetString(unsigned int nNum, const wxString& rsLabel); virtual bool SetStringSelection(const wxString& rsStr); virtual void SetLabel(const wxString& rsLabel) @@ -175,7 +171,7 @@ protected: private: - size_t m_nNoItems; + unsigned int m_nNoItems; DECLARE_DYNAMIC_CLASS(wxRadioBox) }; // end of wxRadioBox diff --git a/include/wx/palmos/checklst.h b/include/wx/palmos/checklst.h index 254a355b18..0c28425e25 100644 --- a/include/wx/palmos/checklst.h +++ b/include/wx/palmos/checklst.h @@ -56,13 +56,13 @@ public: const wxString& name = wxListBoxNameStr); // override base class virtuals - virtual void Delete(int n); + virtual void Delete(unsigned int n); virtual bool SetFont( const wxFont &font ); // items may be checked - virtual bool IsChecked(size_t uiIndex) const; - virtual void Check(size_t uiIndex, bool bCheck = TRUE); + virtual bool IsChecked(unsigned int uiIndex) const; + virtual void Check(unsigned int uiIndex, bool bCheck = true); // return the index of the item at this position or wxNOT_FOUND int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); } @@ -85,7 +85,7 @@ protected: void OnLeftClick(wxMouseEvent& event); private: - size_t m_nItemHeight; // height of checklistbox items (the same for all) + size_t m_nItemHeight; // height of checklistbox items (the same for all) DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) diff --git a/include/wx/palmos/choice.h b/include/wx/palmos/choice.h index d4054dada7..e978c2d869 100644 --- a/include/wx/palmos/choice.h +++ b/include/wx/palmos/choice.h @@ -65,16 +65,16 @@ public: // implement base class pure virtuals virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); - virtual void Delete(int n); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void Delete(unsigned int n); virtual void Clear(); - virtual size_t GetCount() const; + virtual unsigned int GetCount() const; virtual int GetSelection() const; virtual void SetSelection(int n); - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); // MSW only virtual bool MSWCommand(WXUINT param, WXWORD id); @@ -82,10 +82,10 @@ public: protected: virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoSetItemClientData( int n, void* clientData ); - virtual void* DoGetItemClientData( int n ) const; - virtual void DoSetItemClientObject( int n, wxClientData* clientData ); - virtual wxClientData* DoGetItemClientObject( int n ) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; // MSW implementation virtual wxSize DoGetBestSize() const; diff --git a/include/wx/palmos/listbox.h b/include/wx/palmos/listbox.h index ec32855dc6..6275079fff 100644 --- a/include/wx/palmos/listbox.h +++ b/include/wx/palmos/listbox.h @@ -79,11 +79,11 @@ public: // implement base class pure virtuals virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int n); - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual bool IsSelected(int n) const; virtual void DoSetSelection(int n, bool select); @@ -91,15 +91,15 @@ public: virtual int GetSelections(wxArrayInt& aSelections) const; virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; // wxCheckListBox support #if wxUSE_OWNER_DRAWN diff --git a/include/wx/palmos/radiobox.h b/include/wx/palmos/radiobox.h index c36c989317..16cccd278d 100644 --- a/include/wx/palmos/radiobox.h +++ b/include/wx/palmos/radiobox.h @@ -88,15 +88,15 @@ public: // implement the radiobox interface virtual void SetSelection(int n); virtual int GetSelection() const; - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& label); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& label); virtual bool Enable(bool enable = true); - virtual bool Enable(int n, bool enable = true); + virtual bool Enable(unsigned int n, bool enable = true); virtual bool Show(bool show = true); - virtual bool Show(int n, bool show = true); + virtual bool Show(unsigned int n, bool show = true); virtual void SetLabel(const wxString& label); virtual wxString GetLabel(); diff --git a/include/wx/radiobox.h b/include/wx/radiobox.h index 0cbb947156..41e7014aae 100644 --- a/include/wx/radiobox.h +++ b/include/wx/radiobox.h @@ -28,17 +28,17 @@ class WXDLLEXPORT wxRadioBoxBase : public wxItemContainerImmutable { public: // change/query the individual radio button state - virtual bool Enable(int n, bool enable = true) = 0; - virtual bool Show(int n, bool show = true) = 0; + virtual bool Enable(unsigned int n, bool enable = true) = 0; + virtual bool Show(unsigned int n, bool show = true) = 0; // NB: these functions are stubbed here for now but should become pure // virtual once all ports implement them - virtual bool IsItemEnabled(int WXUNUSED(n)) const { return true; } - virtual bool IsItemShown(int WXUNUSED(n)) const { return true; } + virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const { return true; } + virtual bool IsItemShown(unsigned int WXUNUSED(n)) const { return true; } // return number of columns/rows in this radiobox - int GetColumnCount() const { return m_numCols; } - int GetRowCount() const { return m_numRows; } + unsigned int GetColumnCount() const { return m_numCols; } + unsigned int GetRowCount() const { return m_numRows; } // return the item above/below/to the left/right of the given one int GetNextItem(int item, wxDirection dir, long style) const; @@ -60,21 +60,21 @@ protected: // return the number of items in major direction (which depends on whether // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style) - int GetMajorDim() const { return m_majorDim; } + unsigned int GetMajorDim() const { return m_majorDim; } // sets m_majorDim and also updates m_numCols/Rows // // the style parameter should be the style of the radiobox itself - void SetMajorDim(int majorDim, long style); + void SetMajorDim(unsigned int majorDim, long style); private: // the number of elements in major dimension (i.e. number of columns if // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also // the number of rows/columns calculated from it - int m_majorDim, - m_numCols, - m_numRows; + unsigned int m_majorDim, + m_numCols, + m_numRows; }; #if defined(__WXUNIVERSAL__) diff --git a/include/wx/univ/checklst.h b/include/wx/univ/checklst.h index 9f901de08e..619ab94038 100644 --- a/include/wx/univ/checklst.h +++ b/include/wx/univ/checklst.h @@ -70,8 +70,8 @@ public: const wxString& name = wxListBoxNameStr); // implement check list box methods - virtual bool IsChecked(size_t item) const; - virtual void Check(size_t item, bool check = true); + virtual bool IsChecked(unsigned int item) const; + virtual void Check(unsigned int item, bool check = true); // and input handling virtual bool PerformAction(const wxControlAction& action, @@ -80,11 +80,11 @@ public: // override all methods which add/delete items to update m_checks array as // well - virtual void Delete(int n); + virtual void Delete(unsigned int n); protected: virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoClear(); @@ -122,4 +122,3 @@ public: }; #endif // _WX_UNIV_CHECKLST_H_ - diff --git a/include/wx/univ/combobox.h b/include/wx/univ/combobox.h index 9230e4dbe0..8c9eb4fcdc 100644 --- a/include/wx/univ/combobox.h +++ b/include/wx/univ/combobox.h @@ -293,10 +293,10 @@ public: // wxControlWithItems methods virtual void Clear(); - virtual void Delete(int n); - virtual size_t GetCount() const; - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& s); + virtual void Delete(unsigned int n); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); virtual int FindString(const wxString& s, bool bCase = false) const; virtual void SetSelection(int n); virtual int GetSelection() const; @@ -305,11 +305,11 @@ public: protected: virtual int DoAppend(const wxString& item); - virtual int DoInsert(const wxString& item, int pos); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; // common part of all ctors void Init(); diff --git a/include/wx/univ/listbox.h b/include/wx/univ/listbox.h index a82785f5ba..837095cc86 100644 --- a/include/wx/univ/listbox.h +++ b/include/wx/univ/listbox.h @@ -97,13 +97,13 @@ public: // implement the listbox interface defined by wxListBoxBase virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int n); - virtual size_t GetCount() const - { return m_strings->GetCount(); } - virtual wxString GetString(int n) const + virtual unsigned int GetCount() const + { return (unsigned int)m_strings->GetCount(); } + virtual wxString GetString(unsigned int n) const { return m_strings->Item(n); } - virtual void SetString(int n, const wxString& s); + virtual void SetString(unsigned int n, const wxString& s); virtual int FindString(const wxString& s, bool bCase = false) const { return m_strings->Index(s, bCase); } @@ -116,15 +116,15 @@ protected: virtual void DoSetSelection(int n, bool select); virtual int DoAppendOnly(const wxString& item); virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; public: // override some more base class methods diff --git a/include/wx/univ/radiobox.h b/include/wx/univ/radiobox.h index 1220b5722b..17b4f8951b 100644 --- a/include/wx/univ/radiobox.h +++ b/include/wx/univ/radiobox.h @@ -84,16 +84,17 @@ public: virtual void SetSelection(int n); virtual int GetSelection() const; - virtual size_t GetCount() const { return m_buttons.GetCount(); } + virtual unsigned int GetCount() const + { return (unsigned int)m_buttons.GetCount(); } - virtual wxString GetString(int n) const; - virtual void SetString(int n, const wxString& label); + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& label); - virtual bool Enable(int n, bool enable = true); - virtual bool Show(int n, bool show = true); + virtual bool Enable(unsigned int n, bool enable = true); + virtual bool Show(unsigned int n, bool show = true); - virtual bool IsItemEnabled(int n) const; - virtual bool IsItemShown(int n) const; + virtual bool IsItemEnabled(unsigned int n) const; + virtual bool IsItemShown(unsigned int n) const; // we also override the wxControl methods to avoid virtual function hiding virtual bool Enable(bool enable = true); diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index 9f7046a89b..f973500bb2 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -362,8 +362,8 @@ void ComboboxWidgetsPage::CreateCombo() wxArrayString items; if ( m_combobox ) { - int count = m_combobox->GetCount(); - for ( int n = 0; n < count; n++ ) + unsigned int count = m_combobox->GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { items.Add(m_combobox->GetString(n)); } @@ -377,8 +377,8 @@ void ComboboxWidgetsPage::CreateCombo() 0, NULL, flags); - size_t count = items.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = items.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_combobox->Append(items[n]); } @@ -415,7 +415,7 @@ void ComboboxWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event)) { unsigned long n; if ( !m_textDelete->GetValue().ToULong(&n) || - (n >= (unsigned)m_combobox->GetCount()) ) + (n >= m_combobox->GetCount()) ) { return; } @@ -426,7 +426,7 @@ void ComboboxWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event)) void ComboboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event)) { int sel = m_combobox->GetSelection(); - if ( sel != -1 ) + if ( sel != wxNOT_FOUND ) { m_combobox->Delete(sel); } diff --git a/src/cocoa/checklst.mm b/src/cocoa/checklst.mm index f3a68f99ac..80dbda3c3d 100644 --- a/src/cocoa/checklst.mm +++ b/src/cocoa/checklst.mm @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: cocoa/checklst.mm +// Name: src/cocoa/checklst.mm // Purpose: wxCheckListBox // Author: David Elliott // Modified by: // Created: 2003/03/18 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWidgets licence +// Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// #include "wx/wxprec.h" @@ -58,13 +58,13 @@ wxCheckListBox::~wxCheckListBox() { } -bool wxCheckListBox::IsChecked(size_t item) const +bool wxCheckListBox::IsChecked(unsigned int item) const { return false; } -void wxCheckListBox::Check(size_t item, bool check) +void wxCheckListBox::Check(unsigned int item, bool check) { } diff --git a/src/cocoa/choice.mm b/src/cocoa/choice.mm index 8f15536bd5..266a2bdbbc 100644 --- a/src/cocoa/choice.mm +++ b/src/cocoa/choice.mm @@ -78,7 +78,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID winid, { m_sortedStrings->Add(choices[i]); } - for(size_t i=0; i < m_sortedStrings->GetCount(); i++) + for(unsigned int i=0; i < m_sortedStrings->GetCount(); i++) { [nsmenu addItemWithTitle:wxNSStringWithWxString( m_sortedStrings->Item(i)) @@ -113,7 +113,7 @@ wxChoice::~wxChoice() if(HasClientObjectData()) { - for(size_t i=0; i < m_itemsClientData.GetCount(); i++) + for(unsigned int i=0; i < m_itemsClientData.GetCount(); i++) delete (wxClientData*)m_itemsClientData.Item(i); } m_itemsClientData.Clear(); @@ -139,14 +139,14 @@ void wxChoice::Clear() m_sortedStrings->Clear(); if(HasClientObjectData()) { - for(size_t i=0; i < m_itemsClientData.GetCount(); i++) + for(unsigned int i=0; i < m_itemsClientData.GetCount(); i++) delete (wxClientData*)m_itemsClientData.Item(i); } m_itemsClientData.Clear(); [(NSPopUpButton*)m_cocoaNSView removeAllItems]; } -void wxChoice::Delete(int n) +void wxChoice::Delete(unsigned int n) { if(m_sortedStrings) m_sortedStrings->RemoveAt(n); @@ -156,18 +156,18 @@ void wxChoice::Delete(int n) [(NSPopUpButton*)m_cocoaNSView removeItemAtIndex:n]; } -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { - return (size_t)[(NSPopUpButton*)m_cocoaNSView numberOfItems]; + return (unsigned int)[(NSPopUpButton*)m_cocoaNSView numberOfItems]; } -wxString wxChoice::GetString(int n) const +wxString wxChoice::GetString(unsigned int n) const { wxAutoNSAutoreleasePool pool; return wxStringWithNSString([(NSPopUpButton*)m_cocoaNSView itemTitleAtIndex:n]); } -void wxChoice::SetString(int n, const wxString& title) +void wxChoice::SetString(unsigned int n, const wxString& title) { NSMenuItem *item = [(NSPopUpButton*)m_cocoaNSView itemAtIndex:n]; [item setTitle:wxNSStringWithWxString(title)]; @@ -207,7 +207,7 @@ int wxChoice::DoAppend(const wxString& title) return [nsmenu indexOfItem:item]; } -int wxChoice::DoInsert(const wxString& title, int pos) +int wxChoice::DoInsert(const wxString& title, unsigned int pos) { if(m_sortedStrings) return DoAppend(title); @@ -218,22 +218,22 @@ int wxChoice::DoInsert(const wxString& title, int pos) return [nsmenu indexOfItem:item]; } -void wxChoice::DoSetItemClientData(int n, void *data) +void wxChoice::DoSetItemClientData(unsigned int n, void *data) { m_itemsClientData.Item(n) = data; } -void* wxChoice::DoGetItemClientData(int n) const +void* wxChoice::DoGetItemClientData(unsigned int n) const { return m_itemsClientData.Item(n); } -void wxChoice::DoSetItemClientObject(int n, wxClientData *data) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData *data) { m_itemsClientData.Item(n) = data; } -wxClientData* wxChoice::DoGetItemClientObject(int n) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { return (wxClientData*)m_itemsClientData.Item(n); } diff --git a/src/cocoa/combobox.mm b/src/cocoa/combobox.mm index 9be77501ac..fcfed2c0a5 100644 --- a/src/cocoa/combobox.mm +++ b/src/cocoa/combobox.mm @@ -255,23 +255,23 @@ void wxComboBox::Clear() m_Datas.Clear(); } -void wxComboBox::Delete(int nIndex) +void wxComboBox::Delete(unsigned int n) { - [GetNSComboBox() removeItemAtIndex:nIndex]; - m_Datas.RemoveAt(nIndex); + [GetNSComboBox() removeItemAtIndex:n]; + m_Datas.RemoveAt(n); } -size_t wxComboBox::GetCount() const +unsigned int wxComboBox::GetCount() const { - return (size_t)[GetNSComboBox() numberOfItems]; + return (unsigned int)[GetNSComboBox() numberOfItems]; } -wxString wxComboBox::GetString(int nIndex) const +wxString wxComboBox::GetString(unsigned int nIndex) const { return wxStringWithNSString([GetNSComboBox() itemObjectValueAtIndex:nIndex]); } -void wxComboBox::SetString(int nIndex, const wxString& szString) +void wxComboBox::SetString(unsigned int nIndex, const wxString& szString) { wxAutoNSAutoreleasePool pool; //FIXME: There appears to be no "set item data" method - maybe @@ -299,30 +299,30 @@ int wxComboBox::DoAppend(const wxString& szItem) return [GetNSComboBox() numberOfItems]; } -int wxComboBox::DoInsert(const wxString& szItem, int nIndex) +int wxComboBox::DoInsert(const wxString& szItem, unsigned int nIndex) { m_Datas.Insert(NULL, nIndex); wxAutoNSAutoreleasePool pool; [GetNSComboBox() insertItemWithObjectValue:wxNSStringWithWxString(szItem) atIndex:nIndex]; - return nIndex; + return (int)nIndex; } -void wxComboBox::DoSetItemClientData(int nIndex, void* pData) +void wxComboBox::DoSetItemClientData(unsigned int nIndex, void* pData) { m_Datas[nIndex] = pData; } -void* wxComboBox::DoGetItemClientData(int nIndex) const +void* wxComboBox::DoGetItemClientData(unsigned int nIndex) const { return m_Datas[nIndex]; } -void wxComboBox::DoSetItemClientObject(int nIndex, wxClientData* pClientData) +void wxComboBox::DoSetItemClientObject(unsigned int nIndex, wxClientData* pClientData) { m_Datas[nIndex] = (void*) pClientData; } -wxClientData* wxComboBox::DoGetItemClientObject(int nIndex) const +wxClientData* wxComboBox::DoGetItemClientObject(unsigned int nIndex) const { return (wxClientData*) m_Datas[nIndex]; } diff --git a/src/cocoa/listbox.mm b/src/cocoa/listbox.mm index 78ac457181..37eb935a7b 100644 --- a/src/cocoa/listbox.mm +++ b/src/cocoa/listbox.mm @@ -168,7 +168,7 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const return [GetNSTableView() numberOfSelectedRows]; } -void wxListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxAutoNSAutoreleasePool pool; @@ -189,7 +189,7 @@ void wxListBox::DoSetItems(const wxArrayString& items, void **clientData) [m_cocoaItems removeAllObjects]; m_itemClientData.Clear(); // Provide the data - for(size_t i=0; i < items.GetCount(); i++) + for(unsigned int i=0; i < items.GetCount(); i++) { [m_cocoaItems addObject: wxNSStringWithWxString(items[i])]; m_itemClientData.Add(clientData[i]); @@ -216,7 +216,7 @@ void wxListBox::Clear() [GetNSTableView() reloadData]; } -void wxListBox::Delete(int n) +void wxListBox::Delete(unsigned int n) { [m_cocoaItems removeObjectAtIndex:n]; m_itemClientData.RemoveAt(n); @@ -224,17 +224,17 @@ void wxListBox::Delete(int n) } // accessing strings -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { - return (size_t)[m_cocoaItems count]; + return (unsigned int)[m_cocoaItems count]; } -wxString wxListBox::GetString(int n) const +wxString wxListBox::GetString(unsigned int n) const { return wxStringWithNSString([m_cocoaItems objectAtIndex:n]); } -void wxListBox::SetString(int n, const wxString& s) +void wxListBox::SetString(unsigned int n, const wxString& s) { wxAutoNSAutoreleasePool pool; [m_cocoaItems removeObjectAtIndex:n]; @@ -264,22 +264,22 @@ int wxListBox::DoAppend(const wxString& item) return [m_cocoaItems count]; } -void wxListBox::DoSetItemClientData(int n, void* clientData) +void wxListBox::DoSetItemClientData(unsigned int n, void* clientData) { m_itemClientData[n] = clientData; } -void* wxListBox::DoGetItemClientData(int n) const +void* wxListBox::DoGetItemClientData(unsigned int n) const { return m_itemClientData[n]; } -void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { m_itemClientData[n] = (void*) clientData; } -wxClientData* wxListBox::DoGetItemClientObject(int n) const +wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const { return (wxClientData*) m_itemClientData[n]; } diff --git a/src/cocoa/radiobox.mm b/src/cocoa/radiobox.mm index aa699a7e2d..f7476c2718 100644 --- a/src/cocoa/radiobox.mm +++ b/src/cocoa/radiobox.mm @@ -76,28 +76,28 @@ int wxRadioBox::GetSelection() const } // string access -size_t wxRadioBox::GetCount() const +unsigned int wxRadioBox::GetCount() const { return 0; } -wxString wxRadioBox::GetString(int n) const +wxString wxRadioBox::GetString(unsigned int n) const { return wxEmptyString; } -void wxRadioBox::SetString(int n, const wxString& label) +void wxRadioBox::SetString(unsigned int n, const wxString& label) { } // change the individual radio button state -bool wxRadioBox::Enable(int n, bool enable) +bool wxRadioBox::Enable(unsigned int n, bool enable) { // TODO return false; } -bool wxRadioBox::Show(int n, bool show) +bool wxRadioBox::Show(unsigned int n, bool show) { // TODO return false; diff --git a/src/common/ctrlsub.cpp b/src/common/ctrlsub.cpp index df087db268..d2bc3e8ef2 100644 --- a/src/common/ctrlsub.cpp +++ b/src/common/ctrlsub.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: common/ctrlsub.cpp +// Name: src/common/ctrlsub.cpp // Purpose: wxItemContainer implementation // Author: Vadim Zeitlin // Modified by: @@ -49,9 +49,10 @@ wxItemContainerImmutable::~wxItemContainerImmutable() wxString wxItemContainerImmutable::GetStringSelection() const { wxString s; + int sel = GetSelection(); - if ( sel != -1 ) - s = GetString(sel); + if ( sel != wxNOT_FOUND ) + s = GetString((unsigned int)sel); return s; } @@ -71,9 +72,9 @@ wxArrayString wxItemContainerImmutable::GetStrings() const { wxArrayString result; - const size_t count = GetCount(); + const unsigned int count = GetCount(); result.Alloc(count); - for ( size_t n = 0; n < count; n++ ) + for ( unsigned int n = 0; n < count; n++ ) result.Add(GetString(n)); return result; @@ -94,14 +95,14 @@ wxItemContainer::~wxItemContainer() void wxItemContainer::Append(const wxArrayString& strings) { - size_t count = strings.GetCount(); + const size_t count = strings.GetCount(); for ( size_t n = 0; n < count; n++ ) { Append(strings[n]); } } -int wxItemContainer::Insert(const wxString& item, int pos, void *clientData) +int wxItemContainer::Insert(const wxString& item, unsigned int pos, void *clientData) { int n = DoInsert(item, pos); if ( n != wxNOT_FOUND ) @@ -110,8 +111,7 @@ int wxItemContainer::Insert(const wxString& item, int pos, void *clientData) return n; } -int -wxItemContainer::Insert(const wxString& item, int pos, wxClientData *clientData) +int wxItemContainer::Insert(const wxString& item, unsigned int pos, wxClientData *clientData) { int n = DoInsert(item, pos); if ( n != wxNOT_FOUND ) @@ -124,7 +124,7 @@ wxItemContainer::Insert(const wxString& item, int pos, wxClientData *clientData) // client data // ---------------------------------------------------------------------------- -void wxItemContainer::SetClientObject(int n, wxClientData *data) +void wxItemContainer::SetClientObject(unsigned int n, wxClientData *data) { wxASSERT_MSG( m_clientDataItemsType != wxClientData_Void, wxT("can't have both object and void client data") ); @@ -147,7 +147,7 @@ void wxItemContainer::SetClientObject(int n, wxClientData *data) DoSetItemClientObject(n, data); } -wxClientData *wxItemContainer::GetClientObject(int n) const +wxClientData *wxItemContainer::GetClientObject(unsigned int n) const { wxASSERT_MSG( m_clientDataItemsType == wxClientData_Object, wxT("this window doesn't have object client data") ); @@ -155,7 +155,7 @@ wxClientData *wxItemContainer::GetClientObject(int n) const return DoGetItemClientObject(n); } -void wxItemContainer::SetClientData(int n, void *data) +void wxItemContainer::SetClientData(unsigned int n, void *data) { wxASSERT_MSG( m_clientDataItemsType != wxClientData_Object, wxT("can't have both object and void client data") ); @@ -164,7 +164,7 @@ void wxItemContainer::SetClientData(int n, void *data) m_clientDataItemsType = wxClientData_Void; } -void *wxItemContainer::GetClientData(int n) const +void *wxItemContainer::GetClientData(unsigned int n) const { wxASSERT_MSG( m_clientDataItemsType == wxClientData_Void, wxT("this window doesn't have void client data") ); diff --git a/src/common/lboxcmn.cpp b/src/common/lboxcmn.cpp index 3943d96c4a..02d5c94b81 100644 --- a/src/common/lboxcmn.cpp +++ b/src/common/lboxcmn.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: common/lboxcmn.cpp +// Name: src/common/lboxcmn.cpp // Purpose: wxListBox class methods common to all platforms // Author: Vadim Zeitlin // Modified by: @@ -45,10 +45,10 @@ wxListBoxBase::~wxListBoxBase() // adding items // ---------------------------------------------------------------------------- -void wxListBoxBase::InsertItems(int nItems, const wxString *items, int pos) +void wxListBoxBase::InsertItems(unsigned int nItems, const wxString *items, unsigned int pos) { wxArrayString aItems; - for ( int n = 0; n < nItems; n++ ) + for ( unsigned int n = 0; n < nItems; n++ ) { aItems.Add(items[n]); } diff --git a/src/common/radiocmn.cpp b/src/common/radiocmn.cpp index 0d2851632f..32adee107a 100644 --- a/src/common/radiocmn.cpp +++ b/src/common/radiocmn.cpp @@ -34,7 +34,7 @@ // implementation // ============================================================================ -void wxRadioBoxBase::SetMajorDim(int majorDim, long style) +void wxRadioBoxBase::SetMajorDim(unsigned int majorDim, long style) { wxCHECK_RET( majorDim != 0, _T("major radiobox dimension can't be 0") ); diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index 169e56785b..f74635e4e0 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -101,16 +101,16 @@ void wxCheckListBox::DoCreateCheckList() gtk_tree_view_append_column(m_treeview, column); } -bool wxCheckListBox::IsChecked( int index ) const +bool wxCheckListBox::IsChecked(unsigned int index) const { - wxCHECK_MSG( m_treeview != NULL, FALSE, wxT("invalid checklistbox") ); + wxCHECK_MSG( m_treeview != NULL, false, wxT("invalid checklistbox") ); GtkTreeIter iter; gboolean res = gtk_tree_model_iter_nth_child( GTK_TREE_MODEL(m_liststore), &iter, NULL, //NULL = parent = get first index - ); + ); if(!res) return false; @@ -123,7 +123,7 @@ bool wxCheckListBox::IsChecked( int index ) const return g_value_get_boolean(&value) == TRUE ? true : false; } -void wxCheckListBox::Check( int index, bool check ) +void wxCheckListBox::Check(unsigned int index, bool check) { wxCHECK_RET( m_treeview != NULL, wxT("invalid checklistbox") ); @@ -132,7 +132,7 @@ void wxCheckListBox::Check( int index, bool check ) GTK_TREE_MODEL(m_liststore), &iter, NULL, //NULL = parent = get first index - ); + ); if(!res) return; diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index d1478144eb..011468f47e 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -120,7 +120,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, GtkWidget *menu = gtk_menu_new(); - for (size_t i = 0; i < (size_t)n; i++) + for (unsigned int i = 0; i < (unsigned int)n; i++) { GtkAddHelper(menu, i, choices[i]); } @@ -151,27 +151,27 @@ int wxChoice::DoAppend( const wxString &item ) return GtkAddHelper(menu, GetCount(), item); } -int wxChoice::DoInsert( const wxString &item, int pos ) +int wxChoice::DoInsert(const wxString &item, unsigned int pos) { wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice control") ); wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index")); - if ((size_t)pos == GetCount()) + if (pos == GetCount()) return DoAppend(item); GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ); // if the item to insert is at or before the selection, and the selection is valid - if ((pos <= m_selection_hack) && (m_selection_hack != wxNOT_FOUND)) + if (((int)pos <= m_selection_hack) && (m_selection_hack != wxNOT_FOUND)) { // move the selection forward one m_selection_hack++; } - return GtkAddHelper(menu, (size_t)pos, item); + return GtkAddHelper(menu, pos, item); } -void wxChoice::DoSetItemClientData( int n, void* clientData ) +void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") ); @@ -181,7 +181,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData ) node->SetData( (wxObject*) clientData ); } -void* wxChoice::DoGetItemClientData( int n ) const +void* wxChoice::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") ); @@ -191,7 +191,7 @@ void* wxChoice::DoGetItemClientData( int n ) const return node->GetData(); } -void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") ); @@ -203,7 +203,7 @@ void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) node->SetData( (wxObject*) clientData ); } -wxClientData* wxChoice::DoGetItemClientObject( int n ) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") ); @@ -243,23 +243,23 @@ void wxChoice::Clear() m_selection_hack = wxNOT_FOUND; } -void wxChoice::Delete( int n ) +void wxChoice::Delete(unsigned int n) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice") ); wxCHECK_RET( IsValid(n), _T("invalid index in wxChoice::Delete") ); // VZ: apparently GTK+ doesn't have a built-in function to do it (not even // in 2.0), hence this dumb implementation -- still better than nothing - size_t i; - const size_t count = GetCount(); + unsigned int i; + const unsigned int count = GetCount(); // if the item to delete is before the selection, and the selection is valid - if ((n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND)) + if (((int)n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND)) { // move the selection back one m_selection_hack--; } - else if (n == m_selection_hack) + else if ((int)n == m_selection_hack) { // invalidate the selection m_selection_hack = wxNOT_FOUND; @@ -275,7 +275,7 @@ void wxChoice::Delete( int n ) items.Alloc(count); for ( i = 0; i < count; i++ ) { - if ( i != (size_t)n ) + if ( i != n ) { items.Add(GetString(i)); if ( hasClientData ) @@ -357,12 +357,12 @@ int wxChoice::GetSelection() const } -void wxChoice::SetString( int n, const wxString& str ) +void wxChoice::SetString(unsigned int n, const wxString& str) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice") ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); - int count = 0; + unsigned int count = 0; GList *child = menu_shell->children; while (child) { @@ -386,12 +386,12 @@ void wxChoice::SetString( int n, const wxString& str ) } } -wxString wxChoice::GetString( int n ) const +wxString wxChoice::GetString(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid choice") ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); - int count = 0; + unsigned int count = 0; GList *child = menu_shell->children; while (child) { @@ -417,12 +417,12 @@ wxString wxChoice::GetString( int n ) const return wxEmptyString; } -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid choice") ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); - size_t count = 0; + unsigned int count = 0; GList *child = menu_shell->children; while (child) { @@ -440,7 +440,7 @@ void wxChoice::SetSelection( int n ) gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp ); // set the local selection variable manually - if ((n >= 0) && (n < (int)GetCount())) + if ((n >= 0) && ((unsigned int)n < GetCount())) { // a valid selection has been made m_selection_hack = n; @@ -487,13 +487,13 @@ void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style) #pragma message disable unscomzer #endif -int wxChoice::GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item) +int wxChoice::GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item) { - wxCHECK_MSG((pos>=0) && (pos<=m_clientList.GetCount()), -1, wxT("invalid index")); + wxCHECK_MSG(pos<=m_clientList.GetCount(), -1, wxT("invalid index")); GtkWidget *menu_item = gtk_menu_item_new_with_label( wxGTK_CONV( item ) ); - size_t index; + unsigned int index; if ( m_strings ) { // sorted control, need to insert at the correct index @@ -569,8 +569,8 @@ wxSize wxChoice::DoGetBestSize() const if ( m_widget ) { int width; - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { GetTextExtent( GetString(n), &width, NULL, NULL, NULL ); if ( width > ret.x ) diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 1fa5e3336d..9f631e21d8 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -447,7 +447,7 @@ int wxComboBox::DoAppend( const wxString &item ) EnableEvents(); } - const size_t count = GetCount(); + const unsigned int count = GetCount(); if ( m_clientDataList.GetCount() < count ) m_clientDataList.Append( (wxObject*) NULL ); @@ -459,7 +459,7 @@ int wxComboBox::DoAppend( const wxString &item ) return count - 1; } -int wxComboBox::DoInsert( const wxString &item, int pos ) +int wxComboBox::DoInsert(const wxString &item, unsigned int pos) { wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); @@ -467,9 +467,9 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") ); wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index") ); - size_t count = GetCount(); + unsigned int count = GetCount(); - if ((size_t)pos == count) + if (pos == count) return Append(item); #ifdef __WXGTK24__ @@ -515,7 +515,7 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) return pos; } -void wxComboBox::DoSetItemClientData( int n, void* clientData ) +void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); @@ -525,7 +525,7 @@ void wxComboBox::DoSetItemClientData( int n, void* clientData ) node->SetData( (wxObject*) clientData ); } -void* wxComboBox::DoGetItemClientData( int n ) const +void* wxComboBox::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") ); @@ -534,7 +534,7 @@ void* wxComboBox::DoGetItemClientData( int n ) const return node ? node->GetData() : NULL; } -void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); @@ -546,7 +546,7 @@ void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData ) node->SetData( (wxObject*) clientData ); } -wxClientData* wxComboBox::DoGetItemClientObject( int n ) const +wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") ); @@ -565,8 +565,8 @@ void wxComboBox::Clear() if (!gtk_check_version(2,4,0)) { GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); - const size_t count = GetCount(); - for (size_t i = 0; i < count; i++) + const unsigned int count = GetCount(); + for (unsigned int i = 0; i < count; i++) gtk_combo_box_remove_text( combobox, 0 ); } else // GTK+ < 2.4.0 @@ -592,7 +592,7 @@ void wxComboBox::Clear() InvalidateBestSize(); } -void wxComboBox::Delete( int n ) +void wxComboBox::Delete(unsigned int n) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); @@ -641,7 +641,7 @@ void wxComboBox::Delete( int n ) InvalidateBestSize(); } -void wxComboBox::SetString(int n, const wxString &text) +void wxComboBox::SetString(unsigned int n, const wxString &text) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); @@ -783,7 +783,7 @@ int wxComboBox::GetCurrentSelection() const return -1; } -wxString wxComboBox::GetString( int n ) const +wxString wxComboBox::GetString(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") ); @@ -836,7 +836,7 @@ wxString wxComboBox::GetStringSelection() const int sel = gtk_combo_box_get_active( combobox ); if (sel == -1) return wxEmptyString; - return GetString( sel ); + return GetString(sel); } else #endif @@ -858,7 +858,7 @@ wxString wxComboBox::GetStringSelection() const return wxEmptyString; } -size_t wxComboBox::GetCount() const +unsigned int wxComboBox::GetCount() const { wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") ); @@ -871,7 +871,7 @@ size_t wxComboBox::GetCount() const gtk_tree_model_get_iter_first( model, &iter ); if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter )) return 0; - size_t ret = 1; + unsigned int ret = 1; while (gtk_tree_model_iter_next( model, &iter )) ret++; return ret; @@ -882,8 +882,12 @@ size_t wxComboBox::GetCount() const GtkWidget *list = GTK_COMBO(m_widget)->list; GList *child = GTK_LIST(list)->children; - size_t count = 0; - while (child) { count++; child = child->next; } + unsigned int count = 0; + while (child) + { + count++; + child = child->next; + } return count; } @@ -1347,10 +1351,10 @@ wxSize wxComboBox::DoGetBestSize() const if ( m_widget ) { int width; - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { - GetTextExtent( GetString(n), &width, NULL, NULL, NULL ); + GetTextExtent(GetString(n), &width, NULL, NULL, NULL ); if ( width > ret.x ) ret.x = width; } diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index cd8381475d..f3c5f07d2e 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -591,7 +591,7 @@ wxListBox::~wxListBox() // ---------------------------------------------------------------------------- void wxListBox::GtkInsertItems(const wxArrayString& items, - void** clientData, size_t pos) + void** clientData, unsigned int pos) { wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); @@ -599,8 +599,8 @@ void wxListBox::GtkInsertItems(const wxArrayString& items, // Create and set column ids and GValues - size_t nNum = items.GetCount(); - size_t nCurCount = wxListBox::GetCount(); + unsigned int nNum = items.GetCount(); + unsigned int nCurCount = wxListBox::GetCount(); wxASSERT_MSG(pos <= nCurCount, wxT("Invalid index passed to wxListBox")); GtkTreeIter* pIter = NULL; // append by default @@ -620,7 +620,7 @@ void wxListBox::GtkInsertItems(const wxArrayString& items, pIter = &iter; } - for (size_t i = 0; i < nNum; ++i) + for (unsigned int i = 0; i < nNum; ++i) { wxString label = items[i]; @@ -660,17 +660,17 @@ void wxListBox::GtkInsertItems(const wxArrayString& items, } } -void wxListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxCHECK_RET( IsValidInsert(pos), wxT("invalid index in wxListBox::InsertItems") ); - GtkInsertItems(items, NULL, (size_t)pos); + GtkInsertItems(items, NULL, pos); } int wxListBox::DoAppend( const wxString& item ) { // Call DoInsertItems - int nWhere = (int)wxListBox::GetCount(); + unsigned int nWhere = wxListBox::GetCount(); wxArrayString aItems; aItems.Add(item); wxListBox::DoInsertItems(aItems, nWhere); @@ -697,7 +697,7 @@ void wxListBox::Clear() gtk_list_store_clear( m_liststore ); /* well, THAT was easy :) */ } -void wxListBox::Delete( int n ) +void wxListBox::Delete(unsigned int n) { wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); @@ -708,7 +708,7 @@ void wxListBox::Delete( int n ) GTK_TREE_MODEL(m_liststore), &iter, NULL, //NULL = parent = get first n - ); + ); wxCHECK_RET( res, wxT("wrong listbox index") ); @@ -749,9 +749,9 @@ struct _GtkTreeEntry* wxListBox::GtkGetEntry(int n) const // client data // ---------------------------------------------------------------------------- -void* wxListBox::DoGetItemClientData( int n ) const +void* wxListBox::DoGetItemClientData(unsigned int n) const { - wxCHECK_MSG( n >= 0 && (size_t)n < wxListBox::GetCount(), NULL, + wxCHECK_MSG( IsValid(n), NULL, wxT("Invalid index passed to GetItemClientData") ); GtkTreeEntry* entry = GtkGetEntry(n); @@ -762,14 +762,14 @@ void* wxListBox::DoGetItemClientData( int n ) const return userdata; } -wxClientData* wxListBox::DoGetItemClientObject( int n ) const +wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const { return (wxClientData*) wxListBox::DoGetItemClientData(n); } -void wxListBox::DoSetItemClientData( int n, void* clientData ) +void wxListBox::DoSetItemClientData(unsigned int n, void* clientData) { - wxCHECK_RET( n >= 0 && (size_t)n < wxListBox::GetCount(), + wxCHECK_RET( IsValid(n), wxT("Invalid index passed to SetItemClientData") ); GtkTreeEntry* entry = GtkGetEntry(n); @@ -779,7 +779,7 @@ void wxListBox::DoSetItemClientData( int n, void* clientData ) g_object_unref(G_OBJECT(entry)); } -void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { // wxItemContainer already deletes data for us wxListBox::DoSetItemClientData(n, (void*) clientData); @@ -789,7 +789,7 @@ void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData ) // string list access // ---------------------------------------------------------------------------- -void wxListBox::SetString( int n, const wxString &string ) +void wxListBox::SetString(unsigned int n, const wxString &string) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetString") ); wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); @@ -816,12 +816,12 @@ void wxListBox::SetString( int n, const wxString &string ) wxArrayString aItems; aItems.Add(label); - GtkInsertItems(aItems, &userdata, (size_t)n); + GtkInsertItems(aItems, &userdata, n); if (bWasSelected) wxListBox::GtkSetSelection(n, true, true); } -wxString wxListBox::GetString( int n ) const +wxString wxListBox::GetString(unsigned int n) const { wxCHECK_MSG( m_treeview != NULL, wxEmptyString, wxT("invalid listbox") ); @@ -842,11 +842,11 @@ wxString wxListBox::GetString( int n ) const return label; } -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { wxCHECK_MSG( m_treeview != NULL, 0, wxT("invalid listbox") ); - return (size_t)gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_liststore), NULL); + return (unsigned int)gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_liststore), NULL); } int wxListBox::FindString( const wxString &item, bool bCase ) const @@ -854,9 +854,9 @@ int wxListBox::FindString( const wxString &item, bool bCase ) const wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") ); //Sort of hackish - maybe there is a faster way - size_t nCount = wxListBox::GetCount(); + unsigned int nCount = wxListBox::GetCount(); - for(size_t i = 0; i < nCount; ++i) + for(unsigned int i = 0; i < nCount; ++i) { if( item.IsSameAs( wxListBox::GetString(i), bCase ) ) return (int)i; @@ -1095,13 +1095,13 @@ wxSize wxListBox::DoGetBestSize() const // Get the visible area of the tree view (limit to the 10th item // so that it isn't too big) - size_t count = GetCount(); + unsigned int count = GetCount(); if (count) { int wLine; // Find the widest line - for(size_t i = 0; i < count; i++) { + for(unsigned int i = 0; i < count; i++) { wxString str(GetString(i)); GetTextExtent(str, &wLine, NULL); lbWidth = wxMax(lbWidth, wLine); @@ -1119,8 +1119,8 @@ wxSize wxListBox::DoGetBestSize() const } #endif - // don't make the listbox too tall (limit height to around 10 items) but don't - // make it too small neither + // don't make the listbox too tall (limit height to around 10 items) but don't + // make it too small neither lbHeight = (cy+4) * wxMin(wxMax(count, 3), 10); } diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 1e903f7fdd..07394f9b9e 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -213,8 +213,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, SetMajorDim(majorDim == 0 ? n : majorDim, style); - int num_of_cols = GetColumnCount(); - int num_of_rows = GetRowCount(); + unsigned int num_of_cols = GetColumnCount(); + unsigned int num_of_rows = GetRowCount(); GtkRadioButton *m_radio = (GtkRadioButton*) NULL; @@ -226,7 +226,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, wxString label; GSList *radio_button_group = (GSList *) NULL; - for (int i = 0; i < n; i++) + for (unsigned int i = 0; i < n; i++) { if ( i != 0 ) radio_button_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON(m_radio) ); @@ -381,7 +381,7 @@ int wxRadioBox::GetSelection(void) const return wxNOT_FOUND; } -wxString wxRadioBox::GetString( int n ) const +wxString wxRadioBox::GetString(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid radiobox") ); @@ -403,7 +403,7 @@ void wxRadioBox::SetLabel( const wxString& label ) GTKSetLabelForFrame(GTK_FRAME(m_widget), label); } -void wxRadioBox::SetString( int item, const wxString& label ) +void wxRadioBox::SetString(unsigned int item, const wxString& label) { wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") ); @@ -435,7 +435,7 @@ bool wxRadioBox::Enable( bool enable ) return true; } -bool wxRadioBox::Enable( int item, bool enable ) +bool wxRadioBox::Enable(unsigned int item, bool enable) { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -452,7 +452,7 @@ bool wxRadioBox::Enable( int item, bool enable ) return true; } -bool wxRadioBox::IsItemEnabled(int item) const +bool wxRadioBox::IsItemEnabled(unsigned int item) const { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -467,7 +467,7 @@ bool wxRadioBox::IsItemEnabled(int item) const return GTK_WIDGET_SENSITIVE(GTK_WIDGET(button)); } -bool wxRadioBox::Show( int item, bool show ) +bool wxRadioBox::Show(unsigned int item, bool show) { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -485,7 +485,7 @@ bool wxRadioBox::Show( int item, bool show ) return true; } -bool wxRadioBox::IsItemShown(int item) const +bool wxRadioBox::IsItemShown(unsigned int item) const { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -498,7 +498,7 @@ bool wxRadioBox::IsItemShown(int item) const return GTK_WIDGET_VISIBLE(GTK_WIDGET(button)); } -size_t wxRadioBox::GetCount() const +unsigned int wxRadioBox::GetCount() const { return m_boxes.GetCount(); } diff --git a/src/gtk1/checklst.cpp b/src/gtk1/checklst.cpp index 9ca0fc0b7a..cb46643608 100644 --- a/src/gtk1/checklst.cpp +++ b/src/gtk1/checklst.cpp @@ -55,7 +55,7 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, style, validator, name ); } -bool wxCheckListBox::IsChecked( int index ) const +bool wxCheckListBox::IsChecked(unsigned int index) const { wxCHECK_MSG( m_list != NULL, false, wxT("invalid checklistbox") ); @@ -74,7 +74,7 @@ bool wxCheckListBox::IsChecked( int index ) const return false; } -void wxCheckListBox::Check( int index, bool check ) +void wxCheckListBox::Check(unsigned int index, bool check ) { wxCHECK_RET( m_list != NULL, wxT("invalid checklistbox") ); diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 0912181bcc..80300657bb 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -133,7 +133,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, GtkWidget *menu = gtk_menu_new(); - for (size_t i = 0; i < (size_t)n; i++) + for (unsigned int i = 0; i < n; i++) { GtkAddHelper(menu, i, choices[i]); } @@ -164,27 +164,27 @@ int wxChoice::DoAppend( const wxString &item ) return GtkAddHelper(menu, GetCount(), item); } -int wxChoice::DoInsert( const wxString &item, int pos ) +int wxChoice::DoInsert( const wxString &item, unsigned int pos ) { wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice control") ); wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index")); - if ((size_t)pos == GetCount()) + if (pos == GetCount()) return DoAppend(item); GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ); // if the item to insert is at or before the selection, and the selection is valid - if ((pos <= m_selection_hack) && (m_selection_hack != wxNOT_FOUND)) + if (((int)pos <= m_selection_hack) && (m_selection_hack != wxNOT_FOUND)) { // move the selection forward one m_selection_hack++; } - return GtkAddHelper(menu, (size_t)pos, item); + return GtkAddHelper(menu, pos, item); } -void wxChoice::DoSetItemClientData( int n, void* clientData ) +void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") ); @@ -194,7 +194,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData ) node->SetData( (wxObject*) clientData ); } -void* wxChoice::DoGetItemClientData( int n ) const +void* wxChoice::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") ); @@ -204,7 +204,7 @@ void* wxChoice::DoGetItemClientData( int n ) const return node->GetData(); } -void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") ); @@ -216,7 +216,7 @@ void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) node->SetData( (wxObject*) clientData ); } -wxClientData* wxChoice::DoGetItemClientObject( int n ) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") ); @@ -256,24 +256,24 @@ void wxChoice::Clear() m_selection_hack = wxNOT_FOUND; } -void wxChoice::Delete( int n ) +void wxChoice::Delete(unsigned int n) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice") ); // VZ: apparently GTK+ doesn't have a built-in function to do it (not even // in 2.0), hence this dumb implementation -- still better than nothing - int i; - size_t count = GetCount(); + unsigned int i; + unsigned int count = GetCount(); wxCHECK_RET( IsValid(n), _T("invalid index in wxChoice::Delete") ); // if the item to delete is before the selection, and the selection is valid - if ((n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND)) + if (((int)n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND)) { // move the selection back one m_selection_hack--; } - else if (n == m_selection_hack) + else if ((int)n == m_selection_hack) { // invalidate the selection m_selection_hack = wxNOT_FOUND; @@ -287,7 +287,7 @@ void wxChoice::Delete( int n ) wxArrayString items; wxArrayPtrVoid itemsData; items.Alloc(count); - for ( i = 0; (size_t)i < count; i++ ) + for ( i = 0; i < count; i++ ) { if ( i != n ) { @@ -320,7 +320,7 @@ void wxChoice::Delete( int n ) Clear(); - for ( i = 0; (size_t)i < count - 1; i++ ) + for ( i = 0; i < count - 1; i++ ) { Append(items[i]); @@ -372,12 +372,12 @@ int wxChoice::GetSelection() const } -void wxChoice::SetString( int n, const wxString& str ) +void wxChoice::SetString(unsigned int n, const wxString& str ) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice") ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); - int count = 0; + unsigned int count = 0; GList *child = menu_shell->children; while (child) { @@ -401,12 +401,12 @@ void wxChoice::SetString( int n, const wxString& str ) } } -wxString wxChoice::GetString( int n ) const +wxString wxChoice::GetString(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid choice") ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); - int count = 0; + unsigned int count = 0; GList *child = menu_shell->children; while (child) { @@ -432,12 +432,12 @@ wxString wxChoice::GetString( int n ) const return wxEmptyString; } -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid choice") ); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); - size_t count = 0; + unsigned int count = 0; GList *child = menu_shell->children; while (child) { @@ -455,7 +455,7 @@ void wxChoice::SetSelection( int n ) gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp ); // set the local selection variable manually - if ((n >= 0) && ((size_t)n < GetCount())) + if (IsValid((unsigned int)n)) { // a valid selection has been made m_selection_hack = n; @@ -498,7 +498,7 @@ void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style) } } -int wxChoice::GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item) +int wxChoice::GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item) { wxCHECK_MSG(pos<=m_clientList.GetCount(), -1, wxT("invalid index")); @@ -575,10 +575,10 @@ wxSize wxChoice::DoGetBestSize() const if ( m_widget ) { int width; - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { - GetTextExtent( GetString(n), &width, NULL, NULL, NULL ); + GetTextExtent(GetString(n), &width, NULL, NULL, NULL ); if ( width > ret.x ) ret.x = width; } diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index aa879cab6f..38ddd035fa 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -347,7 +347,7 @@ int wxComboBox::DoAppend( const wxString &item ) gtk_widget_show( list_item ); - const size_t count = GetCount(); + const unsigned int count = GetCount(); if ( m_clientDataList.GetCount() < count ) m_clientDataList.Append( (wxObject*) NULL ); @@ -361,7 +361,7 @@ int wxComboBox::DoAppend( const wxString &item ) return count - 1; } -int wxComboBox::DoInsert( const wxString &item, int pos ) +int wxComboBox::DoInsert( const wxString &item, unsigned int pos ) { wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); @@ -370,7 +370,7 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index") ); - if ((size_t)pos == GetCount()) + if (pos == GetCount()) return Append(item); DisableEvents(); @@ -393,7 +393,7 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) gtk_widget_show( list_item ); - const size_t count = GetCount(); + const unsigned int count = GetCount(); if ( m_clientDataList.GetCount() < count ) m_clientDataList.Insert( pos, (wxObject*) NULL ); @@ -407,7 +407,7 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) return pos; } -void wxComboBox::DoSetItemClientData( int n, void* clientData ) +void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); @@ -417,7 +417,7 @@ void wxComboBox::DoSetItemClientData( int n, void* clientData ) node->SetData( (wxObject*) clientData ); } -void* wxComboBox::DoGetItemClientData( int n ) const +void* wxComboBox::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") ); @@ -426,7 +426,7 @@ void* wxComboBox::DoGetItemClientData( int n ) const return node ? node->GetData() : NULL; } -void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); @@ -438,7 +438,7 @@ void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData ) node->SetData( (wxObject*) clientData ); } -wxClientData* wxComboBox::DoGetItemClientObject( int n ) const +wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") ); @@ -472,7 +472,7 @@ void wxComboBox::Clear() InvalidateBestSize(); } -void wxComboBox::Delete( int n ) +void wxComboBox::Delete(unsigned int n) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); @@ -509,7 +509,7 @@ void wxComboBox::Delete( int n ) InvalidateBestSize(); } -void wxComboBox::SetString(int n, const wxString &text) +void wxComboBox::SetString(unsigned int n, const wxString &text) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); @@ -583,7 +583,7 @@ int wxComboBox::GetCurrentSelection() const return wxNOT_FOUND; } -wxString wxComboBox::GetString( int n ) const +wxString wxComboBox::GetString(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") ); @@ -625,14 +625,14 @@ wxString wxComboBox::GetStringSelection() const return wxEmptyString; } -size_t wxComboBox::GetCount() const +unsigned int wxComboBox::GetCount() const { wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") ); GtkWidget *list = GTK_COMBO(m_widget)->list; GList *child = GTK_LIST(list)->children; - size_t count = 0; + unsigned int count = 0; while (child) { count++; child = child->next; } return count; } @@ -929,10 +929,10 @@ wxSize wxComboBox::DoGetBestSize() const if ( m_widget ) { int width; - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { - GetTextExtent( GetString(n), &width, NULL, NULL, NULL ); + GetTextExtent(GetString(n), &width, NULL, NULL, NULL ); if ( width > ret.x ) ret.x = width; } diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index f22c1ad797..260122e33c 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -573,7 +573,7 @@ wxListBox::~wxListBox() // adding items // ---------------------------------------------------------------------------- -void wxListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxCHECK_RET( m_list != NULL, wxT("invalid listbox") ); @@ -593,12 +593,12 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos) wxCHECK_RET( pos <= length, wxT("invalid index in wxListBox::InsertItems") ); - size_t nItems = items.GetCount(); + unsigned int nItems = items.GetCount(); int index; if (m_strings) { - for (size_t n = 0; n < nItems; n++) + for (unsigned int n = 0; n < nItems; n++) { index = m_strings->Add( items[n] ); @@ -619,7 +619,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos) { if (pos == length) { - for ( size_t n = 0; n < nItems; n++ ) + for ( unsigned int n = 0; n < nItems; n++ ) { GtkAddItem( items[n] ); @@ -629,7 +629,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos) else { wxList::compatibility_iterator node = m_clientList.Item( pos ); - for ( size_t n = 0; n < nItems; n++ ) + for ( unsigned int n = 0; n < nItems; n++ ) { GtkAddItem( items[n], pos+n ); @@ -757,8 +757,8 @@ void wxListBox::DoSetItems( const wxArrayString& items, if ( clientData ) { - size_t count = items.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = items.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { SetClientData(n, clientData[n]); } @@ -799,7 +799,7 @@ void wxListBox::Clear() m_strings->Clear(); } -void wxListBox::Delete( int n ) +void wxListBox::Delete(unsigned int n) { wxCHECK_RET( m_list != NULL, wxT("invalid listbox") ); @@ -831,7 +831,7 @@ void wxListBox::Delete( int n ) // client data // ---------------------------------------------------------------------------- -void wxListBox::DoSetItemClientData( int n, void* clientData ) +void wxListBox::DoSetItemClientData(unsigned int n, void* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") ); @@ -841,7 +841,7 @@ void wxListBox::DoSetItemClientData( int n, void* clientData ) node->SetData( (wxObject*) clientData ); } -void* wxListBox::DoGetItemClientData( int n ) const +void* wxListBox::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") ); @@ -851,7 +851,7 @@ void* wxListBox::DoGetItemClientData( int n ) const return node->GetData(); } -void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") ); @@ -863,7 +863,7 @@ void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData ) node->SetData( (wxObject*) clientData ); } -wxClientData* wxListBox::DoGetItemClientObject( int n ) const +wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") ); @@ -898,7 +898,7 @@ wxString wxListBox::GetRealLabel(GList *item) const return str; } -void wxListBox::SetString( int n, const wxString &string ) +void wxListBox::SetString(unsigned int n, const wxString &string) { wxCHECK_RET( m_list != NULL, wxT("invalid listbox") ); @@ -923,7 +923,7 @@ void wxListBox::SetString( int n, const wxString &string ) } } -wxString wxListBox::GetString( int n ) const +wxString wxListBox::GetString(unsigned int n) const { wxCHECK_MSG( m_list != NULL, wxEmptyString, wxT("invalid listbox") ); @@ -938,7 +938,7 @@ wxString wxListBox::GetString( int n ) const return wxEmptyString; } -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { wxCHECK_MSG( m_list != NULL, 0, wxT("invalid listbox") ); @@ -1216,7 +1216,7 @@ wxSize wxListBox::DoGetBestSize() const int wLine; // Find the widest line - for(size_t i = 0; i < GetCount(); i++) { + for(unsigned int i = 0; i < GetCount(); i++) { wxString str(GetString(i)); GetTextExtent(str, &wLine, NULL); lbWidth = wxMax(lbWidth, wLine); diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 066daa51af..8b980c12f7 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -206,8 +206,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, SetMajorDim(majorDim == 0 ? n : majorDim, style); - int num_of_cols = GetColumnCount(); - int num_of_rows = GetRowCount(); + unsigned int num_of_cols = GetColumnCount(); + unsigned int num_of_rows = GetRowCount(); GtkRadioButton *m_radio = (GtkRadioButton*) NULL; @@ -290,7 +290,7 @@ wxRadioBox::~wxRadioBox() } } -bool wxRadioBox::Show( bool show ) +bool wxRadioBox::Show(bool show) { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -375,7 +375,7 @@ int wxRadioBox::GetSelection(void) const return wxNOT_FOUND; } -wxString wxRadioBox::GetString( int n ) const +wxString wxRadioBox::GetString(unsigned int n) const { wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid radiobox") ); @@ -397,7 +397,7 @@ void wxRadioBox::SetLabel( const wxString& label ) GTKSetLabelForFrame(GTK_FRAME(m_widget), label); } -void wxRadioBox::SetString( int item, const wxString& label ) +void wxRadioBox::SetString(unsigned int item, const wxString& label) { wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") ); @@ -429,7 +429,7 @@ bool wxRadioBox::Enable( bool enable ) return true; } -bool wxRadioBox::Enable( int item, bool enable ) +bool wxRadioBox::Enable(unsigned int item, bool enable) { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -446,7 +446,7 @@ bool wxRadioBox::Enable( int item, bool enable ) return true; } -bool wxRadioBox::IsItemEnabled(int item) const +bool wxRadioBox::IsItemEnabled(unsigned int item) const { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -461,7 +461,7 @@ bool wxRadioBox::IsItemEnabled(int item) const return GTK_WIDGET_SENSITIVE(GTK_WIDGET(button)); } -bool wxRadioBox::Show( int item, bool show ) +bool wxRadioBox::Show(unsigned int item, bool show) { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -479,7 +479,7 @@ bool wxRadioBox::Show( int item, bool show ) return true; } -bool wxRadioBox::IsItemShown(int item) const +bool wxRadioBox::IsItemShown(unsigned int item) const { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); @@ -492,7 +492,7 @@ bool wxRadioBox::IsItemShown(int item) const return GTK_WIDGET_VISIBLE(GTK_WIDGET(button)); } -size_t wxRadioBox::GetCount() const +unsigned int wxRadioBox::GetCount() const { return m_boxes.GetCount(); } diff --git a/src/mac/carbon/checklst.cpp b/src/mac/carbon/checklst.cpp index ddff65a4a3..9930e5773c 100644 --- a/src/mac/carbon/checklst.cpp +++ b/src/mac/carbon/checklst.cpp @@ -153,7 +153,7 @@ static pascal OSStatus ListBoxGetSetItemData( int i = itemID - 1; if ((i >= 0) && (i < (int)list->GetCount())) { - verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData, list->IsChecked( i ) ? kThemeButtonOn : kThemeButtonOff ) ); + verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData, list->IsChecked(i) ? kThemeButtonOn : kThemeButtonOff ) ); err = noErr; } } @@ -184,7 +184,7 @@ static pascal OSStatus ListBoxGetSetItemData( if ((i >= 0) && (i < (int)list->GetCount())) { // we have to change this behind the back, since Check() would be triggering another update round - bool newVal = !list->IsChecked( i ); + bool newVal = !list->IsChecked(i); verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff ) ); err = noErr; list->m_checks[i] = newVal; @@ -336,17 +336,17 @@ bool wxCheckListBox::Create( // wxCheckListBox functions // ---------------------------------------------------------------------------- -bool wxCheckListBox::IsChecked(size_t item) const +bool wxCheckListBox::IsChecked(unsigned int item) const { - wxCHECK_MSG( item < m_checks.GetCount(), false, + wxCHECK_MSG( IsValid(item), false, wxT("invalid index in wxCheckListBox::IsChecked") ); return m_checks[item] != 0; } -void wxCheckListBox::Check(size_t item, bool check) +void wxCheckListBox::Check(unsigned int item, bool check) { - wxCHECK_RET( item < m_checks.GetCount(), + wxCHECK_RET( IsValid(item), wxT("invalid index in wxCheckListBox::Check") ); bool isChecked = m_checks[item] != 0; @@ -365,9 +365,9 @@ void wxCheckListBox::Check(size_t item, bool check) // methods forwarded to wxCheckListBox // ---------------------------------------------------------------------------- -void wxCheckListBox::Delete(int n) +void wxCheckListBox::Delete(unsigned int n) { - wxCHECK_RET( (size_t)n < GetCount(), wxT("invalid index in wxCheckListBox::Delete") ); + wxCHECK_RET( IsValid(n), wxT("invalid index in wxCheckListBox::Delete") ); wxListBox::Delete( n ); m_checks.RemoveAt( n ); @@ -383,12 +383,12 @@ int wxCheckListBox::DoAppend(const wxString& item) return pos; } -void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxCheckListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxListBox::DoInsertItems( items, pos ); - size_t count = items.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = items.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_checks.Insert( false, pos + n ); } @@ -399,8 +399,8 @@ void wxCheckListBox::DoSetItems(const wxArrayString& items, void **clientData) // call it first as it does DoClear() wxListBox::DoSetItems( items, clientData ); - size_t count = items.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = items.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_checks.Add( false ); } diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index 531ac02dee..d5575233dc 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -26,7 +26,7 @@ wxChoice::~wxChoice() { if ( HasClientObjectData() ) { - size_t i, max = GetCount(); + unsigned int i, max = GetCount(); for ( i = 0; i < max; ++i ) delete GetClientObject( i ); @@ -108,7 +108,7 @@ int wxChoice::DoAppend( const wxString& item ) { #if wxUSE_STL wxArrayString::iterator insertPoint; - size_t index; + unsigned int index; if (GetWindowStyle() & wxCB_SORT) { @@ -123,7 +123,7 @@ int wxChoice::DoAppend( const wxString& item ) m_strings.insert( insertPoint, item ); #else - size_t index = m_strings.Add( item ); + unsigned int index = m_strings.Add( item ); #endif m_datas.Insert( NULL , index ); @@ -134,12 +134,12 @@ int wxChoice::DoAppend( const wxString& item ) return index; } -int wxChoice::DoInsert( const wxString& item, int pos ) +int wxChoice::DoInsert( const wxString& item, unsigned int pos ) { wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1, wxT("wxChoice::DoInsert: can't insert into sorted list") ); wxCHECK_MSG( IsValidInsert(pos), -1, wxT("wxChoice::DoInsert: invalid index") ); - if ((size_t)pos == GetCount()) + if (pos == GetCount()) return DoAppend( item ); UMAInsertMenuItem( MAC_WXHMENU( m_macPopUpMenuHandle ), item, m_font.GetEncoding(), pos ); @@ -151,7 +151,7 @@ int wxChoice::DoInsert( const wxString& item, int pos ) return pos; } -void wxChoice::Delete( int n ) +void wxChoice::Delete(unsigned int n) { wxCHECK_RET( IsValid(n) , wxT("wxChoice::Delete: invalid index") ); @@ -167,7 +167,7 @@ void wxChoice::Delete( int n ) void wxChoice::Clear() { FreeData(); - for ( size_t i = 0 ; i < GetCount() ; i++ ) + for ( unsigned int i = 0 ; i < GetCount() ; i++ ) { ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ; } @@ -181,8 +181,8 @@ void wxChoice::FreeData() { if ( HasClientObjectData() ) { - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { delete GetClientObject( n ); } @@ -206,7 +206,7 @@ void wxChoice::SetSelection( int n ) // string list functions // ---------------------------------------------------------------------------- -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { return m_strings.GetCount() ; } @@ -216,7 +216,7 @@ int wxChoice::FindString( const wxString& s, bool bCase ) const return m_strings.Index( s , bCase ) ; } -void wxChoice::SetString( int n, const wxString& s ) +void wxChoice::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid(n), wxT("wxChoice::SetString(): invalid index") ); @@ -226,7 +226,7 @@ void wxChoice::SetString( int n, const wxString& s ) UMASetMenuItemText( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1 , s , wxFont::GetDefaultEncoding() ) ; } -wxString wxChoice::GetString( int n ) const +wxString wxChoice::GetString(unsigned int n) const { wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("wxChoice::GetString(): invalid index") ); @@ -236,26 +236,26 @@ wxString wxChoice::GetString( int n ) const // ---------------------------------------------------------------------------- // client data // ---------------------------------------------------------------------------- -void wxChoice::DoSetItemClientData( int n, void* clientData ) +void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) { wxCHECK_RET( IsValid(n), wxT("wxChoice::DoSetItemClientData: invalid index") ); m_datas[n] = (char*)clientData ; } -void * wxChoice::DoGetItemClientData( int n ) const +void * wxChoice::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( IsValid(n), NULL, wxT("wxChoice::DoGetClientData: invalid index") ); return (void *)m_datas[n]; } -void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { - DoSetItemClientData( n, clientData ) ; + DoSetItemClientData(n, clientData); } -wxClientData* wxChoice::DoGetItemClientObject( int n ) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { return (wxClientData*)DoGetItemClientData( n ) ; } @@ -312,9 +312,9 @@ wxSize wxChoice::DoGetBestSize() const } // Find the widest line - for(size_t i = 0; i < GetCount(); i++) + for(unsigned int i = 0; i < GetCount(); i++) { - wxString str( GetString( i ) ); + wxString str(GetString(i)); #if wxUSE_UNICODE Point bounds = { 0, 0 } ; diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 754b1ea500..38ff2771cb 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -410,7 +410,7 @@ wxString wxComboBox::GetValue() const return result; } -size_t wxComboBox::GetCount() const +unsigned int wxComboBox::GetCount() const { return m_choice->GetCount() ; } @@ -506,27 +506,27 @@ int wxComboBox::DoAppend(const wxString& item) return m_choice->DoAppend( item ) ; } -int wxComboBox::DoInsert(const wxString& item, int pos) +int wxComboBox::DoInsert(const wxString& item, unsigned int pos) { return m_choice->DoInsert( item , pos ) ; } -void wxComboBox::DoSetItemClientData(int n, void* clientData) +void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) { return m_choice->DoSetItemClientData( n , clientData ) ; } -void* wxComboBox::DoGetItemClientData(int n) const +void* wxComboBox::DoGetItemClientData(unsigned int n) const { return m_choice->DoGetItemClientData( n ) ; } -void wxComboBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { - return m_choice->DoSetItemClientObject( n , clientData ) ; + return m_choice->DoSetItemClientObject(n, clientData); } -wxClientData* wxComboBox::DoGetItemClientObject(int n) const +wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const { return m_choice->DoGetItemClientObject( n ) ; } @@ -535,15 +535,15 @@ void wxComboBox::FreeData() { if ( HasClientObjectData() ) { - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { SetClientObject( n, NULL ); } } } -void wxComboBox::Delete(int n) +void wxComboBox::Delete(unsigned int n) { // force client object deletion if( HasClientObjectData() ) @@ -567,7 +567,7 @@ void wxComboBox::SetSelection(int n) m_choice->SetSelection( n ); if ( m_text != NULL ) - m_text->SetValue( GetString( n ) ); + m_text->SetValue(GetString(n)); } int wxComboBox::FindString(const wxString& s, bool bCase) const @@ -575,7 +575,7 @@ int wxComboBox::FindString(const wxString& s, bool bCase) const return m_choice->FindString( s, bCase ); } -wxString wxComboBox::GetString(int n) const +wxString wxComboBox::GetString(unsigned int n) const { return m_choice->GetString( n ); } @@ -583,15 +583,15 @@ wxString wxComboBox::GetString(int n) const wxString wxComboBox::GetStringSelection() const { int sel = GetSelection(); - if (sel > -1) - return wxString(this->GetString (sel)); + if (sel != wxNOT_FOUND) + return wxString(this->GetString((unsigned int)sel)); else return wxEmptyString; } -void wxComboBox::SetString(int n, const wxString& s) +void wxComboBox::SetString(unsigned int n, const wxString& s) { - m_choice->SetString( n , s ) ; + m_choice->SetString( n , s ); } bool wxComboBox::IsEditable() const diff --git a/src/mac/carbon/combobxc.cpp b/src/mac/carbon/combobxc.cpp index abb642fcde..21d3953922 100644 --- a/src/mac/carbon/combobxc.cpp +++ b/src/mac/carbon/combobxc.cpp @@ -561,7 +561,7 @@ int wxComboBox::DoAppend(const wxString& item) #endif } -int wxComboBox::DoInsert(const wxString& item, int pos) +int wxComboBox::DoInsert(const wxString& item, unsigned int pos) { #if USE_HICOMBOBOX HIComboBoxInsertTextItemAtIndex( *m_peer, (CFIndex)pos, wxMacCFStringHolder(item, m_font.GetEncoding()) ); @@ -574,7 +574,7 @@ int wxComboBox::DoInsert(const wxString& item, int pos) #endif } -void wxComboBox::DoSetItemClientData(int n, void* clientData) +void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) { #if USE_HICOMBOBOX return; //TODO @@ -583,7 +583,7 @@ void wxComboBox::DoSetItemClientData(int n, void* clientData) #endif } -void* wxComboBox::DoGetItemClientData(int n) const +void* wxComboBox::DoGetItemClientData(unsigned int n) const { #if USE_HICOMBOBOX return NULL; //TODO @@ -592,7 +592,7 @@ void* wxComboBox::DoGetItemClientData(int n) const #endif } -void wxComboBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { #if USE_HICOMBOBOX return; //TODO @@ -601,7 +601,7 @@ void wxComboBox::DoSetItemClientObject(int n, wxClientData* clientData) #endif } -wxClientData* wxComboBox::DoGetItemClientObject(int n) const +wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const { #if USE_HICOMBOBOX return NULL; @@ -612,25 +612,25 @@ wxClientData* wxComboBox::DoGetItemClientObject(int n) const void wxComboBox::FreeData() { - if ( HasClientObjectData() ) + if (HasClientObjectData()) { - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { SetClientObject( n, NULL ); } } } -int wxComboBox::GetCount() const { +unsigned int wxComboBox::GetCount() const { #if USE_HICOMBOBOX - return (int) HIComboBoxGetItemCount( *m_peer ); + return (unsigned int) HIComboBoxGetItemCount( *m_peer ); #else return m_choice->GetCount() ; #endif } -void wxComboBox::Delete(int n) +void wxComboBox::Delete(unsigned int n) { #if USE_HICOMBOBOX HIComboBoxRemoveItemAtIndex( *m_peer, (CFIndex)n ); @@ -672,7 +672,7 @@ void wxComboBox::SetSelection(int n) if ( m_text != NULL ) { - m_text->SetValue( GetString( n ) ); + m_text->SetValue(GetString(n)); } #endif } @@ -680,9 +680,9 @@ void wxComboBox::SetSelection(int n) int wxComboBox::FindString(const wxString& s, bool bCase) const { #if USE_HICOMBOBOX - for( int i = 0 ; i < GetCount() ; i++ ) + for( unsigned int i = 0 ; i < GetCount() ; i++ ) { - if ( GetString( i ).IsSameAs(s, bCase) ) + if (GetString(i).IsSameAs(s, bCase) ) return i ; } return wxNOT_FOUND ; @@ -691,7 +691,7 @@ int wxComboBox::FindString(const wxString& s, bool bCase) const #endif } -wxString wxComboBox::GetString(int n) const +wxString wxComboBox::GetString(unsigned int n) const { #if USE_HICOMBOBOX CFStringRef itemText; @@ -708,14 +708,14 @@ wxString wxComboBox::GetStringSelection() const return wxMacCFStringHolder(m_peer->GetData(kHIComboBoxEditTextPart,kControlEditTextCFStringTag)).AsString() ; #else int sel = GetSelection (); - if (sel > -1) - return wxString(this->GetString (sel)); + if (sel != wxNOT_FOUND) + return wxString(this->GetString((unsigned int)sel)); else return wxEmptyString; #endif } -void wxComboBox::SetString(int n, const wxString& s) +void wxComboBox::SetString(unsigned int n, const wxString& s) { #if USE_HICOMBOBOX verify_noerr ( HIComboBoxInsertTextItemAtIndex( *m_peer, (CFIndex) n, diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 93701b90f8..ca7866655a 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -326,7 +326,7 @@ void wxListBox::FreeData() { if ( HasClientObjectData() ) { - for ( size_t n = 0; n < m_noItems; n++ ) + for ( unsigned int n = 0; n < m_noItems; n++ ) { delete GetClientObject( n ); } @@ -345,7 +345,7 @@ void wxListBox::DoSetFirstItem(int n) MacScrollTo( n ) ; } -void wxListBox::Delete(int n) +void wxListBox::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::Delete") ); @@ -364,7 +364,7 @@ int wxListBox::DoAppend(const wxString& item) { InvalidateBestSize(); - size_t index = m_noItems ; + unsigned int index = m_noItems ; m_stringArray.Add( item ) ; m_dataArray.Add( NULL ); m_noItems++; @@ -377,7 +377,7 @@ int wxListBox::DoAppend(const wxString& item) void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) { Clear() ; - size_t n = choices.GetCount(); + unsigned int n = choices.GetCount(); for ( size_t i = 0 ; i < n ; ++i ) { @@ -397,7 +397,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const Str255 s1 , s2 ; wxMacStringToPascal( search , s2 ) ; - for ( size_t i = 0 ; i < m_noItems ; ++ i ) + for ( unsigned int i = 0 ; i < m_noItems ; ++ i ) { wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ; @@ -410,9 +410,9 @@ int wxListBox::FindString(const wxString& s, bool bCase) const wxString st = s ; st.MakeLower() ; - for ( size_t i = 0 ; i < m_noItems ; ++i ) + for ( unsigned int i = 0 ; i < m_noItems ; ++i ) { - if ( GetString( i ).Lower().Matches(st) ) + if (GetString(i).Lower().Matches(st) ) return (int)i ; } } @@ -423,7 +423,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const wxMacStringToPascal( s , s2 ) ; - for ( size_t i = 0 ; i < m_noItems ; ++ i ) + for ( unsigned int i = 0 ; i < m_noItems ; ++ i ) { wxMacStringToPascal( m_stringArray[i] , s1 ) ; @@ -463,33 +463,33 @@ bool wxListBox::IsSelected(int n) const return MacIsSelected( n ) ; } -void *wxListBox::DoGetItemClientData(int n) const +void *wxListBox::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( IsValid(n), NULL, wxT("invalid index in wxListBox::GetClientData")); - wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) n , wxT("invalid client_data array") ) ; + wxASSERT_MSG( m_dataArray.GetCount() >= (unsigned int) n , wxT("invalid client_data array") ) ; return (void *)m_dataArray[n]; } -wxClientData *wxListBox::DoGetItemClientObject(int n) const +wxClientData *wxListBox::DoGetItemClientObject(unsigned int n) const { return (wxClientData *) DoGetItemClientData( n ) ; } -void wxListBox::DoSetItemClientData(int n, void *clientData) +void wxListBox::DoSetItemClientData(unsigned int n, void *clientData) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetClientData") ); - wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) n , wxT("invalid client_data array") ) ; + wxASSERT_MSG( m_dataArray.GetCount() >= (unsigned int) n , wxT("invalid client_data array") ) ; - if ( m_dataArray.GetCount() > (size_t) n ) + if ( m_dataArray.GetCount() > (unsigned int) n ) m_dataArray[n] = (char*)clientData ; else m_dataArray.Add( (char*)clientData ) ; } -void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { DoSetItemClientData(n, clientData); } @@ -507,7 +507,7 @@ int wxListBox::GetSelection() const } // Find string for position -wxString wxListBox::GetString(int n) const +wxString wxListBox::GetString(unsigned int n) const { wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("invalid index in wxListBox::GetString") ); @@ -515,16 +515,16 @@ wxString wxListBox::GetString(int n) const return m_stringArray[n] ; } -void wxListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxCHECK_RET( IsValidInsert(pos), wxT("invalid index in wxListBox::InsertItems") ); InvalidateBestSize(); - size_t nItems = items.GetCount(); + unsigned int nItems = items.GetCount(); - for ( size_t i = 0 ; i < nItems ; i++ ) + for ( unsigned int i = 0 ; i < nItems ; i++ ) { m_stringArray.Insert( items[i] , pos + i ) ; m_dataArray.Insert( NULL , pos + i ) ; @@ -533,7 +533,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos) } } -void wxListBox::SetString(int n, const wxString& s) +void wxListBox::SetString(unsigned int n, const wxString& s) { m_stringArray[n] = s ; MacSet( n , s ) ; @@ -563,9 +563,9 @@ wxSize wxListBox::DoGetBestSize() const } // Find the widest line - for (size_t i = 0; i < GetCount(); i++) + for (unsigned int i = 0; i < GetCount(); i++) { - wxString str( GetString( i ) ); + wxString str(GetString(i)); #if wxUSE_UNICODE Point bounds = {0, 0} ; @@ -603,7 +603,7 @@ wxSize wxListBox::DoGetBestSize() const return wxSize( lbWidth, lbHeight ); } -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { return m_noItems; } @@ -638,7 +638,7 @@ void wxListBox::MacDelete( int n ) UInt32 id = m_noItems + 1 ; verify_noerr( m_peer->RemoveItems( kDataBrowserNoItem , 1 , (UInt32*) &id , kDataBrowserItemNoProperty ) ) ; - for ( size_t i = 0 ; i < selectionBefore.GetCount() ; ++i ) + for ( unsigned int i = 0 ; i < selectionBefore.GetCount() ; ++i ) { int current = selectionBefore[i] ; if ( current == n ) @@ -737,7 +737,7 @@ bool wxListBox::MacIsSelected( int n ) const int wxListBox::MacGetSelection() const { - for ( size_t i = 0 ; i < GetCount() ; ++i ) + for ( unsigned int i = 0 ; i < GetCount() ; ++i ) { if ( m_peer->IsItemSelected( i + 1 ) ) return i ; @@ -956,7 +956,7 @@ void wxListBox::OnChar(wxKeyEvent& event) event.SetClientObject( GetClientObject( n ) ); else if ( HasClientUntypedData() ) event.SetClientData( GetClientData( n ) ); - event.SetString( GetString( n ) ); + event.SetString(GetString(n)); } else { @@ -988,8 +988,8 @@ void wxListBox::OnChar(wxKeyEvent& event) event.SetClientObject( GetClientObject( line ) ); else if ( HasClientUntypedData() ) event.SetClientData( GetClientData( line ) ); - event.SetString( GetString( line ) ); - event.SetInt( line ); + event.SetString(GetString(line)); + event.SetInt(line); GetEventHandler()->ProcessEvent(event); } diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index 7b8e0b9e7f..930080feb0 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -32,10 +32,10 @@ void wxRadioBox::OnRadioButton( wxCommandEvent &outer ) { wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId ); int i = GetSelection() ; - event.SetInt( i ); - event.SetString( GetString( i ) ); + event.SetInt(i); + event.SetString(GetString(i)); event.SetEventObject( this ); - ProcessCommand( event ); + ProcessCommand(event); } } @@ -97,7 +97,7 @@ bool wxRadioBox::Create( wxWindow *parent, int i; - m_noItems = (size_t)n; + m_noItems = (unsigned int)n; m_noRowsOrCols = majorDim; m_radioButtonCycle = NULL; @@ -150,7 +150,7 @@ bool wxRadioBox::Enable(bool enable) return false; current = m_radioButtonCycle; - for (size_t i = 0; i < m_noItems; i++) + for (unsigned int i = 0; i < m_noItems; i++) { current->Enable( enable ); current = current->NextInCycle(); @@ -161,16 +161,13 @@ bool wxRadioBox::Enable(bool enable) // Enables or disables an given button // -bool wxRadioBox::Enable(int item, bool enable) +bool wxRadioBox::Enable(unsigned int item, bool enable) { - int i; - wxRadioButton *current; - if (!IsValid( item )) return false; - i = 0; - current = m_radioButtonCycle; + unsigned int i = 0; + wxRadioButton *current = m_radioButtonCycle; while (i != item) { i++; @@ -189,15 +186,14 @@ wxString wxRadioBox::GetLabel() const // Returns the label for the given button // -wxString wxRadioBox::GetString(int item) const +wxString wxRadioBox::GetString(unsigned int item) const { - int i; wxRadioButton *current; if (!IsValid( item )) return wxEmptyString; - i = 0; + unsigned int i = 0; current = m_radioButtonCycle; while (i != item) { @@ -235,16 +231,13 @@ void wxRadioBox::SetLabel(const wxString& label) // Sets the label of a given button // -void wxRadioBox::SetString(int item,const wxString& label) +void wxRadioBox::SetString(unsigned int item,const wxString& label) { - int i; - wxRadioButton *current; - if (!IsValid( item )) return; - i = 0; - current = m_radioButtonCycle; + unsigned int i = 0; + wxRadioButton *current = m_radioButtonCycle; while (i != item) { i++; @@ -283,7 +276,7 @@ bool wxRadioBox::Show(bool show) wxRadioButton *current; current = m_radioButtonCycle; - for (size_t i=0; iShow( show ); current = current->NextInCycle(); @@ -296,16 +289,13 @@ bool wxRadioBox::Show(bool show) // Shows or hides the given button // -bool wxRadioBox::Show(int item, bool show) +bool wxRadioBox::Show(unsigned int item, bool show) { - int i; - wxRadioButton *current; - if (!IsValid( item )) return false; - i = 0; - current = m_radioButtonCycle; + unsigned int i = 0; + wxRadioButton *current = m_radioButtonCycle; while (i != item) { i++; @@ -383,9 +373,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) maxWidth = -1; maxHeight = -1; - for (size_t i = 0 ; i < m_noItems; i++) + for (unsigned int i = 0 ; i < m_noItems; i++) { - GetTextExtent( GetString( i ), &eachWidth[i], &eachHeight[i] ); + GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i] ); eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE); eachHeight[i] = (int)((3 * eachHeight[i]) / 2); @@ -473,9 +463,9 @@ wxSize wxRadioBox::DoGetBestSize() const maxWidth = -1; maxHeight = -1; - for (size_t i = 0 ; i < m_noItems; i++) + for (unsigned int i = 0 ; i < m_noItems; i++) { - GetTextExtent( GetString( i ), &eachWidth, &eachHeight, NULL, NULL, &font ); + GetTextExtent(GetString(i), &eachWidth, &eachHeight, NULL, NULL, &font ); eachWidth = (int)(eachWidth + RADIO_SIZE); eachHeight = (int)((3 * eachHeight) / 2); if (maxWidth < eachWidth) diff --git a/src/mac/classic/checklst.cpp b/src/mac/classic/checklst.cpp index b0cd769cfc..96a18ed143 100644 --- a/src/mac/classic/checklst.cpp +++ b/src/mac/classic/checklst.cpp @@ -310,7 +310,7 @@ bool wxCheckListBox::Create(wxWindow *parent, // wxCheckListBox functions // ---------------------------------------------------------------------------- -bool wxCheckListBox::IsChecked(size_t item) const +bool wxCheckListBox::IsChecked(unsigned int item) const { wxCHECK_MSG( IsValid(item), false, _T("invalid index in wxCheckListBox::IsChecked") ); @@ -318,7 +318,7 @@ bool wxCheckListBox::IsChecked(size_t item) const return m_checks[item] != 0; } -void wxCheckListBox::Check(size_t item, bool check) +void wxCheckListBox::Check(unsigned int item, bool check) { wxCHECK_RET( IsValid(item), _T("invalid index in wxCheckListBox::Check") ); @@ -337,7 +337,7 @@ void wxCheckListBox::Check(size_t item, bool check) // methods forwarded to wxListBox // ---------------------------------------------------------------------------- -void wxCheckListBox::Delete(int n) +void wxCheckListBox::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), _T("invalid index in wxListBox::Delete") ); @@ -358,12 +358,12 @@ int wxCheckListBox::DoAppend(const wxString& item) return pos; } -void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxCheckListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxListBox::DoInsertItems(items, pos); - size_t count = items.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = items.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_checks.Insert(false, pos + n); } @@ -374,8 +374,8 @@ void wxCheckListBox::DoSetItems(const wxArrayString& items, void **clientData) // call it first as it does DoClear() wxListBox::DoSetItems(items, clientData); - size_t count = items.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = items.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_checks.Add(false); } diff --git a/src/mac/classic/choice.cpp b/src/mac/classic/choice.cpp index d31d3e9b43..cfbd7aa4a8 100644 --- a/src/mac/classic/choice.cpp +++ b/src/mac/classic/choice.cpp @@ -25,7 +25,7 @@ wxChoice::~wxChoice() { if ( HasClientObjectData() ) { - size_t i, max = GetCount(); + unsigned int i, max = GetCount(); for ( i = 0; i < max; ++i ) delete GetClientObject(i); @@ -96,7 +96,7 @@ int wxChoice::DoAppend(const wxString& item) return index ; } -int wxChoice::DoInsert(const wxString& item, int pos) +int wxChoice::DoInsert(const wxString& item, unsigned int pos) { wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); @@ -112,7 +112,7 @@ int wxChoice::DoInsert(const wxString& item, int pos) return pos ; } -void wxChoice::Delete(int n) +void wxChoice::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") ); if ( HasClientObjectData() ) @@ -128,7 +128,7 @@ void wxChoice::Delete(int n) void wxChoice::Clear() { FreeData(); - for ( int i = 0 ; i < GetCount() ; i++ ) + for ( unsigned int i = 0 ; i < GetCount() ; i++ ) { ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ; } @@ -141,8 +141,8 @@ void wxChoice::FreeData() { if ( HasClientObjectData() ) { - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { delete GetClientObject(n); } @@ -166,12 +166,12 @@ void wxChoice::SetSelection(int n) // string list functions // ---------------------------------------------------------------------------- -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { return m_strings.GetCount() ; } -void wxChoice::SetString(int n, const wxString& s) +void wxChoice::SetString(unsigned int n, const wxString& s) { wxFAIL_MSG(wxT("wxChoice::SetString() not yet implemented")); #if 0 // should do this, but no Insert() so far @@ -180,7 +180,7 @@ void wxChoice::SetString(int n, const wxString& s) #endif } -wxString wxChoice::GetString(int n) const +wxString wxChoice::GetString(unsigned int n) const { wxCHECK_MSG( IsValid(n), wxEmptyString, _T("wxChoice::GetString(): invalid index") ); @@ -191,27 +191,27 @@ wxString wxChoice::GetString(int n) const // ---------------------------------------------------------------------------- // client data // ---------------------------------------------------------------------------- -void wxChoice::DoSetItemClientData( int n, void* clientData ) +void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) { - wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(), + wxCHECK_RET( n >= 0 && (unsigned int)n < m_datas.GetCount(), wxT("invalid index in wxChoice::SetClientData") ); m_datas[n] = (char*) clientData ; } -void *wxChoice::DoGetItemClientData(int n) const +void *wxChoice::DoGetItemClientData(unsigned int n) const { - wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL, + wxCHECK_MSG( n >= 0 && (unsigned int)n < m_datas.GetCount(), NULL, wxT("invalid index in wxChoice::GetClientData") ); return (void *)m_datas[n]; } -void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { DoSetItemClientData(n, clientData); } -wxClientData* wxChoice::DoGetItemClientObject( int n ) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } @@ -259,7 +259,7 @@ wxSize wxChoice::DoGetBestSize() const ::TextFace( 0 ) ; } // Find the widest line - for(int i = 0; i < GetCount(); i++) { + for(unsigned int i = 0; i < GetCount(); i++) { wxString str(GetString(i)); #if wxUSE_UNICODE Point bounds={0,0} ; diff --git a/src/mac/classic/combobox.cpp b/src/mac/classic/combobox.cpp index 16612c1f81..d81d07e32b 100644 --- a/src/mac/classic/combobox.cpp +++ b/src/mac/classic/combobox.cpp @@ -134,7 +134,7 @@ public: protected: void OnChoice( wxCommandEvent& e ) { - wxString s = e.GetString(); + wxString s = e.GetString(); m_cb->DelegateChoice( s ); wxCommandEvent event2(wxEVT_COMMAND_COMBOBOX_SELECTED, m_cb->GetId() ); @@ -308,7 +308,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, wxString wxComboBox::GetValue() const { - wxString result; + wxString result; if ( m_text == NULL ) { @@ -420,27 +420,27 @@ int wxComboBox::DoAppend(const wxString& item) return m_choice->DoAppend( item ) ; } -int wxComboBox::DoInsert(const wxString& item, int pos) +int wxComboBox::DoInsert(const wxString& item, unsigned int pos) { return m_choice->DoInsert( item , pos ) ; } -void wxComboBox::DoSetItemClientData(int n, void* clientData) +void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) { return m_choice->DoSetItemClientData( n , clientData ) ; } -void* wxComboBox::DoGetItemClientData(int n) const +void* wxComboBox::DoGetItemClientData(unsigned int n) const { return m_choice->DoGetItemClientData( n ) ; } -void wxComboBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { - return m_choice->DoSetItemClientObject( n , clientData ) ; + return m_choice->DoSetItemClientObject(n , clientData); } -wxClientData* wxComboBox::DoGetItemClientObject(int n) const +wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const { return m_choice->DoGetItemClientObject( n ) ; } @@ -449,15 +449,15 @@ void wxComboBox::FreeData() { if ( HasClientObjectData() ) { - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { SetClientObject( n, NULL ); } } } -void wxComboBox::Delete(int n) +void wxComboBox::Delete(unsigned int n) { // force client object deletion if( HasClientObjectData() ) @@ -482,7 +482,7 @@ void wxComboBox::SetSelection(int n) if ( m_text != NULL ) { - m_text->SetValue( GetString( n ) ); + m_text->SetValue(GetString(n)); } } @@ -491,7 +491,7 @@ int wxComboBox::FindString(const wxString& s, bool bCase ) const return m_choice->FindString( s , bCase ); } -wxString wxComboBox::GetString(int n) const +wxString wxComboBox::GetString(unsigned int n) const { return m_choice->GetString( n ); } @@ -499,15 +499,16 @@ wxString wxComboBox::GetString(int n) const wxString wxComboBox::GetStringSelection() const { int sel = GetSelection (); - if (sel > -1) - return wxString(this->GetString (sel)); + + if (sel != wxNOT_FOUND) + return wxString(this->GetString((unsigned int)sel)); else return wxEmptyString; } -void wxComboBox::SetString(int n, const wxString& s) +void wxComboBox::SetString(unsigned int n, const wxString& s) { - m_choice->SetString( n , s ) ; + m_choice->SetString( n , s ); } bool wxComboBox::IsEditable() const diff --git a/src/mac/classic/listbox.cpp b/src/mac/classic/listbox.cpp index cdd1f889d3..02f93f5c8d 100644 --- a/src/mac/classic/listbox.cpp +++ b/src/mac/classic/listbox.cpp @@ -343,7 +343,7 @@ void wxListBox::FreeData() #endif // wxUSE_OWNER_DRAWN if ( HasClientObjectData() ) { - for ( size_t n = 0; n < m_noItems; n++ ) + for ( unsigned int n = 0; n < m_noItems; n++ ) { delete GetClientObject(n); } @@ -376,32 +376,32 @@ void wxListBox::DoSetFirstItem(int N) MacScrollTo( N ) ; } -void wxListBox::Delete(int N) +void wxListBox::Delete(unsigned int n) { - wxCHECK_RET( IsValid(N), + wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::Delete") ); #if wxUSE_OWNER_DRAWN - delete m_aItems[N]; - m_aItems.RemoveAt(N); + delete m_aItems[n]; + m_aItems.RemoveAt(n); #else // !wxUSE_OWNER_DRAWN if ( HasClientObjectData() ) { - delete GetClientObject(N); + delete GetClientObject(n); } #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN - m_stringArray.RemoveAt( N ) ; - m_dataArray.RemoveAt( N ) ; - m_noItems --; + m_stringArray.RemoveAt(n) ; + m_dataArray.RemoveAt(n) ; + m_noItems--; - MacDelete( N ) ; + MacDelete(n) ; } int wxListBox::DoAppend(const wxString& item) { InvalidateBestSize(); - size_t index = m_noItems ; + unsigned int index = m_noItems ; m_stringArray.Add( item ) ; m_dataArray.Add( NULL ); m_noItems ++; @@ -435,7 +435,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { // first delete old items - size_t ui = m_aItems.Count(); + unsigned int ui = m_aItems.Count(); while ( ui-- != 0 ) { delete m_aItems[ui]; m_aItems[ui] = NULL; @@ -467,7 +467,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const Str255 s1 , s2 ; wxMacStringToPascal( search , s2 ) ; - for ( size_t i = 0 ; i < m_noItems ; ++ i ) + for ( unsigned int i = 0 ; i < m_noItems ; ++ i ) { wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ; @@ -478,9 +478,9 @@ int wxListBox::FindString(const wxString& s, bool bCase) const { wxString st = s ; st.MakeLower() ; - for ( size_t i = 0 ; i < m_noItems ; ++i ) + for ( unsigned int i = 0 ; i < m_noItems ; ++i ) { - if ( GetString(i).Lower().Matches(st) ) + if (GetString(i).Lower().Matches(st)) return (int)i ; } } @@ -492,7 +492,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const wxMacStringToPascal( s , s2 ) ; - for ( size_t i = 0 ; i < m_noItems ; ++ i ) + for ( unsigned int i = 0 ; i < m_noItems ; ++ i ) { wxMacStringToPascal( m_stringArray[i] , s1 ) ; @@ -529,22 +529,22 @@ bool wxListBox::IsSelected(int N) const return MacIsSelected( N ) ; } -void *wxListBox::DoGetItemClientData(int N) const +void *wxListBox::DoGetItemClientData(unsigned int n) const { - wxCHECK_MSG( IsValid(N), NULL, + wxCHECK_MSG( IsValid(n), NULL, wxT("invalid index in wxListBox::GetClientData")); - return (void *)m_dataArray[N]; + return (void *)m_dataArray[n]; } -wxClientData *wxListBox::DoGetItemClientObject(int N) const +wxClientData *wxListBox::DoGetItemClientObject(unsigned int n) const { - return (wxClientData *) DoGetItemClientData( N ) ; + return (wxClientData *) DoGetItemClientData( n ) ; } -void wxListBox::DoSetItemClientData(int N, void *Client_data) +void wxListBox::DoSetItemClientData(unsigned int n, void *Client_data) { - wxCHECK_RET( IsValid(N), + wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetClientData") ); #if wxUSE_OWNER_DRAWN @@ -555,11 +555,11 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data) wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes")); } #endif // wxUSE_OWNER_DRAWN - wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , wxT("invalid client_data array") ) ; + wxASSERT_MSG( m_dataArray.GetCount() >= (unsigned int) n , wxT("invalid client_data array") ) ; - if ( m_dataArray.GetCount() > (size_t) N ) + if ( m_dataArray.GetCount() > (size_t) n ) { - m_dataArray[N] = (char*) Client_data ; + m_dataArray[n] = (char*) Client_data ; } else { @@ -567,7 +567,7 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data) } } -void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { DoSetItemClientData(n, clientData); } @@ -585,21 +585,21 @@ int wxListBox::GetSelection() const } // Find string for position -wxString wxListBox::GetString(int N) const +wxString wxListBox::GetString(unsigned int n) const { - return m_stringArray[N] ; + return m_stringArray[n] ; } -void wxListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxCHECK_RET( IsValidInsert(pos), wxT("invalid index in wxListBox::InsertItems") ); InvalidateBestSize(); - size_t nItems = items.GetCount(); + unsigned int nItems = items.GetCount(); - for ( size_t i = 0 ; i < nItems ; i++ ) + for ( unsigned int i = 0 ; i < nItems ; i++ ) { m_stringArray.Insert( items[i] , pos + i ) ; m_dataArray.Insert( NULL , pos + i ) ; @@ -609,10 +609,10 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos) m_noItems += nItems; } -void wxListBox::SetString(int N, const wxString& s) +void wxListBox::SetString(unsigned int n, const wxString& s) { - m_stringArray[N] = s ; - MacSet( N , s ) ; + m_stringArray[n] = s; + MacSet(n, s); } wxSize wxListBox::DoGetBestSize() const @@ -638,7 +638,7 @@ wxSize wxListBox::DoGetBestSize() const } // Find the widest line - for(int i = 0; i < GetCount(); i++) { + for(unsigned int i = 0; i < GetCount(); i++) { wxString str(GetString(i)); #if wxUSE_UNICODE Point bounds={0,0} ; @@ -671,7 +671,7 @@ wxSize wxListBox::DoGetBestSize() const return wxSize(lbWidth, lbHeight); } -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { return m_noItems; } @@ -899,7 +899,7 @@ void wxListBox::MacDoClick() event.SetClientObject( GetClientObject(n) ); else if ( HasClientUntypedData() ) event.SetClientData( GetClientData(n) ); - event.SetString( GetString(n) ); + event.SetString(GetString(n)); } else { @@ -980,7 +980,7 @@ void wxListBox::OnChar(wxKeyEvent& event) event.SetClientObject( GetClientObject(n) ); else if ( HasClientUntypedData() ) event.SetClientData( GetClientData(n) ); - event.SetString( GetString(n) ); + event.SetString(GetString(n)); } else { @@ -1012,7 +1012,7 @@ void wxListBox::OnChar(wxKeyEvent& event) event.SetClientObject( GetClientObject( line ) ); else if ( HasClientUntypedData() ) event.SetClientData( GetClientData(line) ); - event.SetString( GetString(line) ); + event.SetString(GetString(line)); event.SetInt(line); diff --git a/src/mac/classic/radiobox.cpp b/src/mac/classic/radiobox.cpp index 869d0c9b44..52cfa6c4ba 100644 --- a/src/mac/classic/radiobox.cpp +++ b/src/mac/classic/radiobox.cpp @@ -39,7 +39,7 @@ void wxRadioBox::OnRadioButton( wxCommandEvent &outer ) wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId); int i = GetSelection() ; event.SetInt( i ); - event.SetString( GetString( i ) ); + event.SetString(GetString(i)); event.SetEventObject( this ); ProcessCommand(event); } @@ -111,7 +111,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, int i; - m_noItems = (size_t)n; + m_noItems = (unsigned int)n; m_noRowsOrCols = majorDim; m_radioButtonCycle = NULL; @@ -155,13 +155,12 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, bool wxRadioBox::Enable(bool enable) { - wxRadioButton *current; - if (!wxControl::Enable(enable)) return false; - current = m_radioButtonCycle; - for (size_t i = 0; i < m_noItems; i++) { + wxRadioButton *current = m_radioButtonCycle; + for (unsigned int i = 0; i < m_noItems; i++) + { current->Enable(enable); current = current->NextInCycle(); } @@ -169,21 +168,19 @@ bool wxRadioBox::Enable(bool enable) } //------------------------------------------------------------------------------------- -// ¥ Enable(int, bool) +// ¥ Enable(unsigned int, bool) //------------------------------------------------------------------------------------- // Enables or disables an given button -bool wxRadioBox::Enable(int item, bool enable) +bool wxRadioBox::Enable(unsigned int item, bool enable) { - int i; - wxRadioButton *current; - if (!IsValid(item)) return false; - i = 0; - current = m_radioButtonCycle; - while (i != item) { + unsigned int i = 0; + wxRadioButton *current = m_radioButtonCycle; + while (i != item) + { i++; current = current->NextInCycle(); } @@ -205,15 +202,14 @@ wxString wxRadioBox::GetLabel() const //------------------------------------------------------------------------------------- // Returns the label for the given button -wxString wxRadioBox::GetString(int item) const +wxString wxRadioBox::GetString(unsigned int item) const { - int i; wxRadioButton *current; if (!IsValid(item)) return wxEmptyString; - i = 0; + unsigned int i = 0; current = m_radioButtonCycle; while (i != item) { i++; @@ -265,16 +261,15 @@ void wxRadioBox::SetLabel(const wxString& label) //------------------------------------------------------------------------------------- // Sets the label of a given button -void wxRadioBox::SetString(int item,const wxString& label) +void wxRadioBox::SetString(unsigned int item,const wxString& label) { - int i; - wxRadioButton *current; - if (!IsValid(item)) return; - i=0; - current=m_radioButtonCycle; - while (i!=item) { + + unsigned int i=0; + wxRadioButton *current=m_radioButtonCycle; + while (i!=item) + { i++; current=current->NextInCycle(); } @@ -316,7 +311,7 @@ bool wxRadioBox::Show(bool show) wxControl::Show(show); current=m_radioButtonCycle; - for (size_t i=0; iShow(show); current=current->NextInCycle(); @@ -325,19 +320,17 @@ bool wxRadioBox::Show(bool show) } //------------------------------------------------------------------------------------- -// ¥ Show(int, bool) +// ¥ Show(unsigned int, bool) //------------------------------------------------------------------------------------- // Shows or hides the given button -bool wxRadioBox::Show(int item, bool show) +bool wxRadioBox::Show(unsigned int item, bool show) { - int i; - wxRadioButton *current; - if (!IsValid(item)) return false; - i=0; - current=m_radioButtonCycle; + + unsigned int i = 0; + wxRadioButton *current=m_radioButtonCycle; while (i!=item) { i++; current=current->NextInCycle(); @@ -385,7 +378,7 @@ void wxRadioBox::SetFocus() void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - size_t i; + unsigned int i; wxRadioButton *current; // define the position @@ -504,7 +497,7 @@ wxSize wxRadioBox::DoGetBestSize() const maxWidth = -1; maxHeight = -1; - for (size_t i = 0 ; i < m_noItems; i++) + for (unsigned int i = 0 ; i < m_noItems; i++) { GetTextExtent(GetString(i), &eachWidth, &eachHeight); eachWidth = (int)(eachWidth + RADIO_SIZE) ; diff --git a/src/motif/checklst.cpp b/src/motif/checklst.cpp index b2e28eb366..8b8ee7ef6e 100644 --- a/src/motif/checklst.cpp +++ b/src/motif/checklst.cpp @@ -16,6 +16,8 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#if wxUSE_CHECKLISTBOX + #include "wx/defs.h" #include "wx/checklst.h" @@ -116,12 +118,12 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, // check items // ----------- -bool wxCheckListBox::IsChecked(size_t uiIndex) const +bool wxCheckListBox::IsChecked(unsigned int uiIndex) const { return ::IsChecked(wxListBox::GetString(uiIndex)); } -void wxCheckListBox::Check(size_t uiIndex, bool bCheck) +void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) { wxString label = wxListBox::GetString(uiIndex); if(::IsChecked(label) == bCheck) return; @@ -145,7 +147,7 @@ void wxCheckListBox::DoToggleItem( int n, int x ) event.SetInt(n); event.SetExtraLong(true); event.SetEventObject(this); - event.SetString( GetString( n ) ); + event.SetString(GetString(n)); GetEventHandler()->ProcessEvent(event); } @@ -170,17 +172,17 @@ int wxCheckListBox::FindString(const wxString& s, bool bCase) const return min; } -void wxCheckListBox::SetString(int n, const wxString& s) +void wxCheckListBox::SetString(unsigned int n, const wxString& s) { - wxListBox::SetString( n, Prefix(IsChecked(n)) + s ); + wxListBox::SetString(n, Prefix(IsChecked(n)) + s); } -wxString wxCheckListBox::GetString(int n) const +wxString wxCheckListBox::GetString(unsigned int n) const { return wxListBox::GetString(n).substr(4); } -void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxCheckListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxArrayString copy; CopyStringsAddingPrefix(items, copy); @@ -193,3 +195,5 @@ void wxCheckListBox::DoSetItems(const wxArrayString& items, void **clientData) CopyStringsAddingPrefix(items, copy); wxListBox::DoSetItems(copy, clientData); } + +#endif // wxUSE_CHECKLISTBOX diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index 2ffba977d6..04531704ee 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -187,10 +187,10 @@ static inline wxChar* MYcopystring(const wxChar* s) return wxStrcpy(copy, s); } -int wxChoice::DoInsert(const wxString& item, int pos) +int wxChoice::DoInsert(const wxString& item, unsigned int pos) { #ifndef XmNpositionIndex - wxCHECK_MSG( (size_t)pos == GetCount(), -1, wxT("insert not implemented")); + wxCHECK_MSG( pos == GetCount(), -1, wxT("insert not implemented")); #endif Widget w = XtVaCreateManagedWidget (wxStripMenuCodes(item), #if wxUSE_GADGETS @@ -236,10 +236,10 @@ int wxChoice::DoInsert(const wxString& item, int pos) int wxChoice::DoAppend(const wxString& item) { - return DoInsert(item, (int)GetCount()); + return DoInsert(item, GetCount()); } -void wxChoice::Delete(int n) +void wxChoice::Delete(unsigned int n) { Widget w = (Widget)m_widgetArray[n]; XtRemoveCallback(w, XmNactivateCallback, (XtCallbackProc)wxChoiceCallback, @@ -249,13 +249,13 @@ void wxChoice::Delete(int n) m_clientDataDict.Delete(n, HasClientObjectData()); XtDestroyWidget(w); - m_noStrings --; + m_noStrings--; } void wxChoice::Clear() { m_stringList.Clear (); - size_t i; + unsigned int i; for (i = 0; i < m_noStrings; i++) { XtRemoveCallback((Widget) m_widgetArray[i], @@ -337,7 +337,7 @@ void wxChoice::SetSelection(int n) m_inSetValue = false; } -wxString wxChoice::GetString(int n) const +wxString wxChoice::GetString(unsigned int n) const { wxStringList::compatibility_iterator node = m_stringList.Item(n); if (node) @@ -384,7 +384,7 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) if (width > -1) { - size_t i; + unsigned int i; for (i = 0; i < m_noStrings; i++) XtVaSetValues ((Widget) m_widgetArray[i], XmNwidth, actualWidth, @@ -395,7 +395,7 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) if (height > -1) { #if 0 - size_t i; + unsigned int i; for (i = 0; i < m_noStrings; i++) XtVaSetValues ((Widget) m_widgetArray[i], XmNheight, actualHeight, @@ -462,7 +462,7 @@ void wxChoice::ChangeFont(bool keepOriginalSize) fontTag, m_font.GetFontTypeC(dpy), NULL); - for( size_t i = 0; i < m_noStrings; ++i ) + for( unsigned int i = 0; i < m_noStrings; ++i ) XtVaSetValues( (Widget)m_widgetArray[i], fontTag, m_font.GetFontTypeC(dpy), NULL ); @@ -480,7 +480,7 @@ void wxChoice::ChangeBackgroundColour() wxDoChangeBackgroundColour(m_formWidget, m_backgroundColour); wxDoChangeBackgroundColour(m_buttonWidget, m_backgroundColour); wxDoChangeBackgroundColour(m_menuWidget, m_backgroundColour); - size_t i; + unsigned int i; for (i = 0; i < m_noStrings; i++) wxDoChangeBackgroundColour(m_widgetArray[i], m_backgroundColour); } @@ -490,38 +490,38 @@ void wxChoice::ChangeForegroundColour() wxDoChangeForegroundColour(m_formWidget, m_foregroundColour); wxDoChangeForegroundColour(m_buttonWidget, m_foregroundColour); wxDoChangeForegroundColour(m_menuWidget, m_foregroundColour); - size_t i; + unsigned int i; for (i = 0; i < m_noStrings; i++) wxDoChangeForegroundColour(m_widgetArray[i], m_foregroundColour); } -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { return m_noStrings; } -void wxChoice::DoSetItemClientData(int n, void* clientData) +void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) { m_clientDataDict.Set(n, (wxClientData*)clientData, false); } -void* wxChoice::DoGetItemClientData(int n) const +void* wxChoice::DoGetItemClientData(unsigned int n) const { return (void*)m_clientDataDict.Get(n); } -void wxChoice::DoSetItemClientObject(int n, wxClientData* clientData) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { // don't delete, wxItemContainer does that for us m_clientDataDict.Set(n, clientData, false); } -wxClientData* wxChoice::DoGetItemClientObject(int n) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { return m_clientDataDict.Get(n); } -void wxChoice::SetString(int WXUNUSED(n), const wxString& WXUNUSED(s)) +void wxChoice::SetString(unsigned int WXUNUSED(n), const wxString& WXUNUSED(s)) { wxFAIL_MSG( wxT("wxChoice::SetString not implemented") ); } diff --git a/src/motif/combobox.cpp b/src/motif/combobox.cpp index 49a8f87dbe..956dfd7339 100644 --- a/src/motif/combobox.cpp +++ b/src/motif/combobox.cpp @@ -49,7 +49,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, if( !CreateControl( parent, id, pos, size, style, validator, name ) ) return false; - m_noStrings = (size_t)n; + m_noStrings = n; Widget parentWidget = (Widget) parent->GetClientWidget(); @@ -144,7 +144,7 @@ void wxComboBox::SetValue(const wxString& value) m_inSetValue = false; } -void wxComboBox::SetString(int WXUNUSED(n), const wxString& WXUNUSED(s)) +void wxComboBox::SetString(unsigned int WXUNUSED(n), const wxString& WXUNUSED(s)) { wxFAIL_MSG( wxT("wxComboBox::SetString only implemented for Motif 2.0") ); } @@ -159,7 +159,7 @@ int wxComboBox::DoAppend(const wxString& item) return GetCount() - 1; } -int wxComboBox::DoInsert(const wxString& item, int pos) +int wxComboBox::DoInsert(const wxString& item, unsigned int pos) { wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); @@ -176,7 +176,7 @@ int wxComboBox::DoInsert(const wxString& item, int pos) return pos; } -void wxComboBox::Delete(int n) +void wxComboBox::Delete(unsigned int n) { XmComboBoxDeletePos((Widget) m_mainWidget, n+1); wxStringList::Node *node = m_stringList.Item(n); @@ -213,7 +213,7 @@ int wxComboBox::GetSelection (void) const return sel - 1; } -wxString wxComboBox::GetString(int n) const +wxString wxComboBox::GetString(unsigned int n) const { wxStringList::Node *node = m_stringList.Item(n); if (node) diff --git a/src/motif/combobox_native.cpp b/src/motif/combobox_native.cpp index fa3204e238..f65ae3d8ea 100644 --- a/src/motif/combobox_native.cpp +++ b/src/motif/combobox_native.cpp @@ -179,7 +179,7 @@ wxString wxComboBox::GetValue() const return str; } -void wxComboBox::SetString(int n, const wxString& s) +void wxComboBox::SetString(unsigned int n, const wxString& s) { wxXmString text(s); Widget listBox = GetXmList(this); @@ -213,12 +213,12 @@ int wxComboBox::DoAppend(const wxString& item) return GetCount() - 1; } -int wxComboBox::DoInsert(const wxString& item, int pos) +int wxComboBox::DoInsert(const wxString& item, unsigned int pos) { wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); - if ((size_t)pos == GetCount()) + if (pos == GetCount()) return DoAppend(item); wxXmString str( item.c_str() ); @@ -229,7 +229,7 @@ int wxComboBox::DoInsert(const wxString& item, int pos) return GetCount() - 1; } -void wxComboBox::Delete(int n) +void wxComboBox::Delete(unsigned int n) { #ifdef LESSTIF_VERSION XmListDeletePos (GetXmList(this), n + 1); @@ -269,7 +269,7 @@ void wxComboBox::SetSelection (int n) SetValue(GetString(n)); #else #if 0 - wxXmString str( GetString(n).c_str() ); + wxXmString str(GetString(n).c_str()); XmComboBoxSelectItem((Widget) m_mainWidget, str()); #endif XtVaSetValues( (Widget)m_mainWidget, @@ -285,7 +285,7 @@ int wxComboBox::GetSelection (void) const return wxDoGetSelectionInList( GetXmList( this ) ); } -wxString wxComboBox::GetString(int n) const +wxString wxComboBox::GetString(unsigned int n) const { return wxDoGetStringInList( GetXmList(this), n ); } diff --git a/src/motif/listbox.cpp b/src/motif/listbox.cpp index 8eba4cd13a..cc73babadf 100644 --- a/src/motif/listbox.cpp +++ b/src/motif/listbox.cpp @@ -89,7 +89,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, validator, name ) ) return false; - m_noItems = (size_t)n; + m_noItems = (unsigned int)n; m_backgroundColour = * wxWHITE; Widget parentWidget = (Widget) parent->GetClientWidget(); @@ -204,7 +204,7 @@ void wxListBox::DoSetFirstItem( int N ) XmListSetPos ((Widget) m_mainWidget, N + 1); } -void wxListBox::Delete(int N) +void wxListBox::Delete(unsigned int n) { wxSizeKeeper sk( this ); Widget listBox = (Widget) m_mainWidget; @@ -214,13 +214,13 @@ void wxListBox::Delete(int N) if (managed) XtUnmanageChild (listBox); - XmListDeletePos (listBox, N + 1); + XmListDeletePos (listBox, n + 1); if (managed) XtManageChild (listBox); sk.Restore(); - m_clientDataDict.Delete(N, HasClientObjectData()); + m_clientDataDict.Delete(n, HasClientObjectData()); m_noItems --; } @@ -265,7 +265,7 @@ void wxListBox::DoSetItems(const wxArrayString& items, void** clientData) if (managed) XtUnmanageChild (listBox); XmString *text = new XmString[items.GetCount()]; - size_t i; + unsigned int i; for (i = 0; i < items.GetCount(); ++i) text[i] = wxStringToXmString (items[i]); @@ -390,24 +390,24 @@ bool wxListBox::IsSelected(int N) const return false; } -void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { m_clientDataDict.Set(n, clientData, false); } -wxClientData* wxListBox::DoGetItemClientObject(int n) const +wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const { return m_clientDataDict.Get(n); } -void *wxListBox::DoGetItemClientData(int N) const +void *wxListBox::DoGetItemClientData(unsigned int n) const { - return (void*)m_clientDataDict.Get(N); + return (void*)m_clientDataDict.Get(n); } -void wxListBox::DoSetItemClientData(int N, void *Client_data) +void wxListBox::DoSetItemClientData(unsigned int n, void *Client_data) { - m_clientDataDict.Set(N, (wxClientData*)Client_data, false); + m_clientDataDict.Set(n, (wxClientData*)Client_data, false); } // Return number of selections and an array of selected integers @@ -477,12 +477,12 @@ wxString wxDoGetStringInList( Widget listBox, int n ) return wxEmptyString; } -wxString wxListBox::GetString( int n ) const +wxString wxListBox::GetString(unsigned int n) const { return wxDoGetStringInList( (Widget)m_mainWidget, n ); } -void wxListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxSizeKeeper sk( this ); Widget listBox = (Widget) m_mainWidget; @@ -493,7 +493,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos) XtUnmanageChild(listBox); XmString *text = new XmString[items.GetCount()]; - size_t i; + unsigned int i; // Steve Hammes: Motif 1.1 compatibility // #if XmVersion > 1100 // Corrected by Sergey Krasnov from Steve Hammes' code @@ -525,7 +525,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos) m_noItems += items.GetCount(); } -void wxListBox::SetString(int N, const wxString& s) +void wxListBox::SetString(unsigned int n, const wxString& s) { wxSizeKeeper sk( this ); Widget listBox = (Widget) m_mainWidget; @@ -534,8 +534,8 @@ void wxListBox::SetString(int N, const wxString& s) // delete the item and add it again. // FIXME isn't there a way to change it in place? - XmListDeletePos (listBox, N+1); - XmListAddItem (listBox, text(), N+1); + XmListDeletePos (listBox, n+1); + XmListAddItem (listBox, text(), n+1); sk.Restore(); } @@ -666,7 +666,7 @@ void wxListBox::ChangeForegroundColour() */ } -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { return m_noItems; } diff --git a/src/motif/radiobox.cpp b/src/motif/radiobox.cpp index b529840be5..a341e977a8 100644 --- a/src/motif/radiobox.cpp +++ b/src/motif/radiobox.cpp @@ -59,7 +59,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, if( !CreateControl( parent, id, pos, size, style, val, name ) ) return false; - m_noItems = (size_t)n; + m_noItems = (unsigned int)n; m_noRowsOrCols = majorDim; SetMajorDim(majorDim == 0 ? n : majorDim, style); @@ -168,12 +168,12 @@ wxRadioBox::~wxRadioBox() m_mainWidget = (WXWidget) 0; } -void wxRadioBox::SetString(int item, const wxString& label) +void wxRadioBox::SetString(unsigned int item, const wxString& label) { if (!IsValid(item)) return; - Widget widget = (Widget) m_radioButtons[item]; + Widget widget = (Widget)m_radioButtons[item]; if (!label.empty()) { wxString label1(wxStripMenuCodes(label)); @@ -197,8 +197,8 @@ void wxRadioBox::SetSelection(int n) XmToggleButtonSetState ((Widget) m_radioButtons[n], True, False); - for (size_t i = 0; i < m_noItems; i++) - if (i != (size_t)n) + for (unsigned int i = 0; i < m_noItems; i++) + if (i != (unsigned int)n) XmToggleButtonSetState ((Widget) m_radioButtons[i], False, False); m_inSetValue = false; @@ -211,7 +211,7 @@ int wxRadioBox::GetSelection() const } // Find string for position -wxString wxRadioBox::GetString(int n) const +wxString wxRadioBox::GetString(unsigned int n) const { if (!IsValid(n)) return wxEmptyString; @@ -243,7 +243,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) } // Enable a specific button -bool wxRadioBox::Enable(int n, bool enable) +bool wxRadioBox::Enable(unsigned int n, bool enable) { if (!IsValid(n)) return false; @@ -258,7 +258,7 @@ bool wxRadioBox::Enable(bool enable) if ( !wxControl::Enable(enable) ) return false; - for (size_t i = 0; i < m_noItems; i++) + for (unsigned int i = 0; i < m_noItems; i++) XtSetSensitive ((Widget) m_radioButtons[i], (Boolean) enable); return true; @@ -271,7 +271,7 @@ bool wxRadioBox::Show(bool show) } // Show a specific button -bool wxRadioBox::Show(int n, bool show) +bool wxRadioBox::Show(unsigned int n, bool show) { // This method isn't complete, and we try do do our best... // It's main purpose isn't for allowing Show/Unshow dynamically, @@ -305,8 +305,8 @@ bool wxRadioBox::Show(int n, bool show) wxString wxRadioBox::GetStringSelection () const { int sel = GetSelection (); - if (sel > -1) - return this->GetString (sel); + if (sel != wxNOT_FOUND) + return this->GetString((unsigned int)sel); else return wxEmptyString; } @@ -333,7 +333,7 @@ void wxRadioBox::ChangeFont(bool keepOriginalSize) { wxWindow::ChangeFont(keepOriginalSize); - for (size_t i = 0; i < m_noItems; i++) + for (unsigned int i = 0; i < m_noItems; i++) { WXWidget radioButton = m_radioButtons[i]; @@ -349,7 +349,7 @@ void wxRadioBox::ChangeBackgroundColour() int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget)); - for (size_t i = 0; i < m_noItems; i++) + for (unsigned int i = 0; i < m_noItems; i++) { WXWidget radioButton = m_radioButtons[i]; @@ -365,7 +365,7 @@ void wxRadioBox::ChangeForegroundColour() { wxWindow::ChangeForegroundColour(); - for (size_t i = 0; i < m_noItems; i++) + for (unsigned int i = 0; i < m_noItems; i++) { WXWidget radioButton = m_radioButtons[i]; @@ -381,7 +381,7 @@ void wxRadioBoxCallback (Widget w, XtPointer clientData, wxRadioBox *item = (wxRadioBox *) clientData; int sel = -1; - size_t i; + unsigned int i; const wxWidgetArray& buttons = item->GetRadioButtons(); for (i = 0; i < item->GetCount(); i++) if (((Widget)buttons[i]) == w) diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index b40783e67a..91c20b20b0 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -126,44 +126,44 @@ class wxCheckListBoxItem : public wxOwnerDrawn { friend class WXDLLEXPORT wxCheckListBox; public: - // ctor - wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex); + // ctor + wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex); - // drawing functions - virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); + // drawing functions + virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); - // simple accessors and operations - bool IsChecked() const { return m_bChecked; } + // simple accessors and operations + bool IsChecked() const { return m_bChecked; } - void Check(bool bCheck); - void Toggle() { Check(!IsChecked()); } + void Check(bool bCheck); + void Toggle() { Check(!IsChecked()); } - void SendEvent(); + void SendEvent(); private: - bool m_bChecked; - wxCheckListBox *m_pParent; - size_t m_nIndex; + bool m_bChecked; + wxCheckListBox *m_pParent; + size_t m_nIndex; - DECLARE_NO_COPY_CLASS(wxCheckListBoxItem) + DECLARE_NO_COPY_CLASS(wxCheckListBoxItem) }; wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex) : wxOwnerDrawn(wxEmptyString, true) // checkable { - m_bChecked = false; - m_pParent = pParent; - m_nIndex = nIndex; - - // we don't initialize m_nCheckHeight/Width vars because it's - // done in OnMeasure while they are used only in OnDraw and we - // know that there will always be OnMeasure before OnDraw - - // fix appearance for check list boxes: they don't look quite the same as - // menu icons - SetMarginWidth(::GetSystemMetrics(SM_CXMENUCHECK) - - 2*wxSystemSettings::GetMetric(wxSYS_EDGE_X) + 1); - SetBackgroundColour(pParent->GetBackgroundColour()); + m_bChecked = false; + m_pParent = pParent; + m_nIndex = nIndex; + + // we don't initialize m_nCheckHeight/Width vars because it's + // done in OnMeasure while they are used only in OnDraw and we + // know that there will always be OnMeasure before OnDraw + + // fix appearance for check list boxes: they don't look quite the same as + // menu icons + SetMarginWidth(::GetSystemMetrics(SM_CXMENUCHECK) - + 2*wxSystemSettings::GetMetric(wxSYS_EDGE_X) + 1); + SetBackgroundColour(pParent->GetBackgroundColour()); } bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, @@ -335,22 +335,22 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, // misc overloaded methods // ----------------------- -void wxCheckListBox::Delete(int N) +void wxCheckListBox::Delete(unsigned int n) { - wxCHECK_RET( IsValid(N), + wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::Delete") ); - wxListBox::Delete(N); + wxListBox::Delete(n); // free memory - delete m_aItems[N]; + delete m_aItems[n]; - m_aItems.RemoveAt(N); + m_aItems.RemoveAt(n); } bool wxCheckListBox::SetFont( const wxFont &font ) { - size_t i; + unsigned int i; for ( i = 0; i < m_aItems.GetCount(); i++ ) m_aItems[i]->SetFont(font); @@ -391,16 +391,16 @@ bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) // check items // ----------- -bool wxCheckListBox::IsChecked(size_t uiIndex) const +bool wxCheckListBox::IsChecked(unsigned int uiIndex) const { - wxCHECK_MSG( uiIndex < (size_t)GetCount(), false, _T("bad wxCheckListBox index") ); + wxCHECK_MSG( IsValid(uiIndex), false, _T("bad wxCheckListBox index") ); return GetItem(uiIndex)->IsChecked(); } -void wxCheckListBox::Check(size_t uiIndex, bool bCheck) +void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) { - wxCHECK_RET( uiIndex < (size_t)GetCount(), _T("bad wxCheckListBox index") ); + wxCHECK_RET( IsValid(uiIndex), _T("bad wxCheckListBox index") ); GetItem(uiIndex)->Check(bCheck); } @@ -494,21 +494,24 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event) void wxCheckListBox::OnLeftClick(wxMouseEvent& event) { - // clicking on the item selects it, clicking on the checkmark toggles - if ( event.GetX() <= wxOwnerDrawn::GetDefaultMarginWidth() ) { - int nItem = HitTest(event.GetX(), event.GetY()); - - if ( nItem != wxNOT_FOUND ) { - wxCheckListBoxItem *item = GetItem(nItem); - item->Toggle(); - item->SendEvent(); + // clicking on the item selects it, clicking on the checkmark toggles + if ( event.GetX() <= wxOwnerDrawn::GetDefaultMarginWidth() ) + { + int nItem = HitTest(event.GetX(), event.GetY()); + + if ( nItem != wxNOT_FOUND ) + { + wxCheckListBoxItem *item = GetItem(nItem); + item->Toggle(); + item->SendEvent(); + } + //else: it's not an error, just click outside of client zone + } + else + { + // implement default behaviour: clicking on the item selects it + event.Skip(); } - //else: it's not an error, just click outside of client zone - } - else { - // implement default behaviour: clicking on the item selects it - event.Skip(); - } } int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const @@ -521,7 +524,7 @@ int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const MAKELPARAM(x, y) ); - return nItem >= (int)m_noItems ? wxNOT_FOUND : nItem; + return nItem >= (int)m_noItems ? wxNOT_FOUND : nItem; } diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index be319a9132..6319f4ae2e 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -236,7 +236,7 @@ int wxChoice::DoAppend(const wxString& item) return n; } -int wxChoice::DoInsert(const wxString& item, int pos) +int wxChoice::DoInsert(const wxString& item, unsigned int pos) { wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); @@ -256,7 +256,7 @@ int wxChoice::DoInsert(const wxString& item, int pos) return n; } -void wxChoice::Delete(int n) +void wxChoice::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") ); @@ -289,8 +289,8 @@ void wxChoice::Free() { if ( HasClientObjectData() ) { - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { delete GetClientObject(n); } @@ -326,9 +326,9 @@ void wxChoice::SetSelection(int n) // string list functions // ---------------------------------------------------------------------------- -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { - return (size_t)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0); + return (unsigned int)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0); } int wxChoice::FindString(const wxString& s, bool bCase) const @@ -336,11 +336,11 @@ int wxChoice::FindString(const wxString& s, bool bCase) const #if defined(__WATCOMC__) && defined(__WIN386__) // For some reason, Watcom in WIN386 mode crashes in the CB_FINDSTRINGEXACT message. // wxChoice::Do it the long way instead. - size_t count = GetCount(); - for ( size_t i = 0; i < count; i++ ) + unsigned int count = GetCount(); + for ( unsigned int i = 0; i < count; i++ ) { // as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too - if ( GetString(i).IsSameAs(s, bCase) ) + if (GetString(i).IsSameAs(s, bCase)) return i; } @@ -350,10 +350,10 @@ int wxChoice::FindString(const wxString& s, bool bCase) const //passed to SendMessage, so we have to do it ourselves in that case if ( s.empty() ) { - size_t count = GetCount(); - for ( size_t i = 0; i < count; i++ ) + unsigned int count = GetCount(); + for ( unsigned int i = 0; i < count; i++ ) { - if ( GetString(i).empty() ) + if (GetString(i).empty()) return i; } @@ -374,7 +374,7 @@ int wxChoice::FindString(const wxString& s, bool bCase) const #endif // Watcom/!Watcom } -void wxChoice::SetString(int n, const wxString& s) +void wxChoice::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::SetString") ); @@ -404,7 +404,7 @@ void wxChoice::SetString(int n, const wxString& s) InvalidateBestSize(); } -wxString wxChoice::GetString(int n) const +wxString wxChoice::GetString(unsigned int n) const { int len = (int)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0); @@ -430,7 +430,7 @@ wxString wxChoice::GetString(int n) const // client data // ---------------------------------------------------------------------------- -void wxChoice::DoSetItemClientData( int n, void* clientData ) +void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) { if ( ::SendMessage(GetHwnd(), CB_SETITEMDATA, n, (LPARAM)clientData) == CB_ERR ) @@ -439,7 +439,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData ) } } -void* wxChoice::DoGetItemClientData( int n ) const +void* wxChoice::DoGetItemClientData(unsigned int n) const { LPARAM rc = SendMessage(GetHwnd(), CB_GETITEMDATA, n, 0); if ( rc == CB_ERR ) @@ -453,12 +453,12 @@ void* wxChoice::DoGetItemClientData( int n ) const return (void *)rc; } -void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { DoSetItemClientData(n, clientData); } -wxClientData* wxChoice::DoGetItemClientObject( int n ) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } @@ -516,7 +516,7 @@ void wxChoice::DoSetSize(int x, int y, { // don't make the drop down list too tall, arbitrarily limit it to 40 // items max and also don't leave it empty - size_t nItems = GetCount(); + unsigned int nItems = GetCount(); if ( !nItems ) nItems = 9; else if ( nItems > 24 ) @@ -595,8 +595,8 @@ wxSize wxChoice::DoGetBestSize() const { // find the widest string int wChoice = 0; - const size_t nItems = GetCount(); - for ( size_t i = 0; i < nItems; i++ ) + const unsigned int nItems = GetCount(); + for ( unsigned int i = 0; i < nItems; i++ ) { int wLine; GetTextExtent(GetString(i), &wLine, NULL); diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index d688e9ae92..578f993b1a 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -256,9 +256,9 @@ void wxListBox::DoSetFirstItem(int N) SendMessage(GetHwnd(), LB_SETTOPINDEX, (WPARAM)N, (LPARAM)0); } -void wxListBox::Delete(int N) +void wxListBox::Delete(unsigned int n) { - wxCHECK_RET( IsValid(N), + wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::Delete") ); // for owner drawn objects, the data is used for storing wxOwnerDrawn @@ -268,10 +268,10 @@ void wxListBox::Delete(int N) #endif // !wxUSE_OWNER_DRAWN if ( HasClientObjectData() ) { - delete GetClientObject(N); + delete GetClientObject(n); } - SendMessage(GetHwnd(), LB_DELETESTRING, N, 0); + SendMessage(GetHwnd(), LB_DELETESTRING, n, 0); m_noItems--; SetHorizontalExtent(wxEmptyString); @@ -312,7 +312,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) ListBox_ResetContent(GetHwnd()); m_noItems = choices.GetCount(); - size_t i; + unsigned int i; for (i = 0; i < m_noItems; i++) { ListBox_AddString(GetHwnd(), choices[i]); @@ -328,7 +328,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) WX_CLEAR_ARRAY(m_aItems); // then create new ones - for ( size_t ui = 0; ui < m_noItems; ui++ ) { + for ( unsigned int ui = 0; ui < m_noItems; ui++ ) { wxOwnerDrawn *pNewItem = CreateLboxItem(ui); pNewItem->SetName(choices[ui]); m_aItems.Add(pNewItem); @@ -384,7 +384,7 @@ void wxListBox::Free() #endif // wxUSE_OWNER_DRAWN if ( HasClientObjectData() ) { - for ( size_t n = 0; n < m_noItems; n++ ) + for ( unsigned int n = 0; n < m_noItems; n++ ) { delete GetClientObject(n); } @@ -414,12 +414,12 @@ bool wxListBox::IsSelected(int N) const return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? false : true; } -wxClientData* wxListBox::DoGetItemClientObject(int n) const +wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } -void *wxListBox::DoGetItemClientData(int n) const +void *wxListBox::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( IsValid(n), NULL, wxT("invalid index in wxListBox::GetClientData") ); @@ -427,12 +427,12 @@ void *wxListBox::DoGetItemClientData(int n) const return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0); } -void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { DoSetItemClientData(n, clientData); } -void wxListBox::DoSetItemClientData(int n, void *clientData) +void wxListBox::DoSetItemClientData(unsigned int n, void *clientData) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetClientData") ); @@ -504,28 +504,28 @@ int wxListBox::GetSelection() const } // Find string for position -wxString wxListBox::GetString(int N) const +wxString wxListBox::GetString(unsigned int n) const { - wxCHECK_MSG( IsValid(N), wxEmptyString, + wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("invalid index in wxListBox::GetString") ); - int len = ListBox_GetTextLen(GetHwnd(), N); + int len = ListBox_GetTextLen(GetHwnd(), n); // +1 for terminating NUL wxString result; - ListBox_GetText(GetHwnd(), N, (wxChar*)wxStringBuffer(result, len + 1)); + ListBox_GetText(GetHwnd(), n, (wxChar*)wxStringBuffer(result, len + 1)); return result; } void -wxListBox::DoInsertItems(const wxArrayString& items, int pos) +wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxCHECK_RET( IsValidInsert(pos), wxT("invalid index in wxListBox::InsertItems") ); - int nItems = items.GetCount(); - for ( int i = 0; i < nItems; i++ ) + unsigned int nItems = items.GetCount(); + for ( unsigned int i = 0; i < nItems; i++ ) { int idx = ListBox_InsertString(GetHwnd(), i + pos, items[i]); @@ -561,55 +561,55 @@ int wxListBox::DoListHitTest(const wxPoint& point) const return HIWORD(lRes) ? wxNOT_FOUND : lRes; } -void wxListBox::SetString(int N, const wxString& s) +void wxListBox::SetString(unsigned int n, const wxString& s) { - wxCHECK_RET( IsValid(N), + wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetString") ); // remember the state of the item - bool wasSelected = IsSelected(N); + bool wasSelected = IsSelected(n); void *oldData = NULL; wxClientData *oldObjData = NULL; if ( m_clientDataItemsType == wxClientData_Void ) - oldData = GetClientData(N); + oldData = GetClientData(n); else if ( m_clientDataItemsType == wxClientData_Object ) - oldObjData = GetClientObject(N); + oldObjData = GetClientObject(n); // delete and recreate it - SendMessage(GetHwnd(), LB_DELETESTRING, N, 0); + SendMessage(GetHwnd(), LB_DELETESTRING, n, 0); - int newN = N; - if ( N == (int)(m_noItems - 1) ) + int newN = n; + if ( n == (m_noItems - 1) ) newN = -1; ListBox_InsertString(GetHwnd(), newN, s); // restore the client data if ( oldData ) - SetClientData(N, oldData); + SetClientData(n, oldData); else if ( oldObjData ) - SetClientObject(N, oldObjData); + SetClientObject(n, oldObjData); #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { // update item's text - m_aItems[N]->SetName(s); + m_aItems[n]->SetName(s); // reassign the item's data - ListBox_SetItemData(GetHwnd(), N, m_aItems[N]); + ListBox_SetItemData(GetHwnd(), n, m_aItems[n]); } #endif //USE_OWNER_DRAWN // we may have lost the selection if ( wasSelected ) - Select(N); + Select(n); InvalidateBestSize(); } -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { return m_noItems; } @@ -658,7 +658,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s) GetTextMetrics(dc, &lpTextMetric); - for (size_t i = 0; i < m_noItems; i++) + for (unsigned int i = 0; i < m_noItems; i++) { wxString str = GetString(i); SIZE extentXY; @@ -680,7 +680,7 @@ wxSize wxListBox::DoGetBestSize() const // find the widest string int wLine; int wListbox = 0; - for ( size_t i = 0; i < m_noItems; i++ ) + for (unsigned int i = 0; i < m_noItems; i++) { wxString str(GetString(i)); GetTextExtent(str, &wLine, NULL); @@ -745,7 +745,7 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) else if ( HasClientUntypedData() ) event.SetClientData( GetClientData(n) ); - event.SetString( GetString(n) ); + event.SetString(GetString(n)); event.SetExtraLong( HasMultipleSelection() ? IsSelected(n) : true ); } diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index d8f693b089..b3a6b7f03d 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -269,8 +269,8 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id) int selectedButton = wxNOT_FOUND; - const size_t count = GetCount(); - for ( size_t i = 0; i < count; i++ ) + const unsigned int count = GetCount(); + for ( unsigned int i = 0; i < count; i++ ) { if ( id == wxGetWindowId((*m_radioButtons)[i]) ) { @@ -314,7 +314,7 @@ void wxRadioBox::SendNotificationEvent() { wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId); event.SetInt( m_selectedButton ); - event.SetString( GetString(m_selectedButton) ); + event.SetString(GetString(m_selectedButton)); event.SetEventObject( this ); ProcessCommand(event); } @@ -323,12 +323,12 @@ void wxRadioBox::SendNotificationEvent() // simple accessors // ---------------------------------------------------------------------------- -size_t wxRadioBox::GetCount() const +unsigned int wxRadioBox::GetCount() const { return m_radioButtons->GetCount(); } -void wxRadioBox::SetString(int item, const wxString& label) +void wxRadioBox::SetString(unsigned int item, const wxString& label) { wxCHECK_RET( IsValid(item), wxT("invalid radiobox index") ); @@ -355,7 +355,7 @@ void wxRadioBox::SetSelection(int N) } // Find string for position -wxString wxRadioBox::GetString(int item) const +wxString wxRadioBox::GetString(unsigned int item) const { wxCHECK_MSG( IsValid(item), wxEmptyString, wxT("invalid radiobox index") ); @@ -374,7 +374,7 @@ void wxRadioBox::SetFocus() } // Enable a specific button -bool wxRadioBox::Enable(int item, bool enable) +bool wxRadioBox::Enable(unsigned int item, bool enable) { wxCHECK_MSG( IsValid(item), false, wxT("invalid item in wxRadioBox::Enable()") ); @@ -384,7 +384,7 @@ bool wxRadioBox::Enable(int item, bool enable) return (ret == 0) != enable; } -bool wxRadioBox::IsItemEnabled(int item) const +bool wxRadioBox::IsItemEnabled(unsigned int item) const { wxCHECK_MSG( IsValid(item), false, wxT("invalid item in wxRadioBox::IsItemEnabled()") ); @@ -393,7 +393,7 @@ bool wxRadioBox::IsItemEnabled(int item) const } // Show a specific button -bool wxRadioBox::Show(int item, bool show) +bool wxRadioBox::Show(unsigned int item, bool show) { wxCHECK_MSG( IsValid(item), false, wxT("invalid item in wxRadioBox::Show()") ); @@ -409,7 +409,7 @@ bool wxRadioBox::Show(int item, bool show) return changed; } -bool wxRadioBox::IsItemShown(int item) const +bool wxRadioBox::IsItemShown(unsigned int item) const { wxCHECK_MSG( IsValid(item), false, wxT("invalid item in wxRadioBox::IsItemShown()") ); @@ -432,8 +432,8 @@ wxSize wxRadioBox::GetMaxButtonSize() const // calculate the max button size int widthMax = 0, heightMax = 0; - const size_t count = GetCount(); - for ( size_t i = 0 ; i < count; i++ ) + const unsigned int count = GetCount(); + for ( unsigned int i = 0 ; i < count; i++ ) { int width, height; if ( m_radioWidth[i] < 0 ) @@ -565,8 +565,8 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) int startX = x_offset; int startY = y_offset; - const size_t count = GetCount(); - for ( size_t i = 0; i < count; i++ ) + const unsigned int count = GetCount(); + for (unsigned int i = 0; i < count; i++) { // the last button in the row may be wider than the other ones as the // radiobox may be wider than the sum of the button widths (as it @@ -576,7 +576,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { // item is the last in its row if it is a multiple of the number of // columns or if it is just the last item - size_t n = i + 1; + unsigned int n = i + 1; isLastInTheRow = ((n % GetMajorDim()) == 0) || (n == count); } else // wxRA_SPECIFY_ROWS @@ -651,8 +651,8 @@ WXHRGN wxRadioBox::MSWGetRegionWithoutChildren() ::GetWindowRect(GetHwnd(), &rc); HRGN hrgn = ::CreateRectRgn(rc.left, rc.top, rc.right + 1, rc.bottom + 1); - const size_t count = GetCount(); - for ( size_t i = 0; i < count; ++i ) + const unsigned int count = GetCount(); + for ( unsigned int i = 0; i < count; ++i ) { // don't clip out hidden children if ( !IsItemShown(i) ) diff --git a/src/msw/wince/checklst.cpp b/src/msw/wince/checklst.cpp index 0c4a31c527..b0044c8443 100644 --- a/src/msw/wince/checklst.cpp +++ b/src/msw/wince/checklst.cpp @@ -154,7 +154,7 @@ void wxCheckListBox::OnSize(wxSizeEvent& event) // misc overloaded methods // ----------------------- -void wxCheckListBox::Delete(int n) +void wxCheckListBox::Delete(unsigned int n) { wxCHECK_RET( IsValid( n ), _T("invalid index in wxCheckListBox::Delete") ); @@ -168,7 +168,7 @@ void wxCheckListBox::Delete(int n) // check items // ----------- -bool wxCheckListBox::IsChecked(size_t uiIndex) const +bool wxCheckListBox::IsChecked(unsigned int uiIndex) const { wxCHECK_MSG( IsValid( uiIndex ), false, _T("invalid index in wxCheckListBox::IsChecked") ); @@ -176,7 +176,7 @@ bool wxCheckListBox::IsChecked(size_t uiIndex) const return (ListView_GetCheckState(((HWND)GetHWND()), uiIndex) != 0); } -void wxCheckListBox::Check(size_t uiIndex, bool bCheck) +void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) { wxCHECK_RET( IsValid( uiIndex ), _T("invalid index in wxCheckListBox::Check") ); @@ -189,7 +189,7 @@ void wxCheckListBox::Check(size_t uiIndex, bool bCheck) void wxCheckListBox::Clear() { - int n = (int)GetCount(); + unsigned int n = GetCount(); while ( n > 0 ) { @@ -203,15 +203,15 @@ void wxCheckListBox::Clear() _T("broken wxCheckListBox::Clear()") ); } -size_t wxCheckListBox::GetCount() const +unsigned int wxCheckListBox::GetCount() const { - return (size_t)ListView_GetItemCount( (HWND)GetHWND() ); + return (unsigned int)ListView_GetItemCount( (HWND)GetHWND() ); } int wxCheckListBox::GetSelection() const { int i; - for (i = 0; (size_t)i < GetCount(); i++) + for (i = 0; (unsigned int)i < GetCount(); i++) { int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED); if (selState == LVIS_SELECTED) @@ -224,7 +224,7 @@ int wxCheckListBox::GetSelection() const int wxCheckListBox::GetSelections(wxArrayInt& aSelections) const { int i; - for (i = 0; (size_t)i < GetCount(); i++) + for (i = 0; (unsigned int)i < GetCount(); i++) { int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED); if (selState == LVIS_SELECTED) @@ -234,7 +234,7 @@ int wxCheckListBox::GetSelections(wxArrayInt& aSelections) const return aSelections.GetCount(); } -wxString wxCheckListBox::GetString(int n) const +wxString wxCheckListBox::GetString(unsigned int n) const { const int bufSize = 513; wxChar buf[bufSize]; @@ -250,7 +250,7 @@ bool wxCheckListBox::IsSelected(int n) const return (selState == LVIS_SELECTED); } -void wxCheckListBox::SetString(int n, const wxString& s) +void wxCheckListBox::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid( n ), _T("invalid index in wxCheckListBox::SetString") ); @@ -273,22 +273,22 @@ int wxCheckListBox::DoAppend(const wxString& item) return ret; } -void* wxCheckListBox::DoGetItemClientData(int n) const +void* wxCheckListBox::DoGetItemClientData(unsigned int n) const { return m_itemsClientData.Item(n); } -wxClientData* wxCheckListBox::DoGetItemClientObject(int n) const +wxClientData* wxCheckListBox::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } -void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxCheckListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { wxCHECK_RET( IsValidInsert( pos ), wxT("invalid index in wxListBox::InsertItems") ); - for( size_t i = 0; i < items.GetCount(); i++ ) + for( unsigned int i = 0; i < items.GetCount(); i++ ) { LVITEM newItem; wxZeroMemory(newItem); @@ -311,12 +311,12 @@ void wxCheckListBox::DoSetFirstItem(int n) ListView_Scroll( (HWND)GetHWND(), 0, ppt.y ); } -void wxCheckListBox::DoSetItemClientData(int n, void* clientData) +void wxCheckListBox::DoSetItemClientData(unsigned int n, void* clientData) { m_itemsClientData.Item(n) = clientData; } -void wxCheckListBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxCheckListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { DoSetItemClientData(n, clientData); } @@ -325,7 +325,7 @@ void wxCheckListBox::DoSetItems(const wxArrayString& items, void **clientData) { ListView_SetItemCount( GetHwnd(), GetCount() + items.GetCount() ); - for( size_t i = 0; i < items.GetCount(); i++ ) + for( unsigned int i = 0; i < items.GetCount(); i++ ) { int pos = Append(items[i]); if( pos >= 0 && clientData ) diff --git a/src/msw/wince/choicece.cpp b/src/msw/wince/choicece.cpp index fba1e4d019..36b29d1027 100644 --- a/src/msw/wince/choicece.cpp +++ b/src/msw/wince/choicece.cpp @@ -345,7 +345,7 @@ int wxChoice::DoAppend(const wxString& item) return n; } -int wxChoice::DoInsert(const wxString& item, int pos) +int wxChoice::DoInsert(const wxString& item, unsigned int pos) { wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into choice")); wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); @@ -359,7 +359,7 @@ int wxChoice::DoInsert(const wxString& item, int pos) return n; } -void wxChoice::Delete(int n) +void wxChoice::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") ); @@ -382,8 +382,8 @@ void wxChoice::Free() { if ( HasClientObjectData() ) { - size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { delete GetClientObject(n); } @@ -408,9 +408,9 @@ void wxChoice::SetSelection(int n) // string list functions // ---------------------------------------------------------------------------- -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { - return (size_t)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0); + return (unsigned int)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0); } int wxChoice::FindString(const wxString& s, bool bCase) const @@ -425,7 +425,7 @@ int wxChoice::FindString(const wxString& s, bool bCase) const return pos == LB_ERR ? wxNOT_FOUND : pos; } -void wxChoice::SetString(int n, const wxString& s) +void wxChoice::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::SetString") ); @@ -454,7 +454,7 @@ void wxChoice::SetString(int n, const wxString& s) //else: it's already NULL by default } -wxString wxChoice::GetString(int n) const +wxString wxChoice::GetString(unsigned int n) const { int len = (int)::SendMessage(GetBuddyHwnd(), LB_GETTEXTLEN, n, 0); @@ -480,7 +480,7 @@ wxString wxChoice::GetString(int n) const // client data // ---------------------------------------------------------------------------- -void wxChoice::DoSetItemClientData( int n, void* clientData ) +void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) { if ( ::SendMessage(GetHwnd(), LB_SETITEMDATA, n, (LPARAM)clientData) == LB_ERR ) @@ -489,7 +489,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData ) } } -void* wxChoice::DoGetItemClientData( int n ) const +void* wxChoice::DoGetItemClientData(unsigned int n) const { LPARAM rc = ::SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0); if ( rc == LB_ERR ) @@ -503,12 +503,12 @@ void* wxChoice::DoGetItemClientData( int n ) const return (void *)rc; } -void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { DoSetItemClientData(n, clientData); } -wxClientData* wxChoice::DoGetItemClientObject( int n ) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } diff --git a/src/os2/checklst.cpp b/src/os2/checklst.cpp index 3bb67b387b..8d2d55ee55 100644 --- a/src/os2/checklst.cpp +++ b/src/os2/checklst.cpp @@ -58,9 +58,7 @@ public: // // ctor // - wxCheckListBoxItem( wxCheckListBox* pParent, - size_t nIndex - ); + wxCheckListBoxItem(wxCheckListBox* pParent, size_t nIndex); // // Drawing functions @@ -86,8 +84,7 @@ private: -wxCheckListBoxItem::wxCheckListBoxItem ( wxCheckListBox* pParent, - size_t nIndex) +wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox* pParent, size_t nIndex) :wxOwnerDrawn( wxEmptyString, true /* checkable */ ) { m_bChecked = false; @@ -184,7 +181,7 @@ bool wxCheckListBoxItem::OnDrawItem ( wxDC& rDc, // // Change the state of the item and redraw it // -void wxCheckListBoxItem::Check ( bool bCheck ) +void wxCheckListBoxItem::Check( bool bCheck ) { m_bChecked = bCheck; @@ -270,7 +267,7 @@ wxCheckListBox::wxCheckListBox ( wxWindow* pParent, lStyle | wxLB_OWNERDRAW, rVal, rsName ); } // end of wxCheckListBox::wxCheckListBox -void wxCheckListBox::Delete( int n ) +void wxCheckListBox::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxCheckListBox::Delete") ); @@ -283,12 +280,12 @@ void wxCheckListBox::Delete( int n ) m_aItems.RemoveAt(n); } // end of wxCheckListBox::Delete -void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxCheckListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { // pos is validated in wxListBox wxListBox::DoInsertItems( items, pos ); - int n = items.GetCount(); - for (int i = 0; i < n; i++) + unsigned int n = items.GetCount(); + for (unsigned int i = 0; i < n; i++) { wxOwnerDrawn* pNewItem = CreateItem((size_t)(pos + i)); @@ -304,7 +301,7 @@ void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos) bool wxCheckListBox::SetFont ( const wxFont& rFont ) { - for (size_t i = 0; i < m_aItems.GetCount(); i++) + for (unsigned int i = 0; i < m_aItems.GetCount(); i++) m_aItems[i]->SetFont(rFont); wxListBox::SetFont(rFont); return true; @@ -320,7 +317,7 @@ bool wxCheckListBox::SetFont ( const wxFont& rFont ) // // Create a check list box item // -wxOwnerDrawn* wxCheckListBox::CreateItem ( size_t nIndex ) +wxOwnerDrawn* wxCheckListBox::CreateItem(size_t nIndex) { wxCheckListBoxItem* pItem = new wxCheckListBoxItem( this, nIndex ); return pItem; @@ -360,12 +357,12 @@ long wxCheckListBox::OS2OnMeasure ( WXMEASUREITEMSTRUCT* pItem ) // Check items // ----------- // -bool wxCheckListBox::IsChecked ( size_t uiIndex) const +bool wxCheckListBox::IsChecked(unsigned int uiIndex) const { return GetItem(uiIndex)->IsChecked(); } // end of wxCheckListBox::IsChecked -void wxCheckListBox::Check ( size_t uiIndex, bool bCheck ) +void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) { GetItem(uiIndex)->Check(bCheck); } // end of wxCheckListBox::Check diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp index a6264e0f8d..498e5cd427 100644 --- a/src/os2/choice.cpp +++ b/src/os2/choice.cpp @@ -123,12 +123,12 @@ int wxChoice::DoAppend( return nIndex; } // end of wxChoice::DoAppend -int wxChoice::DoInsert( const wxString& rsItem, int pos ) +int wxChoice::DoInsert( const wxString& rsItem, unsigned int pos ) { wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); - if ((size_t)pos == GetCount()) + if (pos == GetCount()) return DoAppend(rsItem); int nIndex; @@ -146,7 +146,7 @@ int wxChoice::DoInsert( const wxString& rsItem, int pos ) return nIndex; } // end of wxChoice::DoInsert -void wxChoice::Delete( int n ) +void wxChoice::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") ); ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, (MPARAM)0); @@ -182,12 +182,12 @@ void wxChoice::SetSelection( // string list functions // ---------------------------------------------------------------------------- -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { - return((size_t)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMCOUNT, (MPARAM)0, (MPARAM)0))); + return((unsigned int)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMCOUNT, (MPARAM)0, (MPARAM)0))); } // end of wxChoice::GetCount -void wxChoice::SetString( int n, const wxString& rsStr ) +void wxChoice::SetString(unsigned int n, const wxString& rsStr) { LONG nIndexType = 0; void* pData; @@ -215,13 +215,11 @@ void wxChoice::SetString( int n, const wxString& rsStr ) if (pData) { - DoSetItemClientData( n - ,pData - ); + DoSetItemClientData(n, pData); } } // end of wxChoice::SetString -wxString wxChoice::GetString(int n) const +wxString wxChoice::GetString(unsigned int n) const { int nLen = 0; wxString sStr = wxEmptyString; @@ -246,35 +244,23 @@ wxString wxChoice::GetString(int n) const // client data // ---------------------------------------------------------------------------- -void wxChoice::DoSetItemClientData( - int n -, void* pClientData -) +void wxChoice::DoSetItemClientData(unsigned int n, void* pClientData) { ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, (MPARAM)n, MPFROMP(pClientData)); } // end of wxChoice::DoSetItemClientData -void* wxChoice::DoGetItemClientData( int n ) const +void* wxChoice::DoGetItemClientData(unsigned int n) const { - MRESULT rc = 0L; - - rc = ::WinSendMsg(GetHwnd(), LM_QUERYITEMHANDLE, (MPARAM)n, (MPARAM)0); + MRESULT rc = ::WinSendMsg(GetHwnd(), LM_QUERYITEMHANDLE, (MPARAM)n, (MPARAM)0); return((void*)rc); -} // end of wxChoice::DoSetItemClientData +} // end of wxChoice::DoGetItemClientData -void wxChoice::DoSetItemClientObject( - int n -, wxClientData* pClientData -) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* pClientData) { - DoSetItemClientData( n - ,pClientData - ); + DoSetItemClientData(n, pClientData); } // end of wxChoice::DoSetItemClientObject -wxClientData* wxChoice::DoGetItemClientObject( - int n -) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } // end of wxChoice::DoGetItemClientObject @@ -315,9 +301,9 @@ wxSize wxChoice::DoGetBestSize() const int nCy; wxFont vFont = (wxFont)GetFont(); - const size_t nItems = GetCount(); + const unsigned int nItems = GetCount(); - for (size_t i = 0; i < nItems; i++) + for (unsigned int i = 0; i < nItems; i++) { wxString sStr(GetString(i)); GetTextExtent( sStr, &nLineWidth, NULL ); @@ -341,12 +327,10 @@ wxSize wxChoice::DoGetBestSize() const // // Choice drop-down list depends on number of items (limited to 10) // - size_t nStrings = nItems == 0 ? 10 : wxMin(10, nItems) + 1; - int nChoiceHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy) * nStrings; + size_t nStrings = nItems == 0 ? 10 : wxMin(10, nItems) + 1; + int nChoiceHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy) * nStrings; - return wxSize( nChoiceWidth - ,nChoiceHeight - ); + return wxSize(nChoiceWidth, nChoiceHeight); } // end of wxChoice::DoGetBestSize MRESULT wxChoice::OS2WindowProc( @@ -397,9 +381,9 @@ void wxChoice::Free() { if (HasClientObjectData()) { - const size_t nCount = GetCount(); + const unsigned int nCount = GetCount(); - for (size_t n = 0; n < nCount; n++) + for (unsigned int n = 0; n < nCount; n++) { delete GetClientObject(n); } diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index 4a057dea63..b8adb5cec7 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -252,22 +252,22 @@ void wxListBox::DoSetFirstItem(int N) ::WinSendMsg(GetHwnd(), LM_SETTOPINDEX, MPFROMLONG(N), (MPARAM)0); } // end of wxListBox::DoSetFirstItem -void wxListBox::Delete(int N) +void wxListBox::Delete(unsigned int n) { - wxCHECK_RET( IsValid(N), + wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::Delete") ); #if wxUSE_OWNER_DRAWN - delete m_aItems[N]; - m_aItems.RemoveAt(N); + delete m_aItems[n]; + m_aItems.RemoveAt(n); #else // !wxUSE_OWNER_DRAWN if (HasClientObjectData()) { - delete GetClientObject(N); + delete GetClientObject(n); } #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN - ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)N, (MPARAM)0); + ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, (MPARAM)0); m_nNumItems--; } // end of wxListBox::DoSetFirstItem @@ -312,7 +312,7 @@ void wxListBox::DoSetItems( const wxArrayString& raChoices, } ::WinSendMsg(GetHwnd(), LM_DELETEALL, (MPARAM)0, (MPARAM)0); m_nNumItems = raChoices.GetCount(); - for (size_t i = 0; i < m_nNumItems; i++) + for (unsigned int i = 0; i < m_nNumItems; i++) { if (m_windowStyle & wxLB_SORT) lIndexType = LIT_SORTASCENDING; @@ -342,9 +342,9 @@ void wxListBox::DoSetItems( const wxArrayString& raChoices, // // Then create new ones // - for (size_t ui = 0; ui < m_nNumItems; ui++) + for (unsigned int ui = 0; ui < m_nNumItems; ui++) { - wxOwnerDrawn* pNewItem = CreateItem(ui); + wxOwnerDrawn* pNewItem = CreateItem(ui); pNewItem->SetName(raChoices[ui]); m_aItems.Add(pNewItem); @@ -358,7 +358,7 @@ void wxListBox::DoSetItems( const wxArrayString& raChoices, void wxListBox::Clear() { #if wxUSE_OWNER_DRAWN - size_t lUiCount = m_aItems.Count(); + unsigned int lUiCount = m_aItems.Count(); while (lUiCount-- != 0) { @@ -369,7 +369,7 @@ void wxListBox::Clear() #else // !wxUSE_OWNER_DRAWN if (HasClientObjectData()) { - for (size_t n = 0; n < (size_t)m_lNumItems; n++) + for (unsigned int n = 0; n < m_lNumItems; n++) { delete GetClientObject(n); } @@ -414,12 +414,12 @@ bool wxListBox::IsSelected( int N ) const return (lItem == (LONG)N && lItem != LIT_NONE); } // end of wxListBox::IsSelected -wxClientData* wxListBox::DoGetItemClientObject(int n) const +wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } -void* wxListBox::DoGetItemClientData(int n) const +void* wxListBox::DoGetItemClientData(unsigned int n) const { wxCHECK_MSG( IsValid(n), NULL, wxT("invalid index in wxListBox::GetClientData") ); @@ -427,12 +427,12 @@ void* wxListBox::DoGetItemClientData(int n) const return((void *)::WinSendMsg(GetHwnd(), LM_QUERYITEMHANDLE, MPFROMLONG(n), (MPARAM)0)); } // end of wxListBox::DoGetItemClientData -void wxListBox::DoSetItemClientObject(int n, wxClientData* pClientData) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* pClientData) { DoSetItemClientData(n, pClientData); } // end of wxListBox::DoSetItemClientObject -void wxListBox::DoSetItemClientData(int n, void* pClientData) +void wxListBox::DoSetItemClientData(unsigned int n, void* pClientData) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetClientData") ); @@ -533,33 +533,32 @@ int wxListBox::GetSelection() const )); } // end of wxListBox::GetSelection -wxString wxListBox::GetString( int N ) const +wxString wxListBox::GetString(unsigned int n) const { LONG lLen = 0; wxChar* zBuf; wxString sResult; - wxCHECK_MSG( IsValid(N), wxEmptyString, + wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("invalid index in wxListBox::GetClientData") ); - lLen = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)N, (MPARAM)0)); + lLen = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)n, (MPARAM)0)); zBuf = new wxChar[lLen + 1]; - ::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT((SHORT)N, (SHORT)lLen), (MPARAM)zBuf); + ::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT((SHORT)n, (SHORT)lLen), (MPARAM)zBuf); zBuf[lLen] = '\0'; sResult = zBuf; delete [] zBuf; return sResult; } // end of wxListBox::GetString -void wxListBox::DoInsertItems( const wxArrayString& asItems, - int nPos ) +void wxListBox::DoInsertItems(const wxArrayString& asItems, unsigned int nPos) { wxCHECK_RET( IsValidInsert(nPos), wxT("invalid index in wxListBox::InsertItems") ); - size_t nItems = asItems.GetCount(); + unsigned int nItems = asItems.GetCount(); - for (size_t i = 0; i < nItems; i++) + for (unsigned int i = 0; i < nItems; i++) { int nIndex = (int)::WinSendMsg( GetHwnd(), LM_INSERTITEM, @@ -580,35 +579,35 @@ void wxListBox::DoInsertItems( const wxArrayString& asItems, } } // end of wxListBox::DoInsertItems -void wxListBox::SetString(int N, const wxString& rsString) +void wxListBox::SetString(unsigned int n, const wxString& rsString) { - wxCHECK_RET( IsValid(N), + wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetString") ); // // Remember the state of the item // - bool bWasSelected = IsSelected(N); + bool bWasSelected = IsSelected(n); void* pOldData = NULL; wxClientData* pOldObjData = NULL; if (m_clientDataItemsType == wxClientData_Void) - pOldData = GetClientData(N); + pOldData = GetClientData(n); else if (m_clientDataItemsType == wxClientData_Object) - pOldObjData = GetClientObject(N); + pOldObjData = GetClientObject(n); // // Delete and recreate it // ::WinSendMsg( GetHwnd() ,LM_DELETEITEM - ,(MPARAM)N + ,(MPARAM)n ,(MPARAM)0 ); - int nNewN = N; + int nNewN = n; - if (N == (int)(m_nNumItems - 1)) + if (n == (int)(m_nNumItems - 1)) nNewN = -1; ::WinSendMsg( GetHwnd() @@ -621,30 +620,26 @@ void wxListBox::SetString(int N, const wxString& rsString) // Restore the client data // if (pOldData) - SetClientData( N - ,pOldData - ); + SetClientData(n, pOldData); else if (pOldObjData) - SetClientObject( N - ,pOldObjData - ); + SetClientObject(n, pOldObjData); // // We may have lost the selection // if (bWasSelected) - Select(N); + Select(n); #if wxUSE_OWNER_DRAWN if (m_windowStyle & wxLB_OWNERDRAW) // // Update item's text // - m_aItems[N]->SetName(rsString); + m_aItems[n]->SetName(rsString); #endif //USE_OWNER_DRAWN } // end of wxListBox::SetString -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { return m_nNumItems; } @@ -664,7 +659,7 @@ wxSize wxListBox::DoGetBestSize() const int nCy; wxFont vFont = (wxFont)GetFont(); - for (size_t i = 0; i < m_nNumItems; i++) + for (unsigned int i = 0; i < m_nNumItems; i++) { wxString vStr(GetString(i)); diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index d2ef991a12..94808ae14b 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -81,7 +81,7 @@ wxRadioBox::~wxRadioBox() wxRemoveHandleAssociation(this); if (m_ahRadioButtons) { - for (size_t i = 0; i < m_nNoItems; i++) + for (unsigned int i = 0; i < m_nNoItems; i++) { wxWindow* pWin = wxFindWinFromHandle((WXHWND)m_ahRadioButtons[i]); wxRemoveHandleAssociation(pWin); @@ -104,8 +104,8 @@ void wxRadioBox::Command ( wxCommandEvent& rEvent ) bool wxRadioBox::ContainsHWND( WXHWND hWnd ) const { - size_t nCount = GetCount(); - size_t i; + unsigned int nCount = GetCount(); + unsigned int i; for (i = 0; i < nCount; i++) { @@ -178,7 +178,7 @@ bool wxRadioBox::Create( wxWindow* pParent, // // Now we can set m_nNoItems and let SetMajorDim set m_numCols/m_numRows // - m_nNoItems = (size_t)nNum; + m_nNoItems = (unsigned int)nNum; SetMajorDim(nMajorDim == 0 ? nNum : nMajorDim, lStyle); m_ahRadioButtons = new WXHWND[nNum]; @@ -406,7 +406,7 @@ void wxRadioBox::DoSetSize( nStartX = nXOffset; nStartY = nYOffset; - for (size_t i = 0; i < m_nNoItems; i++) + for (unsigned int i = 0; i < m_nNoItems; i++) { // // The last button in the row may be wider than the other ones as the @@ -510,7 +510,7 @@ void wxRadioBox::DoSetSize( } } // end of wxRadioBox::DoSetSize -bool wxRadioBox::Enable(int nItem, bool bEnable) +bool wxRadioBox::Enable(unsigned int nItem, bool bEnable) { wxCHECK_MSG( IsValid(nItem), false, wxT("invalid item in wxRadioBox::Enable()") ); @@ -523,12 +523,12 @@ bool wxRadioBox::Enable(bool bEnable) { if ( !wxControl::Enable(bEnable) ) return false; - for (size_t i = 0; i < m_nNoItems; i++) + for (unsigned int i = 0; i < m_nNoItems; i++) ::WinEnableWindow((HWND)m_ahRadioButtons[i], bEnable); return true; } // end of wxRadioBox::Enable -size_t wxRadioBox::GetCount() const +unsigned int wxRadioBox::GetCount() const { return m_nNoItems; } // end of wxRadioBox::GetCount @@ -545,7 +545,7 @@ wxSize wxRadioBox::GetMaxButtonSize() const int nWidthMax = 0; int nHeightMax = 0; - for (size_t i = 0 ; i < m_nNoItems; i++) + for (unsigned int i = 0 ; i < m_nNoItems; i++) { int nWidth; int nHeight; @@ -597,7 +597,7 @@ void wxRadioBox::GetSize( int* pnWidth, int* pnHeight ) const if (m_hWnd) wxFindMaxSize( m_hWnd, &vRect ); - for (size_t i = 0; i < m_nNoItems; i++) + for (unsigned int i = 0; i < m_nNoItems; i++) wxFindMaxSize( m_ahRadioButtons[i], &vRect ); if (pnWidth) @@ -607,7 +607,7 @@ void wxRadioBox::GetSize( int* pnWidth, int* pnHeight ) const } // end of wxRadioBox::GetSize // Find string for position -wxString wxRadioBox::GetString( int nNum ) const +wxString wxRadioBox::GetString(unsigned int nNum) const { wxCHECK_MSG( IsValid(nNum), wxEmptyString, wxT("invalid radiobox index") ); return wxGetWindowText(m_ahRadioButtons[nNum]); @@ -616,11 +616,12 @@ wxString wxRadioBox::GetString( int nNum ) const // For single selection items only wxString wxRadioBox::GetStringSelection() const { - wxString sResult; - int nSel = GetSelection(); + wxString sResult; + int nSel = GetSelection(); - if (nSel > -1) + if (nSel != wxNOT_FOUND) sResult = GetString(nSel); + return sResult; } // end of wxRadioBox::GetStringSelection @@ -689,7 +690,7 @@ bool wxRadioBox::OS2Command( WXUINT uCmd, if (wId == GetId()) return true; - for (size_t i = 0; i < m_nNoItems; i++) + for (unsigned int i = 0; i < m_nNoItems; i++) { if (wId == wxGetWindowId(m_ahRadioButtons[i])) { @@ -717,9 +718,10 @@ bool wxRadioBox::OS2Command( WXUINT uCmd, void wxRadioBox::SendNotificationEvent() { - wxCommandEvent vEvent( wxEVT_COMMAND_RADIOBOX_SELECTED - ,m_windowId - ); + wxCommandEvent vEvent( + wxEVT_COMMAND_RADIOBOX_SELECTED, + m_windowId + ); vEvent.SetInt( m_nSelectedButton ); vEvent.SetString( GetString(m_nSelectedButton) ); @@ -750,7 +752,7 @@ bool wxRadioBox::SetFont(const wxFont& rFont) // // Also set the font of our radio buttons // - for (size_t n = 0; n < m_nNoItems; n++) + for (unsigned int n = 0; n < m_nNoItems; n++) { HWND hWndBtn = (HWND)m_ahRadioButtons[n]; @@ -774,10 +776,7 @@ void wxRadioBox::SetSelection( m_nSelectedButton = nNum; } // end of wxRadioBox::SetSelection -void wxRadioBox::SetString( - int nItem -, const wxString& rsLabel -) +void wxRadioBox::SetString(unsigned int nItem, const wxString& rsLabel) { wxCHECK_RET( IsValid(nItem), wxT("invalid radiobox index") ); @@ -803,7 +802,7 @@ bool wxRadioBox::Show(bool bShow) if (!wxControl::Show(bShow)) return false; - for (size_t i = 0; i < m_nNoItems; i++) + for (unsigned int i = 0; i < m_nNoItems; i++) { ::WinShowWindow((HWND)m_ahRadioButtons[i], (BOOL)bShow); } @@ -811,10 +810,7 @@ bool wxRadioBox::Show(bool bShow) } // end of wxRadioBox::Show // Show a specific button -bool wxRadioBox::Show( - int nItem -, bool bShow -) +bool wxRadioBox::Show(unsigned int nItem, bool bShow) { wxCHECK_MSG( IsValid(nItem), false, wxT("invalid item in wxRadioBox::Show()") ); diff --git a/src/palmos/checklst.cpp b/src/palmos/checklst.cpp index 3201417dfd..fe75aeae4d 100644 --- a/src/palmos/checklst.cpp +++ b/src/palmos/checklst.cpp @@ -148,14 +148,14 @@ private: }; wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex) - : wxOwnerDrawn(wxEmptyString, TRUE) // checkable + : wxOwnerDrawn(wxEmptyString, true) // checkable { } bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) { - return FALSE; + return false; } // change the state of the item and redraw it @@ -229,7 +229,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, // misc overloaded methods // ----------------------- -void wxCheckListBox::Delete(int N) +void wxCheckListBox::Delete(unsigned int n) { } @@ -258,12 +258,12 @@ bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) // check items // ----------- -bool wxCheckListBox::IsChecked(size_t uiIndex) const +bool wxCheckListBox::IsChecked(unsigned int uiIndex) const { return false; } -void wxCheckListBox::Check(size_t uiIndex, bool bCheck) +void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) { } @@ -284,4 +284,3 @@ int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const } #endif - diff --git a/src/palmos/choice.cpp b/src/palmos/choice.cpp index b5ff3ed5ee..e0b31045ce 100644 --- a/src/palmos/choice.cpp +++ b/src/palmos/choice.cpp @@ -154,12 +154,12 @@ int wxChoice::DoAppend(const wxString& item) return 0; } -int wxChoice::DoInsert(const wxString& item, int pos) +int wxChoice::DoInsert(const wxString& item, unsigned int pos) { return 0; } -void wxChoice::Delete(int n) +void wxChoice::Delete(unsigned int n) { } @@ -188,40 +188,38 @@ void wxChoice::SetSelection(int n) // string list functions // ---------------------------------------------------------------------------- -size_t wxChoice::GetCount() const +unsigned int wxChoice::GetCount() const { return 0; } -void wxChoice::SetString(int n, const wxString& s) +void wxChoice::SetString(unsigned int n, const wxString& s) { } -wxString wxChoice::GetString(int n) const +wxString wxChoice::GetString(unsigned int n) const { - wxString str; - - return str; + return wxEmptyString; } // ---------------------------------------------------------------------------- // client data // ---------------------------------------------------------------------------- -void wxChoice::DoSetItemClientData( int n, void* clientData ) +void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) { } -void* wxChoice::DoGetItemClientData( int n ) const +void* wxChoice::DoGetItemClientData(unsigned int n) const { return (void *)NULL; } -void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) +void wxChoice::DoSetItemClientObject(unsigned int n, wxClientData* clientData ) { } -wxClientData* wxChoice::DoGetItemClientObject( int n ) const +wxClientData* wxChoice::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } diff --git a/src/palmos/listbox.cpp b/src/palmos/listbox.cpp index 7302ebdaf0..24f38de7a9 100644 --- a/src/palmos/listbox.cpp +++ b/src/palmos/listbox.cpp @@ -177,7 +177,7 @@ void wxListBox::DoSetFirstItem(int N) { } -void wxListBox::Delete(int N) +void wxListBox::Delete(unsigned int n) { } @@ -207,21 +207,21 @@ bool wxListBox::IsSelected(int N) const return false; } -wxClientData* wxListBox::DoGetItemClientObject(int n) const +wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)DoGetItemClientData(n); } -void *wxListBox::DoGetItemClientData(int n) const +void *wxListBox::DoGetItemClientData(unsigned int n) const { return (void *)NULL; } -void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { } -void wxListBox::DoSetItemClientData(int n, void *clientData) +void wxListBox::DoSetItemClientData(unsigned int n, void *clientData) { } @@ -238,23 +238,21 @@ int wxListBox::GetSelection() const } // Find string for position -wxString wxListBox::GetString(int N) const +wxString wxListBox::GetString(unsigned int n) const { - wxString result; - - return result; + return wxEmptyString; } void -wxListBox::DoInsertItems(const wxArrayString& items, int pos) +wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { } -void wxListBox::SetString(int N, const wxString& s) +void wxListBox::SetString(unsigned int n, const wxString& s) { } -size_t wxListBox::GetCount() const +unsigned int wxListBox::GetCount() const { return 0; } diff --git a/src/palmos/radiobox.cpp b/src/palmos/radiobox.cpp index 03b015e38c..ed5c2b3324 100644 --- a/src/palmos/radiobox.cpp +++ b/src/palmos/radiobox.cpp @@ -112,7 +112,7 @@ void wxRadioBox::Init() m_size = wxSize(0,0); } -size_t wxRadioBox::GetCount() const +unsigned int wxRadioBox::GetCount() const { return m_radios.GetCount(); } @@ -160,9 +160,9 @@ bool wxRadioBox::Create(wxWindow *parent, return false; int i = 0; - for ( int j = 0; j < minor; j++ ) + for ( unsigned int j = 0; j < minor; j++ ) { - for ( int k = 0; k < GetMajorDim(); k++ ) + for ( unsigned int k = 0; k < GetMajorDim(); k++ ) { if(i 0) minor++; - size_t i = 0; - for ( int j = 0; j < minor; j++ ) + unsigned int i = 0; + for ( unsigned int j = 0; j < minor; j++ ) { - for ( int k = 0; k < GetMajorDim(); k++ ) + for ( unsigned int k = 0; k < GetMajorDim(); k++ ) { if(i= 0 && x < renderer->GetCheckBitmapSize().x && item >= 0 && - (size_t)item < lbox->GetCount() ) + (unsigned int)item < lbox->GetCount() ) { lbox->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE, item); diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index 43e9e55172..fd5a4d5886 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -796,29 +796,29 @@ void wxComboBox::Clear() GetText()->SetValue(wxEmptyString); } -void wxComboBox::Delete(int n) +void wxComboBox::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::Delete") ); - if (GetSelection() == n) + if (GetSelection() == (int)n) GetText()->SetValue(wxEmptyString); GetLBox()->Delete(n); } -size_t wxComboBox::GetCount() const +unsigned int wxComboBox::GetCount() const { return GetLBox()->GetCount(); } -wxString wxComboBox::GetString(int n) const +wxString wxComboBox::GetString(unsigned int n) const { wxCHECK_MSG( IsValid(n), wxEmptyString, _T("invalid index in wxComboBox::GetString") ); return GetLBox()->GetString(n); } -void wxComboBox::SetString(int n, const wxString& s) +void wxComboBox::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::SetString") ); @@ -856,34 +856,34 @@ int wxComboBox::DoAppend(const wxString& item) return GetLBox()->Append(item); } -int wxComboBox::DoInsert(const wxString& item, int pos) +int wxComboBox::DoInsert(const wxString& item, unsigned int pos) { wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index")); - if ((size_t)pos == GetCount()) + if (pos == GetCount()) return DoAppend(item); GetLBox()->Insert(item, pos); return pos; } -void wxComboBox::DoSetItemClientData(int n, void* clientData) +void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) { GetLBox()->SetClientData(n, clientData); } -void *wxComboBox::DoGetItemClientData(int n) const +void *wxComboBox::DoGetItemClientData(unsigned int n) const { return GetLBox()->GetClientData(n); } -void wxComboBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { GetLBox()->SetClientObject(n, clientData); } -wxClientData* wxComboBox::DoGetItemClientObject(int n) const +wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const { return GetLBox()->GetClientObject(n); } diff --git a/src/univ/listbox.cpp b/src/univ/listbox.cpp index 663611a6c7..c54214e879 100644 --- a/src/univ/listbox.cpp +++ b/src/univ/listbox.cpp @@ -168,7 +168,7 @@ int wxCMPFUNC_CONV wxListBoxSortNoCase(wxString* s1, wxString* s2) int wxListBox::DoAppendOnly(const wxString& item) { - size_t index; + unsigned int index; if ( IsSorted() ) { @@ -211,14 +211,14 @@ int wxListBox::DoAppend(const wxString& item) return index; } -void wxListBox::DoInsertItems(const wxArrayString& items, int pos) +void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) { // the position of the item being added to a sorted listbox can't be // specified wxCHECK_RET( !IsSorted(), _T("can't insert items into sorted listbox") ); - size_t count = items.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = items.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_strings->Insert(items[n], pos + n); m_itemsClientData.Insert(NULL, pos + n); @@ -241,16 +241,16 @@ void wxListBox::DoSetItems(const wxArrayString& items, void **clientData) { DoClear(); - size_t count = items.GetCount(); + unsigned int count = items.GetCount(); if ( !count ) return; m_strings->Alloc(count); m_itemsClientData.Alloc(count); - for ( size_t n = 0; n < count; n++ ) + for ( unsigned int n = 0; n < count; n++ ) { - size_t index = DoAppendOnly(items[n]); + unsigned int index = DoAppendOnly(items[n]); m_itemsClientData.Insert(clientData ? clientData[n] : NULL, index); } @@ -260,7 +260,7 @@ void wxListBox::DoSetItems(const wxArrayString& items, void **clientData) RefreshAll(); } -void wxListBox::SetString(int n, const wxString& s) +void wxListBox::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( !IsSorted(), _T("can't set string in sorted listbox") ); @@ -301,8 +301,8 @@ void wxListBox::DoClear() if ( HasClientObjectData() ) { - size_t count = m_itemsClientData.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = m_itemsClientData.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { delete (wxClientData *) m_itemsClientData[n]; } @@ -325,7 +325,7 @@ void wxListBox::Clear() RefreshAll(); } -void wxListBox::Delete(int n) +void wxListBox::Delete(unsigned int n) { wxCHECK_RET( IsValid(n), _T("invalid index in wxListBox::Delete") ); @@ -344,7 +344,7 @@ void wxListBox::Delete(int n) m_itemsClientData.RemoveAt(n); // when the item disappears we must not keep using its index - if ( n == m_current ) + if ( (int)n == m_current ) { m_current = -1; } @@ -357,8 +357,8 @@ void wxListBox::Delete(int n) // update the selections array: the indices of all seletected items after // the one being deleted must change and the item itselfm ust be removed int index = wxNOT_FOUND; - size_t count = m_selections.GetCount(); - for ( size_t item = 0; item < count; item++ ) + unsigned int count = m_selections.GetCount(); + for ( unsigned int item = 0; item < count; item++ ) { if ( m_selections[item] == n ) { @@ -392,22 +392,22 @@ void wxListBox::Delete(int n) // client data handling // ---------------------------------------------------------------------------- -void wxListBox::DoSetItemClientData(int n, void* clientData) +void wxListBox::DoSetItemClientData(unsigned int n, void* clientData) { m_itemsClientData[n] = clientData; } -void *wxListBox::DoGetItemClientData(int n) const +void *wxListBox::DoGetItemClientData(unsigned int n) const { return m_itemsClientData[n]; } -void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) +void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) { m_itemsClientData[n] = clientData; } -wxClientData* wxListBox::DoGetItemClientObject(int n) const +wxClientData* wxListBox::DoGetItemClientObject(unsigned int n) const { return (wxClientData *)m_itemsClientData[n]; } @@ -476,7 +476,7 @@ int wxListBox::GetSelections(wxArrayInt& selections) const { // always return sorted array to the user selections = m_selections; - size_t count = m_selections.GetCount(); + unsigned int count = m_selections.GetCount(); // don't call sort on an empty array if ( count ) @@ -574,7 +574,7 @@ void wxListBox::UpdateScrollbars() wxSize size = GetClientSize(); // is our height enough to show all items? - size_t nLines = GetCount(); + unsigned int nLines = GetCount(); wxCoord lineHeight = GetLineHeight(); bool showScrollbarY = (int)nLines*lineHeight > size.y; @@ -705,9 +705,9 @@ void wxListBox::DoDraw(wxControlRenderer *renderer) // get the items which must be redrawn wxCoord lineHeight = GetLineHeight(); - size_t itemFirst = yTop / lineHeight, - itemLast = (yBottom + lineHeight - 1) / lineHeight, - itemMax = m_strings->GetCount(); + unsigned int itemFirst = yTop / lineHeight, + itemLast = (yBottom + lineHeight - 1) / lineHeight, + itemMax = m_strings->GetCount(); if ( itemFirst >= itemMax ) return; @@ -776,8 +776,8 @@ wxCoord wxListBox::GetMaxWidth() const { wxListBox *self = wxConstCast(this, wxListBox); wxCoord width; - size_t count = m_strings->GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = m_strings->GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { GetTextExtent(this->GetString(n), &width, NULL); if ( width > m_maxWidth ) @@ -833,8 +833,8 @@ wxSize wxListBox::DoGetBestClientSize() const wxCoord width = 0, height = 0; - size_t count = m_strings->GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = m_strings->GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { wxCoord w,h; GetTextExtent(this->GetString(n), &w, &h); @@ -913,7 +913,7 @@ void wxListBox::SetCurrentItem(int n) bool wxListBox::FindItem(const wxString& prefix, bool strictlyAfter) { - size_t count = GetCount(); + unsigned int count = GetCount(); if ( count==0 ) { // empty listbox, we can't find anything in it @@ -1055,7 +1055,7 @@ void wxListBox::ExtendSelection(int itemTo) SetSelection(n); } - size_t count = GetCount(); + unsigned int count = GetCount(); for ( ; n < (int)count; n++ ) { Deselect(n); @@ -1230,7 +1230,7 @@ int wxStdListboxInputHandler::FixItemIndex(const wxListBox *lbox, // mouse is above the first item item = 0; } - else if ( (size_t)item >= lbox->GetCount() ) + else if ( (unsigned int)item >= lbox->GetCount() ) { // mouse is below the last item item = lbox->GetCount() - 1; @@ -1241,7 +1241,7 @@ int wxStdListboxInputHandler::FixItemIndex(const wxListBox *lbox, bool wxStdListboxInputHandler::IsValidIndex(const wxListBox *lbox, int item) { - return item >= 0 && (size_t)item < lbox->GetCount(); + return item >= 0 && (unsigned int)item < lbox->GetCount(); } wxControlAction diff --git a/src/univ/radiobox.cpp b/src/univ/radiobox.cpp index a01ada44bd..b51b63aecb 100644 --- a/src/univ/radiobox.cpp +++ b/src/univ/radiobox.cpp @@ -197,8 +197,8 @@ wxRadioBox::~wxRadioBox() // the buttons themselves: this must be done as the user code expects them // to disappear now and not some time later when they will be deleted by // our (common) parent - size_t count = m_buttons.GetCount(); - for ( size_t n = 0; n < count; n++ ) + unsigned int count = m_buttons.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_buttons[n]->PopEventHandler(true /* delete it */); @@ -282,7 +282,7 @@ void wxRadioBox::OnRadioButton(wxEvent& event) // methods forwarded to the buttons // ---------------------------------------------------------------------------- -wxString wxRadioBox::GetString(int n) const +wxString wxRadioBox::GetString(unsigned int n) const { wxCHECK_MSG( IsValid(n), wxEmptyString, _T("invalid index in wxRadioBox::GetString") ); @@ -290,35 +290,35 @@ wxString wxRadioBox::GetString(int n) const return m_buttons[n]->GetLabel(); } -void wxRadioBox::SetString(int n, const wxString& label) +void wxRadioBox::SetString(unsigned int n, const wxString& label) { wxCHECK_RET( IsValid(n), _T("invalid index in wxRadioBox::SetString") ); m_buttons[n]->SetLabel(label); } -bool wxRadioBox::Enable(int n, bool enable) +bool wxRadioBox::Enable(unsigned int n, bool enable) { wxCHECK_MSG( IsValid(n), false, _T("invalid index in wxRadioBox::Enable") ); return m_buttons[n]->Enable(enable); } -bool wxRadioBox::IsItemEnabled(int n) const +bool wxRadioBox::IsItemEnabled(unsigned int n) const { wxCHECK_MSG( IsValid(n), false, _T("invalid index in wxRadioBox::IsItemEnabled") ); return m_buttons[n]->IsEnabled(); } -bool wxRadioBox::Show(int n, bool show) +bool wxRadioBox::Show(unsigned int n, bool show) { wxCHECK_MSG( IsValid(n), false, _T("invalid index in wxRadioBox::Show") ); return m_buttons[n]->Show(show); } -bool wxRadioBox::IsItemShown(int n) const +bool wxRadioBox::IsItemShown(unsigned int n) const { wxCHECK_MSG( IsValid(n), false, _T("invalid index in wxRadioBox::IsItemShown") ); @@ -335,8 +335,8 @@ bool wxRadioBox::Enable(bool enable) return false; // also enable/disable the buttons - const size_t count = m_buttons.GetCount(); - for ( size_t n = 0; n < count; n++ ) + const unsigned int count = m_buttons.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { Enable(n, enable); } @@ -350,8 +350,8 @@ bool wxRadioBox::Show(bool show) return false; // also show/hide the buttons - const size_t count = m_buttons.GetCount(); - for ( size_t n = 0; n < count; n++ ) + const unsigned int count = m_buttons.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { Show(n, show); } @@ -375,8 +375,8 @@ void wxRadioBox::DoSetToolTip(wxToolTip *tooltip) wxControl::DoSetToolTip(tooltip); // Also set them for all Radio Buttons - const size_t count = m_buttons.GetCount(); - for ( size_t n = 0; n < count; n++ ) + const unsigned int count = m_buttons.GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { if (tooltip) m_buttons[n]->SetToolTip(tooltip->GetTip()); @@ -395,8 +395,8 @@ wxSize wxRadioBox::GetMaxButtonSize() const int widthMax, heightMax, width = 0, height = 0; widthMax = heightMax = 0; - const int count = GetCount(); - for ( int n = 0; n < count; n++ ) + const unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_buttons[n]->GetBestSize(&width, &height); @@ -442,8 +442,8 @@ void wxRadioBox::DoMoveWindow(int x0, int y0, int width, int height) int x = x0, y = y0; - const size_t count = GetCount(); - for ( size_t n = 0; n < count; n++ ) + const unsigned int count = GetCount(); + for ( unsigned int n = 0; n < count; n++ ) { m_buttons[n]->SetSize(x, y, sizeBtn.x, sizeBtn.y); -- 2.45.2