Line-up interfaces to use size_t for GetCount()s (and count related api).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38076 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -82,7 +82,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int);
|
virtual void Delete(int);
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int) const;
|
virtual wxString GetString(int) const;
|
||||||
virtual void SetString(int, const wxString&);
|
virtual void SetString(int, const wxString&);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
|
@@ -108,7 +108,7 @@ public:
|
|||||||
// wxItemContainer
|
// wxItemContainer
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int);
|
virtual void Delete(int);
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int) const;
|
virtual wxString GetString(int) const;
|
||||||
virtual void SetString(int, const wxString&);
|
virtual void SetString(int, const wxString&);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
|
@@ -95,7 +95,7 @@ public:
|
|||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
// accessing strings
|
// accessing strings
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: David Elliott
|
// Author: David Elliott
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 2003/03/18
|
// Created: 2003/03/18
|
||||||
// RCS-ID: $Id:
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2003 David Elliott
|
// Copyright: (c) 2003 David Elliott
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
// string access
|
// string access
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& label);
|
virtual void SetString(int n, const wxString& label);
|
||||||
// change the individual radio button state
|
// change the individual radio button state
|
||||||
|
@@ -38,7 +38,7 @@ public:
|
|||||||
// accessing strings
|
// accessing strings
|
||||||
// -----------------
|
// -----------------
|
||||||
|
|
||||||
virtual int GetCount() const = 0;
|
virtual size_t GetCount() const = 0;
|
||||||
bool IsEmpty() const { return GetCount() == 0; }
|
bool IsEmpty() const { return GetCount() == 0; }
|
||||||
|
|
||||||
virtual wxString GetString(int n) const = 0;
|
virtual wxString GetString(int n) const = 0;
|
||||||
@@ -50,9 +50,9 @@ public:
|
|||||||
// supported search type
|
// supported search type
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const
|
virtual int FindString(const wxString& s, bool bCase = false) const
|
||||||
{
|
{
|
||||||
int count = GetCount();
|
size_t count = GetCount();
|
||||||
|
|
||||||
for ( int i = 0; i < count ; i ++ )
|
for ( size_t i = 0; i < count ; ++i )
|
||||||
{
|
{
|
||||||
if (GetString(i).IsSameAs( s , bCase ))
|
if (GetString(i).IsSameAs( s , bCase ))
|
||||||
return i;
|
return i;
|
||||||
@@ -82,7 +82,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
// check that the index is valid
|
// check that the index is valid
|
||||||
inline bool IsValid(int n) const { return n >= 0 && n < GetCount(); }
|
// 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(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxItemContainer : public wxItemContainerImmutable
|
class WXDLLEXPORT wxItemContainer : public wxItemContainerImmutable
|
||||||
|
@@ -69,7 +69,7 @@ public:
|
|||||||
int GetCurrentSelection() const { return GetSelection(); }
|
int GetCurrentSelection() const { return GetSelection(); }
|
||||||
void SetSelection( int n );
|
void SetSelection( int n );
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
wxString GetString( int n ) const;
|
wxString GetString( int n ) const;
|
||||||
void SetString( int n, const wxString& string );
|
void SetString( int n, const wxString& string );
|
||||||
@@ -95,7 +95,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of Create() and DoAppend()
|
// common part of Create() and DoAppend()
|
||||||
int GtkAddHelper(GtkWidget *menu, int pos, const wxString& item);
|
int GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item);
|
||||||
|
|
||||||
// this array is only used for controls with wxCB_SORT style, so only
|
// this array is only used for controls with wxCB_SORT style, so only
|
||||||
// allocate it if it's needed (hence using pointer)
|
// allocate it if it's needed (hence using pointer)
|
||||||
|
@@ -88,8 +88,7 @@ public:
|
|||||||
int GetCurrentSelection() const;
|
int GetCurrentSelection() const;
|
||||||
wxString GetString( int n ) const;
|
wxString GetString( int n ) const;
|
||||||
wxString GetStringSelection() const;
|
wxString GetStringSelection() const;
|
||||||
int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
int Number() const { return GetCount(); }
|
|
||||||
void SetSelection( int n );
|
void SetSelection( int n );
|
||||||
void SetString(int n, const wxString &text);
|
void SetString(int n, const wxString &text);
|
||||||
|
|
||||||
|
@@ -65,7 +65,7 @@ public:
|
|||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
@@ -99,7 +99,7 @@ public:
|
|||||||
|
|
||||||
struct _GtkTreeEntry* GtkGetEntry(int pos) const;
|
struct _GtkTreeEntry* GtkGetEntry(int pos) const;
|
||||||
void GtkInsertItems(const wxArrayString& items,
|
void GtkInsertItems(const wxArrayString& items,
|
||||||
void** clientData, int pos);
|
void** clientData, size_t pos);
|
||||||
void GtkSetSelection(int n, const bool select, const bool blockEvent);
|
void GtkSetSelection(int n, const bool select, const bool blockEvent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -81,7 +81,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// implement wxItemContainerImmutable methods
|
// implement wxItemContainerImmutable methods
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
|
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
|
@@ -69,7 +69,7 @@ public:
|
|||||||
int GetCurrentSelection() const { return GetSelection(); }
|
int GetCurrentSelection() const { return GetSelection(); }
|
||||||
void SetSelection( int n );
|
void SetSelection( int n );
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
wxString GetString( int n ) const;
|
wxString GetString( int n ) const;
|
||||||
void SetString( int n, const wxString& string );
|
void SetString( int n, const wxString& string );
|
||||||
@@ -95,7 +95,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of Create() and DoAppend()
|
// common part of Create() and DoAppend()
|
||||||
int GtkAddHelper(GtkWidget *menu, int pos, const wxString& item);
|
int GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item);
|
||||||
|
|
||||||
// this array is only used for controls with wxCB_SORT style, so only
|
// this array is only used for controls with wxCB_SORT style, so only
|
||||||
// allocate it if it's needed (hence using pointer)
|
// allocate it if it's needed (hence using pointer)
|
||||||
|
@@ -88,8 +88,7 @@ public:
|
|||||||
int GetCurrentSelection() const;
|
int GetCurrentSelection() const;
|
||||||
wxString GetString( int n ) const;
|
wxString GetString( int n ) const;
|
||||||
wxString GetStringSelection() const;
|
wxString GetStringSelection() const;
|
||||||
int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
int Number() const { return GetCount(); }
|
|
||||||
void SetSelection( int n );
|
void SetSelection( int n );
|
||||||
void SetString(int n, const wxString &text);
|
void SetString(int n, const wxString &text);
|
||||||
|
|
||||||
|
@@ -70,7 +70,7 @@ public:
|
|||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
|
@@ -81,7 +81,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// implement wxItemContainerImmutable methods
|
// implement wxItemContainerImmutable methods
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
|
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
virtual int GetCount() const ;
|
virtual size_t GetCount() const ;
|
||||||
virtual int GetSelection() const ;
|
virtual int GetSelection() const ;
|
||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
int GetCurrentSelection() const { return GetSelection(); }
|
int GetCurrentSelection() const { return GetSelection(); }
|
||||||
|
@@ -114,7 +114,7 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
|
|||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
virtual bool IsEditable() const;
|
virtual bool IsEditable() const;
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
|
|
||||||
virtual void Undo();
|
virtual void Undo();
|
||||||
virtual void Redo();
|
virtual void Redo();
|
||||||
|
@@ -71,13 +71,13 @@ public:
|
|||||||
const wxString& name = wxListBoxNameStr);
|
const wxString& name = wxListBoxNameStr);
|
||||||
|
|
||||||
virtual ~wxListBox();
|
virtual ~wxListBox();
|
||||||
virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL);
|
virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL);
|
||||||
|
|
||||||
// implement base class pure virtuals
|
// implement base class pure virtuals
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
@@ -132,7 +132,7 @@ protected:
|
|||||||
// prevent collision with some BSD definitions of macro Free()
|
// prevent collision with some BSD definitions of macro Free()
|
||||||
void FreeData();
|
void FreeData();
|
||||||
|
|
||||||
int m_noItems;
|
size_t m_noItems;
|
||||||
int m_selected;
|
int m_selected;
|
||||||
bool m_suppressSelection ;
|
bool m_suppressSelection ;
|
||||||
wxString m_typeIn ;
|
wxString m_typeIn ;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: radiobox.h
|
// Name: wx/mac/carbon/radiobox.h
|
||||||
// Purpose: wxRadioBox class
|
// Purpose: wxRadioBox class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
virtual void SetSelection(int item);
|
virtual void SetSelection(int item);
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
|
|
||||||
inline virtual int GetCount() const { return m_noItems; } ;
|
virtual size_t GetCount() const { return m_noItems; } ;
|
||||||
|
|
||||||
virtual wxString GetString(int item) const;
|
virtual wxString GetString(int item) const;
|
||||||
virtual void SetString(int item, const wxString& label) ;
|
virtual void SetString(int item, const wxString& label) ;
|
||||||
@@ -80,10 +80,11 @@ public:
|
|||||||
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
||||||
|
|
||||||
void OnRadioButton( wxCommandEvent& event ) ;
|
void OnRadioButton( wxCommandEvent& event ) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxRadioButton *m_radioButtonCycle;
|
wxRadioButton *m_radioButtonCycle;
|
||||||
|
|
||||||
int m_noItems;
|
size_t m_noItems;
|
||||||
int m_noRowsOrCols;
|
int m_noRowsOrCols;
|
||||||
|
|
||||||
// Internal functions
|
// Internal functions
|
||||||
|
@@ -75,7 +75,7 @@ public:
|
|||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
virtual int GetCount() const ;
|
virtual size_t GetCount() const ;
|
||||||
virtual int GetSelection() const ;
|
virtual int GetSelection() const ;
|
||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
|
|
||||||
|
@@ -104,7 +104,7 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
|
|||||||
virtual void Remove(long from, long to);
|
virtual void Remove(long from, long to);
|
||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
virtual int GetCount() const { return m_choice->GetCount() ; }
|
virtual size_t GetCount() const { return m_choice->GetCount() ; }
|
||||||
|
|
||||||
virtual bool IsEditable() const ;
|
virtual bool IsEditable() const ;
|
||||||
|
|
||||||
|
@@ -81,13 +81,13 @@ public:
|
|||||||
const wxString& name = wxListBoxNameStr);
|
const wxString& name = wxListBoxNameStr);
|
||||||
|
|
||||||
virtual ~wxListBox();
|
virtual ~wxListBox();
|
||||||
virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL);
|
virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL);
|
||||||
|
|
||||||
// implement base class pure virtuals
|
// implement base class pure virtuals
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
@@ -156,7 +156,7 @@ protected:
|
|||||||
// prevent collision with some BSD definitions of macro Free()
|
// prevent collision with some BSD definitions of macro Free()
|
||||||
void FreeData();
|
void FreeData();
|
||||||
|
|
||||||
int m_noItems;
|
size_t m_noItems;
|
||||||
int m_selected;
|
int m_selected;
|
||||||
wxString m_typeIn ;
|
wxString m_typeIn ;
|
||||||
long m_lastTypeIn ;
|
long m_lastTypeIn ;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: radiobox.h
|
// Name: wx/mac/classic/radiobox.h
|
||||||
// Purpose: wxRadioBox class
|
// Purpose: wxRadioBox class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
virtual void SetSelection(int item);
|
virtual void SetSelection(int item);
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
|
|
||||||
inline virtual int GetCount() const { return m_noItems; } ;
|
virtual size_t GetCount() const { return m_noItems; } ;
|
||||||
|
|
||||||
virtual wxString GetString(int item) const;
|
virtual wxString GetString(int item) const;
|
||||||
virtual void SetString(int item, const wxString& label) ;
|
virtual void SetString(int item, const wxString& label) ;
|
||||||
@@ -80,10 +80,11 @@ public:
|
|||||||
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
||||||
|
|
||||||
void OnRadioButton( wxCommandEvent& event ) ;
|
void OnRadioButton( wxCommandEvent& event ) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxRadioButton *m_radioButtonCycle;
|
wxRadioButton *m_radioButtonCycle;
|
||||||
|
|
||||||
int m_noItems;
|
size_t m_noItems;
|
||||||
int m_noRowsOrCols;
|
int m_noRowsOrCols;
|
||||||
|
|
||||||
// Internal functions
|
// Internal functions
|
||||||
|
@@ -71,7 +71,7 @@ public:
|
|||||||
const wxString& name = wxChoiceNameStr);
|
const wxString& name = wxChoiceNameStr);
|
||||||
|
|
||||||
// implementation of wxControlWithItems
|
// implementation of wxControlWithItems
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual int DoAppend(const wxString& item);
|
virtual int DoAppend(const wxString& item);
|
||||||
virtual int DoInsert(const wxString& item, int pos);
|
virtual int DoInsert(const wxString& item, int pos);
|
||||||
virtual void DoSetItemClientData(int n, void* clientData);
|
virtual void DoSetItemClientData(int n, void* clientData);
|
||||||
|
@@ -66,7 +66,7 @@ public:
|
|||||||
~wxListBox();
|
~wxListBox();
|
||||||
|
|
||||||
// implementation of wxControlWithItems
|
// implementation of wxControlWithItems
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual int DoAppend(const wxString& item);
|
virtual int DoAppend(const wxString& item);
|
||||||
virtual void DoSetItemClientData(int n, void* clientData);
|
virtual void DoSetItemClientData(int n, void* clientData);
|
||||||
virtual void* DoGetItemClientData(int n) const;
|
virtual void* DoGetItemClientData(int n) const;
|
||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
int m_noItems;
|
size_t m_noItems;
|
||||||
|
|
||||||
// List mapping positions->client data
|
// List mapping positions->client data
|
||||||
wxClientDataDictionary m_clientDataDict;
|
wxClientDataDictionary m_clientDataDict;
|
||||||
|
@@ -84,7 +84,7 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetStringSelection() const;
|
virtual wxString GetStringSelection() const;
|
||||||
virtual bool SetStringSelection(const wxString& s);
|
virtual bool SetStringSelection(const wxString& s);
|
||||||
virtual int GetCount() const { return m_noItems; } ;
|
virtual size_t GetCount() const { return m_noItems; } ;
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
||||||
@@ -103,7 +103,7 @@ protected:
|
|||||||
int width, int height,
|
int width, int height,
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
int m_noItems;
|
size_t m_noItems;
|
||||||
int m_noRowsOrCols;
|
int m_noRowsOrCols;
|
||||||
int m_selectedButton;
|
int m_selectedButton;
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ public:
|
|||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
virtual int GetCurrentSelection() const;
|
virtual int GetCurrentSelection() const;
|
||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
|
@@ -81,7 +81,7 @@ public:
|
|||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
@@ -147,7 +147,7 @@ protected:
|
|||||||
// free memory (common part of Clear() and dtor)
|
// free memory (common part of Clear() and dtor)
|
||||||
void Free();
|
void Free();
|
||||||
|
|
||||||
int m_noItems;
|
size_t m_noItems;
|
||||||
int m_selected;
|
int m_selected;
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
@@ -85,7 +85,7 @@ public:
|
|||||||
// implement the radiobox interface
|
// implement the radiobox interface
|
||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
virtual int GetSelection() const { return m_selectedButton; }
|
virtual int GetSelection() const { return m_selectedButton; }
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& label);
|
virtual void SetString(int n, const wxString& label);
|
||||||
virtual bool Enable(int n, bool enable = true);
|
virtual bool Enable(int n, bool enable = true);
|
||||||
|
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
// public interface derived from wxListBox and lower classes
|
// public interface derived from wxListBox and lower classes
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
virtual int GetSelections(wxArrayInt& aSelections) const;
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
|
@@ -83,7 +83,7 @@ public:
|
|||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
virtual void Clear() ;
|
virtual void Clear() ;
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
|
|
||||||
|
@@ -94,7 +94,7 @@ public:
|
|||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
virtual void Clear(void);
|
virtual void Clear(void);
|
||||||
|
|
||||||
virtual int GetCount(void) const;
|
virtual size_t GetCount() const;
|
||||||
virtual int GetSelection(void) const ;
|
virtual int GetSelection(void) const ;
|
||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
|
|
||||||
|
@@ -106,21 +106,17 @@ public:
|
|||||||
virtual void Clear(void);
|
virtual void Clear(void);
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
|
|
||||||
virtual int GetCount(void) const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& rsString);
|
virtual void SetString(int n, const wxString& rsString);
|
||||||
|
|
||||||
virtual bool IsSelected(int n) const;
|
virtual bool IsSelected(int n) const;
|
||||||
virtual void DoSetSelection( int n
|
virtual void DoSetSelection(int n, bool bSelect);
|
||||||
,bool bSelect
|
|
||||||
);
|
|
||||||
virtual int GetSelection(void) const;
|
virtual int GetSelection(void) const;
|
||||||
virtual int GetSelections(wxArrayInt& raSelections) const;
|
virtual int GetSelections(wxArrayInt& raSelections) const;
|
||||||
|
|
||||||
virtual int DoAppend(const wxString& rsItem);
|
virtual int DoAppend(const wxString& rsItem);
|
||||||
virtual void DoInsertItems( const wxArrayString& raItems
|
virtual void DoInsertItems( const wxArrayString& raItems, int rPos );
|
||||||
,int rPos
|
|
||||||
);
|
|
||||||
virtual void DoSetItems( const wxArrayString& raItems
|
virtual void DoSetItems( const wxArrayString& raItems
|
||||||
,void ** ppClientData
|
,void ** ppClientData
|
||||||
);
|
);
|
||||||
@@ -158,10 +154,9 @@ protected:
|
|||||||
bool HasMultipleSelection(void) const;
|
bool HasMultipleSelection(void) const;
|
||||||
virtual wxSize DoGetBestSize(void) const;
|
virtual wxSize DoGetBestSize(void) const;
|
||||||
|
|
||||||
int m_nNumItems;
|
size_t m_nNumItems;
|
||||||
int m_nSelected;
|
int m_nSelected;
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
//
|
//
|
||||||
// Control items
|
// Control items
|
||||||
|
@@ -125,7 +125,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual int GetCount(void) const;
|
virtual size_t GetCount() const;
|
||||||
inline WXHWND* GetRadioButtons(void) const { return m_ahRadioButtons; }
|
inline WXHWND* GetRadioButtons(void) const { return m_ahRadioButtons; }
|
||||||
int GetSelection(void) const;
|
int GetSelection(void) const;
|
||||||
void GetSize( int* pnX
|
void GetSize( int* pnX
|
||||||
@@ -170,12 +170,13 @@ protected:
|
|||||||
WXHWND* m_ahRadioButtons;
|
WXHWND* m_ahRadioButtons;
|
||||||
int* m_pnRadioWidth; // for bitmaps
|
int* m_pnRadioWidth; // for bitmaps
|
||||||
int* m_pnRadioHeight;
|
int* m_pnRadioHeight;
|
||||||
int m_nNoItems;
|
|
||||||
int m_nSelectedButton;
|
int m_nSelectedButton;
|
||||||
int m_nSizeFlags;
|
int m_nSizeFlags;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
size_t m_nNoItems;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
||||||
}; // end of wxRadioBox
|
}; // end of wxRadioBox
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ public:
|
|||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@ public:
|
|||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
|
|
||||||
@@ -141,7 +141,6 @@ protected:
|
|||||||
// free memory (common part of Clear() and dtor)
|
// free memory (common part of Clear() and dtor)
|
||||||
void Free();
|
void Free();
|
||||||
|
|
||||||
int m_noItems;
|
|
||||||
int m_selected;
|
int m_selected;
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
@@ -88,7 +88,7 @@ public:
|
|||||||
// implement the radiobox interface
|
// implement the radiobox interface
|
||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& label);
|
virtual void SetString(int n, const wxString& label);
|
||||||
|
|
||||||
@@ -139,7 +139,6 @@ protected:
|
|||||||
int *m_radioWidth; // for bitmaps
|
int *m_radioWidth; // for bitmaps
|
||||||
int *m_radioHeight;
|
int *m_radioHeight;
|
||||||
|
|
||||||
int m_noItems;
|
|
||||||
int m_noRowsOrCols;
|
int m_noRowsOrCols;
|
||||||
int m_selectedButton;
|
int m_selectedButton;
|
||||||
|
|
||||||
|
@@ -294,7 +294,7 @@ public:
|
|||||||
// wxControlWithItems methods
|
// wxControlWithItems methods
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
virtual int GetCount() const;
|
virtual size_t GetCount() const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
|
@@ -99,8 +99,8 @@ public:
|
|||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
|
|
||||||
virtual int GetCount() const
|
virtual size_t GetCount() const
|
||||||
{ return (int)m_strings->GetCount(); }
|
{ return m_strings->GetCount(); }
|
||||||
virtual wxString GetString(int n) const
|
virtual wxString GetString(int n) const
|
||||||
{ return m_strings->Item(n); }
|
{ return m_strings->Item(n); }
|
||||||
virtual void SetString(int n, const wxString& s);
|
virtual void SetString(int n, const wxString& s);
|
||||||
|
@@ -84,7 +84,7 @@ public:
|
|||||||
virtual void SetSelection(int n);
|
virtual void SetSelection(int n);
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
|
|
||||||
virtual int GetCount() const { return (int) m_buttons.GetCount(); }
|
virtual size_t GetCount() const { return m_buttons.GetCount(); }
|
||||||
|
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
virtual void SetString(int n, const wxString& label);
|
virtual void SetString(int n, const wxString& label);
|
||||||
|
@@ -499,7 +499,7 @@ void CheckListBoxFrame::OnButtonMove(bool up)
|
|||||||
wxString label = m_pListBox->GetString(selection);
|
wxString label = m_pListBox->GetString(selection);
|
||||||
|
|
||||||
int positionNew = up ? selection - 1 : selection + 2;
|
int positionNew = up ? selection - 1 : selection + 2;
|
||||||
if ( positionNew < 0 || positionNew > m_pListBox->GetCount() )
|
if ( positionNew < 0 || positionNew > (int)m_pListBox->GetCount() )
|
||||||
{
|
{
|
||||||
wxLogStatus(this, wxT("Can't move this item %s"), up ? wxT("up") : wxT("down"));
|
wxLogStatus(this, wxT("Can't move this item %s"), up ? wxT("up") : wxT("down"));
|
||||||
}
|
}
|
||||||
|
@@ -156,9 +156,9 @@ void wxChoice::Delete(int n)
|
|||||||
[(NSPopUpButton*)m_cocoaNSView removeItemAtIndex:n];
|
[(NSPopUpButton*)m_cocoaNSView removeItemAtIndex:n];
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return [(NSPopUpButton*)m_cocoaNSView numberOfItems];
|
return (size_t)[(NSPopUpButton*)m_cocoaNSView numberOfItems];
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxChoice::GetString(int n) const
|
wxString wxChoice::GetString(int n) const
|
||||||
|
@@ -75,6 +75,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_COMBOBOX
|
#if wxUSE_COMBOBOX
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
@@ -260,9 +261,9 @@ void wxComboBox::Delete(int nIndex)
|
|||||||
m_Datas.RemoveAt(nIndex);
|
m_Datas.RemoveAt(nIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxComboBox::GetCount() const
|
size_t wxComboBox::GetCount() const
|
||||||
{
|
{
|
||||||
return [GetNSComboBox() numberOfItems];
|
return (size_t)[GetNSComboBox() numberOfItems];
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxComboBox::GetString(int nIndex) const
|
wxString wxComboBox::GetString(int nIndex) const
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: cocoa/listbox.mm
|
// Name: src/cocoa/listbox.mm
|
||||||
// Purpose: wxListBox
|
// Purpose: wxListBox
|
||||||
// Author: David Elliott
|
// Author: David Elliott
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -224,9 +224,9 @@ void wxListBox::Delete(int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// accessing strings
|
// accessing strings
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
return [m_cocoaItems count];
|
return (size_t)[m_cocoaItems count];
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxListBox::GetString(int n) const
|
wxString wxListBox::GetString(int n) const
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: cocoa/radiobox.mm
|
// Name: src/cocoa/radiobox.mm
|
||||||
// Purpose: wxRadioBox
|
// Purpose: wxRadioBox
|
||||||
// Author: David Elliott
|
// Author: David Elliott
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 2003/02/15
|
// Created: 2003/02/15
|
||||||
// RCS-ID: $Id:
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2003 David Elliott
|
// Copyright: (c) 2003 David Elliott
|
||||||
// Licence: wxWidgets licence
|
// Licence: wxWidgets licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -76,7 +76,7 @@ int wxRadioBox::GetSelection() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// string access
|
// string access
|
||||||
int wxRadioBox::GetCount() const
|
size_t wxRadioBox::GetCount() const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -109,4 +109,3 @@ wxSize wxRadioBox::DoGetBestSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_CHOICE
|
#if wxUSE_CHOICE
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
GtkWidget *menu = gtk_menu_new();
|
GtkWidget *menu = gtk_menu_new();
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (size_t i = 0; i < (size_t)n; i++)
|
||||||
{
|
{
|
||||||
GtkAddHelper(menu, i, choices[i]);
|
GtkAddHelper(menu, i, choices[i]);
|
||||||
}
|
}
|
||||||
@@ -154,9 +154,9 @@ int wxChoice::DoAppend( const wxString &item )
|
|||||||
int wxChoice::DoInsert( const wxString &item, int pos )
|
int wxChoice::DoInsert( const wxString &item, int pos )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice control") );
|
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice control") );
|
||||||
wxCHECK_MSG( (pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
if (pos == GetCount())
|
if ((size_t)pos == GetCount())
|
||||||
return DoAppend(item);
|
return DoAppend(item);
|
||||||
|
|
||||||
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
|
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
|
||||||
@@ -168,7 +168,7 @@ int wxChoice::DoInsert( const wxString &item, int pos )
|
|||||||
m_selection_hack++;
|
m_selection_hack++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GtkAddHelper(menu, pos, item);
|
return GtkAddHelper(menu, (size_t)pos, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
||||||
@@ -246,13 +246,12 @@ void wxChoice::Clear()
|
|||||||
void wxChoice::Delete( int n )
|
void wxChoice::Delete( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );
|
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
|
// 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
|
// in 2.0), hence this dumb implementation -- still better than nothing
|
||||||
int i,
|
size_t i;
|
||||||
count = GetCount();
|
const size_t count = GetCount();
|
||||||
|
|
||||||
wxCHECK_RET( n >= 0 && n < count, _T("invalid index in wxChoice::Delete") );
|
|
||||||
|
|
||||||
// if the item to delete is before the selection, and the selection is valid
|
// 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 ((n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND))
|
||||||
@@ -276,7 +275,7 @@ void wxChoice::Delete( int n )
|
|||||||
items.Alloc(count);
|
items.Alloc(count);
|
||||||
for ( i = 0; i < count; i++ )
|
for ( i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
if ( i != n )
|
if ( i != (size_t)n )
|
||||||
{
|
{
|
||||||
items.Add(GetString(i));
|
items.Add(GetString(i));
|
||||||
if ( hasClientData )
|
if ( hasClientData )
|
||||||
@@ -418,12 +417,12 @@ wxString wxChoice::GetString( int n ) const
|
|||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid choice") );
|
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) ) );
|
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
GList *child = menu_shell->children;
|
GList *child = menu_shell->children;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
@@ -441,7 +440,7 @@ void wxChoice::SetSelection( int n )
|
|||||||
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
|
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
|
||||||
|
|
||||||
// set the local selection variable manually
|
// set the local selection variable manually
|
||||||
if ((n >= 0) && (n < GetCount()))
|
if ((n >= 0) && (n < (int)GetCount()))
|
||||||
{
|
{
|
||||||
// a valid selection has been made
|
// a valid selection has been made
|
||||||
m_selection_hack = n;
|
m_selection_hack = n;
|
||||||
@@ -484,9 +483,9 @@ void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item)
|
int wxChoice::GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG((pos>=0) && (pos<=(int)m_clientList.GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
GtkWidget *menu_item = gtk_menu_item_new_with_label( wxGTK_CONV( item ) );
|
GtkWidget *menu_item = gtk_menu_item_new_with_label( wxGTK_CONV( item ) );
|
||||||
|
|
||||||
@@ -514,7 +513,7 @@ int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item)
|
|||||||
// if we're called from ctor (and GtkMenuShell is still NULL)
|
// if we're called from ctor (and GtkMenuShell is still NULL)
|
||||||
|
|
||||||
// normal control, just append
|
// normal control, just append
|
||||||
if (pos == (int)m_clientList.GetCount())
|
if (pos == m_clientList.GetCount())
|
||||||
{
|
{
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL(menu), menu_item );
|
gtk_menu_shell_append( GTK_MENU_SHELL(menu), menu_item );
|
||||||
m_clientList.Append( (wxObject*) NULL );
|
m_clientList.Append( (wxObject*) NULL );
|
||||||
|
@@ -10,10 +10,10 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#include "wx/combobox.h"
|
|
||||||
|
|
||||||
#if wxUSE_COMBOBOX
|
#if wxUSE_COMBOBOX
|
||||||
|
|
||||||
|
#include "wx/combobox.h"
|
||||||
|
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/arrstr.h"
|
#include "wx/arrstr.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
@@ -447,11 +447,11 @@ int wxComboBox::DoAppend( const wxString &item )
|
|||||||
EnableEvents();
|
EnableEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
const int count = GetCount();
|
const size_t count = GetCount();
|
||||||
|
|
||||||
if ( (int)m_clientDataList.GetCount() < count )
|
if ( m_clientDataList.GetCount() < count )
|
||||||
m_clientDataList.Append( (wxObject*) NULL );
|
m_clientDataList.Append( (wxObject*) NULL );
|
||||||
if ( (int)m_clientObjectList.GetCount() < count )
|
if ( m_clientObjectList.GetCount() < count )
|
||||||
m_clientObjectList.Append( (wxObject*) NULL );
|
m_clientObjectList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
@@ -465,11 +465,11 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
|
|||||||
wxT("can't insert into sorted list"));
|
wxT("can't insert into sorted list"));
|
||||||
|
|
||||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
|
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
|
||||||
|
wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index") );
|
||||||
|
|
||||||
int count = GetCount();
|
const size_t count = GetCount();
|
||||||
wxCHECK_MSG( (pos >= 0) && (pos <= count), -1, wxT("invalid index") );
|
|
||||||
|
|
||||||
if (pos == count)
|
if ((size_t)pos == count)
|
||||||
return Append(item);
|
return Append(item);
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
@@ -505,9 +505,9 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
|
|||||||
|
|
||||||
count = GetCount();
|
count = GetCount();
|
||||||
|
|
||||||
if ( (int)m_clientDataList.GetCount() < count )
|
if ( m_clientDataList.GetCount() < count )
|
||||||
m_clientDataList.Insert( pos, (wxObject*) NULL );
|
m_clientDataList.Insert( pos, (wxObject*) NULL );
|
||||||
if ( (int)m_clientObjectList.GetCount() < count )
|
if ( m_clientObjectList.GetCount() < count )
|
||||||
m_clientObjectList.Insert( pos, (wxObject*) NULL );
|
m_clientObjectList.Insert( pos, (wxObject*) NULL );
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
@@ -565,7 +565,7 @@ void wxComboBox::Clear()
|
|||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
int i;
|
size_t i;
|
||||||
for (i = 0; i < GetCount(); i++)
|
for (i = 0; i < GetCount(); i++)
|
||||||
gtk_combo_box_remove_text( combobox, 0 );
|
gtk_combo_box_remove_text( combobox, 0 );
|
||||||
}
|
}
|
||||||
@@ -599,7 +599,7 @@ void wxComboBox::Delete( int n )
|
|||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
wxCHECK_RET( (n >= 0) && (n <= GetCount()), wxT("invalid index") );
|
wxCHECK_RET( IsValid(n), wxT("invalid index") );
|
||||||
|
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
gtk_combo_box_remove_text( combobox, n );
|
gtk_combo_box_remove_text( combobox, n );
|
||||||
@@ -649,7 +649,7 @@ void wxComboBox::SetString(int n, const wxString &text)
|
|||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
wxCHECK_RET( (n >= 0) && (n <= GetCount()), wxT("invalid index") );
|
wxCHECK_RET( IsValid(n), wxT("invalid index") );
|
||||||
|
|
||||||
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
|
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
@@ -858,7 +858,7 @@ wxString wxComboBox::GetStringSelection() const
|
|||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxComboBox::GetCount() const
|
size_t wxComboBox::GetCount() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
|
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
|
||||||
|
|
||||||
@@ -871,7 +871,7 @@ int wxComboBox::GetCount() const
|
|||||||
gtk_tree_model_get_iter_first( model, &iter );
|
gtk_tree_model_get_iter_first( model, &iter );
|
||||||
if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
|
if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
|
||||||
return 0;
|
return 0;
|
||||||
int ret = 1;
|
size_t ret = 1;
|
||||||
while (gtk_tree_model_iter_next( model, &iter ))
|
while (gtk_tree_model_iter_next( model, &iter ))
|
||||||
ret++;
|
ret++;
|
||||||
return ret;
|
return ret;
|
||||||
@@ -882,7 +882,7 @@ int wxComboBox::GetCount() const
|
|||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||||
|
|
||||||
GList *child = GTK_LIST(list)->children;
|
GList *child = GTK_LIST(list)->children;
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
while (child) { count++; child = child->next; }
|
while (child) { count++; child = child->next; }
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -1124,7 +1124,7 @@ void wxComboBox::Replace( long from, long to, const wxString& value )
|
|||||||
wxCharBuffer buffer = wxConvUTF8.cWX2MB( value );
|
wxCharBuffer buffer = wxConvUTF8.cWX2MB( value );
|
||||||
gtk_editable_insert_text( GTK_EDITABLE(entry), (const char*) buffer, strlen( (const char*) buffer ), &pos );
|
gtk_editable_insert_text( GTK_EDITABLE(entry), (const char*) buffer, strlen( (const char*) buffer ), &pos );
|
||||||
#else
|
#else
|
||||||
gtk_editable_insert_text( GTK_EDITABLE(entry), value.c_str(), value.Length(), &pos );
|
gtk_editable_insert_text( GTK_EDITABLE(entry), value.c_str(), value.length(), &pos );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -591,7 +591,7 @@ wxListBox::~wxListBox()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxListBox::GtkInsertItems(const wxArrayString& items,
|
void wxListBox::GtkInsertItems(const wxArrayString& items,
|
||||||
void** clientData, int pos)
|
void** clientData, size_t pos)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") );
|
wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") );
|
||||||
|
|
||||||
@@ -600,7 +600,7 @@ void wxListBox::GtkInsertItems(const wxArrayString& items,
|
|||||||
// Create and set column ids and GValues
|
// Create and set column ids and GValues
|
||||||
|
|
||||||
size_t nNum = items.GetCount();
|
size_t nNum = items.GetCount();
|
||||||
int nCurCount = wxListBox::GetCount();
|
size_t nCurCount = wxListBox::GetCount();
|
||||||
wxASSERT_MSG(pos <= nCurCount, wxT("Invalid index passed to wxListBox"));
|
wxASSERT_MSG(pos <= nCurCount, wxT("Invalid index passed to wxListBox"));
|
||||||
|
|
||||||
GtkTreeIter* pIter = NULL; // append by default
|
GtkTreeIter* pIter = NULL; // append by default
|
||||||
@@ -610,7 +610,7 @@ void wxListBox::GtkInsertItems(const wxArrayString& items,
|
|||||||
gboolean res = gtk_tree_model_iter_nth_child(
|
gboolean res = gtk_tree_model_iter_nth_child(
|
||||||
GTK_TREE_MODEL(m_liststore),
|
GTK_TREE_MODEL(m_liststore),
|
||||||
&iter, NULL, //NULL = parent = get first
|
&iter, NULL, //NULL = parent = get first
|
||||||
pos );
|
(int)pos );
|
||||||
if(!res)
|
if(!res)
|
||||||
{
|
{
|
||||||
wxLogSysError(wxT("internal wxListBox error in insertion"));
|
wxLogSysError(wxT("internal wxListBox error in insertion"));
|
||||||
@@ -662,13 +662,15 @@ void wxListBox::GtkInsertItems(const wxArrayString& items,
|
|||||||
|
|
||||||
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||||
{
|
{
|
||||||
GtkInsertItems(items, NULL, pos);
|
wxCHECK_RET( IsValidInsert(pos), wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
|
GtkInsertItems(items, NULL, (size_t)pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::DoAppend( const wxString& item )
|
int wxListBox::DoAppend( const wxString& item )
|
||||||
{
|
{
|
||||||
// Call DoInsertItems
|
// Call DoInsertItems
|
||||||
int nWhere = wxListBox::GetCount();
|
int nWhere = (int)wxListBox::GetCount();
|
||||||
wxArrayString aItems;
|
wxArrayString aItems;
|
||||||
aItems.Add(item);
|
aItems.Add(item);
|
||||||
wxListBox::DoInsertItems(aItems, nWhere);
|
wxListBox::DoInsertItems(aItems, nWhere);
|
||||||
@@ -730,7 +732,7 @@ struct _GtkTreeEntry* wxListBox::GtkGetEntry(int n) const
|
|||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
wxLogDebug(wxT("gtk_tree_model_iter_nth_child failed\n")
|
wxLogDebug(wxT("gtk_tree_model_iter_nth_child failed\n")
|
||||||
wxT("Passed in value was:[%i] List size:[%i]"),
|
wxT("Passed in value was:[%i] List size:[%u]"),
|
||||||
n, wxListBox::GetCount() );
|
n, wxListBox::GetCount() );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -749,7 +751,7 @@ struct _GtkTreeEntry* wxListBox::GtkGetEntry(int n) const
|
|||||||
|
|
||||||
void* wxListBox::DoGetItemClientData( int n ) const
|
void* wxListBox::DoGetItemClientData( int n ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && n < wxListBox::GetCount(), NULL,
|
wxCHECK_MSG( n >= 0 && (size_t)n < wxListBox::GetCount(), NULL,
|
||||||
wxT("Invalid index passed to GetItemClientData") );
|
wxT("Invalid index passed to GetItemClientData") );
|
||||||
|
|
||||||
GtkTreeEntry* entry = GtkGetEntry(n);
|
GtkTreeEntry* entry = GtkGetEntry(n);
|
||||||
@@ -767,7 +769,7 @@ wxClientData* wxListBox::DoGetItemClientObject( int n ) const
|
|||||||
|
|
||||||
void wxListBox::DoSetItemClientData( int n, void* clientData )
|
void wxListBox::DoSetItemClientData( int n, void* clientData )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < wxListBox::GetCount(),
|
wxCHECK_RET( n >= 0 && (size_t)n < wxListBox::GetCount(),
|
||||||
wxT("Invalid index passed to SetItemClientData") );
|
wxT("Invalid index passed to SetItemClientData") );
|
||||||
|
|
||||||
GtkTreeEntry* entry = GtkGetEntry(n);
|
GtkTreeEntry* entry = GtkGetEntry(n);
|
||||||
@@ -789,6 +791,7 @@ void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
|
|||||||
|
|
||||||
void wxListBox::SetString( int n, const wxString &string )
|
void wxListBox::SetString( int n, const wxString &string )
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetString") );
|
||||||
wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") );
|
wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") );
|
||||||
|
|
||||||
GtkTreeEntry* entry = GtkGetEntry(n);
|
GtkTreeEntry* entry = GtkGetEntry(n);
|
||||||
@@ -813,7 +816,7 @@ void wxListBox::SetString( int n, const wxString &string )
|
|||||||
|
|
||||||
wxArrayString aItems;
|
wxArrayString aItems;
|
||||||
aItems.Add(label);
|
aItems.Add(label);
|
||||||
GtkInsertItems(aItems, &userdata, n);
|
GtkInsertItems(aItems, &userdata, (size_t)n);
|
||||||
if (bWasSelected)
|
if (bWasSelected)
|
||||||
wxListBox::GtkSetSelection(n, true, true);
|
wxListBox::GtkSetSelection(n, true, true);
|
||||||
}
|
}
|
||||||
@@ -839,11 +842,11 @@ wxString wxListBox::GetString( int n ) const
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_treeview != NULL, -1, wxT("invalid listbox") );
|
wxCHECK_MSG( m_treeview != NULL, 0, wxT("invalid listbox") );
|
||||||
|
|
||||||
return gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_liststore), NULL);
|
return (size_t)gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_liststore), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::FindString( const wxString &item, bool bCase ) const
|
int wxListBox::FindString( const wxString &item, bool bCase ) const
|
||||||
@@ -851,12 +854,12 @@ int wxListBox::FindString( const wxString &item, bool bCase ) const
|
|||||||
wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") );
|
wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") );
|
||||||
|
|
||||||
//Sort of hackish - maybe there is a faster way
|
//Sort of hackish - maybe there is a faster way
|
||||||
int nCount = wxListBox::GetCount();
|
size_t nCount = wxListBox::GetCount();
|
||||||
|
|
||||||
for(int i = 0; i < nCount; ++i)
|
for(size_t i = 0; i < nCount; ++i)
|
||||||
{
|
{
|
||||||
if( item.IsSameAs( wxListBox::GetString(i), bCase ) )
|
if( item.IsSameAs( wxListBox::GetString(i), bCase ) )
|
||||||
return i;
|
return (int)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -964,7 +967,7 @@ void wxListBox::GtkSetSelection(int n, const bool select, const bool blockEvent)
|
|||||||
void wxListBox::DoSetFirstItem( int n )
|
void wxListBox::DoSetFirstItem( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_treeview, wxT("invalid listbox") );
|
wxCHECK_RET( m_treeview, wxT("invalid listbox") );
|
||||||
wxCHECK_RET( n >= 0 && n < wxListBox::GetCount(), wxT("invalid index"));
|
wxCHECK_RET( IsValid(n), wxT("invalid index"));
|
||||||
|
|
||||||
//RN: I have no idea why this line is needed...
|
//RN: I have no idea why this line is needed...
|
||||||
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (m_treeview))
|
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (m_treeview))
|
||||||
@@ -1092,13 +1095,13 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
|
|
||||||
// Get the visible area of the tree view (limit to the 10th item
|
// Get the visible area of the tree view (limit to the 10th item
|
||||||
// so that it isn't too big)
|
// so that it isn't too big)
|
||||||
int count = GetCount();
|
size_t count = GetCount();
|
||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
int wLine;
|
int wLine;
|
||||||
|
|
||||||
// Find the widest line
|
// Find the widest line
|
||||||
for(int i = 0; i < count; i++) {
|
for(size_t i = 0; i < count; i++) {
|
||||||
wxString str(GetString(i));
|
wxString str(GetString(i));
|
||||||
GetTextExtent(str, &wLine, NULL);
|
GetTextExtent(str, &wLine, NULL);
|
||||||
lbWidth = wxMax(lbWidth, wLine);
|
lbWidth = wxMax(lbWidth, wLine);
|
||||||
|
@@ -498,7 +498,7 @@ bool wxRadioBox::IsItemShown(int item) const
|
|||||||
return GTK_WIDGET_VISIBLE(GTK_WIDGET(button));
|
return GTK_WIDGET_VISIBLE(GTK_WIDGET(button));
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxRadioBox::GetCount() const
|
size_t wxRadioBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_boxes.GetCount();
|
return m_boxes.GetCount();
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_CHOICE
|
#if wxUSE_CHOICE
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
GtkWidget *menu = gtk_menu_new();
|
GtkWidget *menu = gtk_menu_new();
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (size_t i = 0; i < (size_t)n; i++)
|
||||||
{
|
{
|
||||||
GtkAddHelper(menu, i, choices[i]);
|
GtkAddHelper(menu, i, choices[i]);
|
||||||
}
|
}
|
||||||
@@ -167,9 +167,9 @@ int wxChoice::DoAppend( const wxString &item )
|
|||||||
int wxChoice::DoInsert( const wxString &item, int pos )
|
int wxChoice::DoInsert( const wxString &item, int pos )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice control") );
|
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice control") );
|
||||||
wxCHECK_MSG( (pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
if (pos == GetCount())
|
if ((size_t)pos == GetCount())
|
||||||
return DoAppend(item);
|
return DoAppend(item);
|
||||||
|
|
||||||
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
|
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
|
||||||
@@ -181,7 +181,7 @@ int wxChoice::DoInsert( const wxString &item, int pos )
|
|||||||
m_selection_hack++;
|
m_selection_hack++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GtkAddHelper(menu, pos, item);
|
return GtkAddHelper(menu, (size_t)pos, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
||||||
@@ -262,10 +262,10 @@ void wxChoice::Delete( int n )
|
|||||||
|
|
||||||
// VZ: apparently GTK+ doesn't have a built-in function to do it (not even
|
// 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
|
// in 2.0), hence this dumb implementation -- still better than nothing
|
||||||
int i,
|
int i;
|
||||||
count = GetCount();
|
size_t count = GetCount();
|
||||||
|
|
||||||
wxCHECK_RET( n >= 0 && n < count, _T("invalid index in wxChoice::Delete") );
|
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 the item to delete is before the selection, and the selection is valid
|
||||||
if ((n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND))
|
if ((n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND))
|
||||||
@@ -287,7 +287,7 @@ void wxChoice::Delete( int n )
|
|||||||
wxArrayString items;
|
wxArrayString items;
|
||||||
wxArrayPtrVoid itemsData;
|
wxArrayPtrVoid itemsData;
|
||||||
items.Alloc(count);
|
items.Alloc(count);
|
||||||
for ( i = 0; i < count; i++ )
|
for ( i = 0; (size_t)i < count; i++ )
|
||||||
{
|
{
|
||||||
if ( i != n )
|
if ( i != n )
|
||||||
{
|
{
|
||||||
@@ -432,12 +432,12 @@ wxString wxChoice::GetString( int n ) const
|
|||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid choice") );
|
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) ) );
|
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
GList *child = menu_shell->children;
|
GList *child = menu_shell->children;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
@@ -455,7 +455,7 @@ void wxChoice::SetSelection( int n )
|
|||||||
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
|
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
|
||||||
|
|
||||||
// set the local selection variable manually
|
// set the local selection variable manually
|
||||||
if ((n >= 0) && (n < GetCount()))
|
if ((n >= 0) && ((size_t)n < GetCount()))
|
||||||
{
|
{
|
||||||
// a valid selection has been made
|
// a valid selection has been made
|
||||||
m_selection_hack = n;
|
m_selection_hack = n;
|
||||||
@@ -498,9 +498,9 @@ void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::GtkAddHelper(GtkWidget *menu, int pos, const wxString& item)
|
int wxChoice::GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG((pos>=0) && (pos<=(int)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 ) );
|
GtkWidget *menu_item = gtk_menu_item_new_with_label( wxGTK_CONV( item ) );
|
||||||
|
|
||||||
|
@@ -10,10 +10,10 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#include "wx/combobox.h"
|
|
||||||
|
|
||||||
#if wxUSE_COMBOBOX
|
#if wxUSE_COMBOBOX
|
||||||
|
|
||||||
|
#include "wx/combobox.h"
|
||||||
|
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/arrstr.h"
|
#include "wx/arrstr.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
@@ -347,11 +347,11 @@ int wxComboBox::DoAppend( const wxString &item )
|
|||||||
|
|
||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
|
|
||||||
const int count = GetCount();
|
const size_t count = GetCount();
|
||||||
|
|
||||||
if ( (int)m_clientDataList.GetCount() < count )
|
if ( m_clientDataList.GetCount() < count )
|
||||||
m_clientDataList.Append( (wxObject*) NULL );
|
m_clientDataList.Append( (wxObject*) NULL );
|
||||||
if ( (int)m_clientObjectList.GetCount() < count )
|
if ( m_clientObjectList.GetCount() < count )
|
||||||
m_clientObjectList.Append( (wxObject*) NULL );
|
m_clientObjectList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
EnableEvents();
|
EnableEvents();
|
||||||
@@ -368,10 +368,9 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
|
|||||||
|
|
||||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
|
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
|
||||||
|
|
||||||
int count = GetCount();
|
wxCHECK_MSG( IsValidInsert(pos), -1, wxT("invalid index") );
|
||||||
wxCHECK_MSG( (pos >= 0) && (pos <= count), -1, wxT("invalid index") );
|
|
||||||
|
|
||||||
if (pos == count)
|
if ((size_t)pos == GetCount())
|
||||||
return Append(item);
|
return Append(item);
|
||||||
|
|
||||||
DisableEvents();
|
DisableEvents();
|
||||||
@@ -394,11 +393,11 @@ int wxComboBox::DoInsert( const wxString &item, int pos )
|
|||||||
|
|
||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
|
|
||||||
count = GetCount();
|
const size_t count = GetCount();
|
||||||
|
|
||||||
if ( (int)m_clientDataList.GetCount() < count )
|
if ( m_clientDataList.GetCount() < count )
|
||||||
m_clientDataList.Insert( pos, (wxObject*) NULL );
|
m_clientDataList.Insert( pos, (wxObject*) NULL );
|
||||||
if ( (int)m_clientObjectList.GetCount() < count )
|
if ( m_clientObjectList.GetCount() < count )
|
||||||
m_clientObjectList.Insert( pos, (wxObject*) NULL );
|
m_clientObjectList.Insert( pos, (wxObject*) NULL );
|
||||||
|
|
||||||
EnableEvents();
|
EnableEvents();
|
||||||
@@ -455,7 +454,7 @@ void wxComboBox::Clear()
|
|||||||
DisableEvents();
|
DisableEvents();
|
||||||
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||||
gtk_list_clear_items( GTK_LIST(list), 0, GetCount() );
|
gtk_list_clear_items( GTK_LIST(list), 0, (int)GetCount() );
|
||||||
|
|
||||||
wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
|
wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -581,7 +580,7 @@ int wxComboBox::GetCurrentSelection() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxComboBox::GetString( int n ) const
|
wxString wxComboBox::GetString( int n ) const
|
||||||
@@ -626,14 +625,14 @@ wxString wxComboBox::GetStringSelection() const
|
|||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxComboBox::GetCount() const
|
size_t wxComboBox::GetCount() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
|
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
|
||||||
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||||
|
|
||||||
GList *child = GTK_LIST(list)->children;
|
GList *child = GTK_LIST(list)->children;
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
while (child) { count++; child = child->next; }
|
while (child) { count++; child = child->next; }
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -798,7 +797,7 @@ void wxComboBox::Replace( long from, long to, const wxString& value )
|
|||||||
wxCharBuffer buffer = wxConvUTF8.cWX2MB( value );
|
wxCharBuffer buffer = wxConvUTF8.cWX2MB( value );
|
||||||
gtk_editable_insert_text( GTK_EDITABLE(entry), (const char*) buffer, strlen( (const char*) buffer ), &pos );
|
gtk_editable_insert_text( GTK_EDITABLE(entry), (const char*) buffer, strlen( (const char*) buffer ), &pos );
|
||||||
#else
|
#else
|
||||||
gtk_editable_insert_text( GTK_EDITABLE(entry), value.c_str(), value.Length(), &pos );
|
gtk_editable_insert_text( GTK_EDITABLE(entry), value.c_str(), value.length(), &pos );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ static gint wxlistbox_idle_callback( gpointer gdata )
|
|||||||
// check that the items haven't been deleted from the listbox since we had
|
// check that the items haven't been deleted from the listbox since we had
|
||||||
// installed this callback
|
// installed this callback
|
||||||
wxListBox *lbox = data->m_listbox;
|
wxListBox *lbox = data->m_listbox;
|
||||||
if ( data->m_item < lbox->GetCount() )
|
if ( data->m_item < (int)lbox->GetCount() )
|
||||||
{
|
{
|
||||||
lbox->SetFirstItem( data->m_item );
|
lbox->SetFirstItem( data->m_item );
|
||||||
}
|
}
|
||||||
@@ -583,7 +583,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
|
|
||||||
// code elsewhere supposes we have as many items in m_clientList as items
|
// code elsewhere supposes we have as many items in m_clientList as items
|
||||||
// in the listbox
|
// in the listbox
|
||||||
wxASSERT_MSG( m_clientList.GetCount() == (size_t)GetCount(),
|
wxASSERT_MSG( m_clientList.GetCount() == GetCount(),
|
||||||
wxT("bug in client data management") );
|
wxT("bug in client data management") );
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
@@ -602,7 +602,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
{
|
{
|
||||||
index = m_strings->Add( items[n] );
|
index = m_strings->Add( items[n] );
|
||||||
|
|
||||||
if (index != GetCount())
|
if (index != (int)GetCount())
|
||||||
{
|
{
|
||||||
GtkAddItem( items[n], index );
|
GtkAddItem( items[n], index );
|
||||||
wxList::compatibility_iterator node = m_clientList.Item( index );
|
wxList::compatibility_iterator node = m_clientList.Item( index );
|
||||||
@@ -638,7 +638,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT_MSG( m_clientList.GetCount() == (size_t)GetCount(),
|
wxASSERT_MSG( m_clientList.GetCount() == GetCount(),
|
||||||
wxT("bug in client data management") );
|
wxT("bug in client data management") );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +652,7 @@ int wxListBox::DoAppend( const wxString& item )
|
|||||||
int index = m_strings->Add( item );
|
int index = m_strings->Add( item );
|
||||||
|
|
||||||
// only if not at the end anyway
|
// only if not at the end anyway
|
||||||
if (index != GetCount())
|
if (index != (int)GetCount())
|
||||||
{
|
{
|
||||||
GtkAddItem( item, index );
|
GtkAddItem( item, index );
|
||||||
|
|
||||||
@@ -773,7 +773,7 @@ void wxListBox::Clear()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
|
wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
|
||||||
|
|
||||||
gtk_list_clear_items( m_list, 0, GetCount() );
|
gtk_list_clear_items( m_list, 0, (int)GetCount() );
|
||||||
|
|
||||||
if ( GTK_LIST(m_list)->last_focus_child != NULL )
|
if ( GTK_LIST(m_list)->last_focus_child != NULL )
|
||||||
{
|
{
|
||||||
@@ -938,9 +938,9 @@ wxString wxListBox::GetString( int n ) const
|
|||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, wxT("invalid listbox") );
|
wxCHECK_MSG( m_list != NULL, 0, wxT("invalid listbox") );
|
||||||
|
|
||||||
GList *children = m_list->children;
|
GList *children = m_list->children;
|
||||||
return g_list_length(children);
|
return g_list_length(children);
|
||||||
@@ -1216,7 +1216,7 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
int wLine;
|
int wLine;
|
||||||
|
|
||||||
// Find the widest line
|
// Find the widest line
|
||||||
for(int i = 0; i < GetCount(); i++) {
|
for(size_t i = 0; i < GetCount(); i++) {
|
||||||
wxString str(GetString(i));
|
wxString str(GetString(i));
|
||||||
GetTextExtent(str, &wLine, NULL);
|
GetTextExtent(str, &wLine, NULL);
|
||||||
lbWidth = wxMax(lbWidth, wLine);
|
lbWidth = wxMax(lbWidth, wLine);
|
||||||
|
@@ -492,7 +492,7 @@ bool wxRadioBox::IsItemShown(int item) const
|
|||||||
return GTK_WIDGET_VISIBLE(GTK_WIDGET(button));
|
return GTK_WIDGET_VISIBLE(GTK_WIDGET(button));
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxRadioBox::GetCount() const
|
size_t wxRadioBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_boxes.GetCount();
|
return m_boxes.GetCount();
|
||||||
}
|
}
|
||||||
|
@@ -137,9 +137,9 @@ int wxChoice::DoAppend( const wxString& item )
|
|||||||
int wxChoice::DoInsert( const wxString& item, int pos )
|
int wxChoice::DoInsert( const wxString& item, int pos )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1, wxT("wxChoice::DoInsert: can't insert into sorted list") );
|
wxCHECK_MSG( !(GetWindowStyle() & wxCB_SORT), -1, wxT("wxChoice::DoInsert: can't insert into sorted list") );
|
||||||
wxCHECK_MSG( (pos >= 0) && (pos <= GetCount()), -1, wxT("wxChoice::DoInsert: invalid index") );
|
wxCHECK_MSG( IsValidInsert(pos), -1, wxT("wxChoice::DoInsert: invalid index") );
|
||||||
|
|
||||||
if (pos == GetCount())
|
if ((size_t)pos == GetCount())
|
||||||
return DoAppend( item );
|
return DoAppend( item );
|
||||||
|
|
||||||
UMAInsertMenuItem( MAC_WXHMENU( m_macPopUpMenuHandle ), item, m_font.GetEncoding(), pos );
|
UMAInsertMenuItem( MAC_WXHMENU( m_macPopUpMenuHandle ), item, m_font.GetEncoding(), pos );
|
||||||
@@ -153,7 +153,7 @@ int wxChoice::DoInsert( const wxString& item, int pos )
|
|||||||
|
|
||||||
void wxChoice::Delete( int n )
|
void wxChoice::Delete( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(), wxT("wxChoice::Delete: invalid index") );
|
wxCHECK_RET( IsValid(n) , wxT("wxChoice::Delete: invalid index") );
|
||||||
|
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
delete GetClientObject( n );
|
delete GetClientObject( n );
|
||||||
@@ -167,7 +167,7 @@ void wxChoice::Delete( int n )
|
|||||||
void wxChoice::Clear()
|
void wxChoice::Clear()
|
||||||
{
|
{
|
||||||
FreeData();
|
FreeData();
|
||||||
for ( int i = 0 ; i < GetCount() ; i++ )
|
for ( size_t i = 0 ; i < GetCount() ; i++ )
|
||||||
{
|
{
|
||||||
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
|
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,7 @@ void wxChoice::SetSelection( int n )
|
|||||||
// string list functions
|
// string list functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return m_strings.GetCount() ;
|
return m_strings.GetCount() ;
|
||||||
}
|
}
|
||||||
@@ -218,8 +218,7 @@ int wxChoice::FindString( const wxString& s, bool bCase ) const
|
|||||||
|
|
||||||
void wxChoice::SetString( int n, const wxString& s )
|
void wxChoice::SetString( int n, const wxString& s )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && (size_t)n < m_strings.GetCount(),
|
wxCHECK_RET( IsValid(n), wxT("wxChoice::SetString(): invalid index") );
|
||||||
wxT("wxChoice::SetString(): invalid index") );
|
|
||||||
|
|
||||||
m_strings[n] = s ;
|
m_strings[n] = s ;
|
||||||
|
|
||||||
@@ -229,8 +228,7 @@ void wxChoice::SetString( int n, const wxString& s )
|
|||||||
|
|
||||||
wxString wxChoice::GetString( int n ) const
|
wxString wxChoice::GetString( int n ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && (size_t)n < m_strings.GetCount(), wxEmptyString,
|
wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("wxChoice::GetString(): invalid index") );
|
||||||
wxT("wxChoice::GetString(): invalid index") );
|
|
||||||
|
|
||||||
return m_strings[n] ;
|
return m_strings[n] ;
|
||||||
}
|
}
|
||||||
@@ -240,16 +238,14 @@ wxString wxChoice::GetString( int n ) const
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(),
|
wxCHECK_RET( IsValid(n), wxT("wxChoice::DoSetItemClientData: invalid index") );
|
||||||
wxT("wxChoice::DoSetItemClientData: invalid index") );
|
|
||||||
|
|
||||||
m_datas[n] = (char*)clientData ;
|
m_datas[n] = (char*)clientData ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * wxChoice::DoGetItemClientData( int n ) const
|
void * wxChoice::DoGetItemClientData( int n ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
|
wxCHECK_MSG( IsValid(n), NULL, wxT("wxChoice::DoGetClientData: invalid index") );
|
||||||
wxT("wxChoice::DoGetClientData: invalid index") );
|
|
||||||
|
|
||||||
return (void *)m_datas[n];
|
return (void *)m_datas[n];
|
||||||
}
|
}
|
||||||
@@ -316,7 +312,7 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the widest line
|
// Find the widest line
|
||||||
for(int i = 0; i < GetCount(); i++)
|
for(size_t i = 0; i < GetCount(); i++)
|
||||||
{
|
{
|
||||||
wxString str( GetString( i ) );
|
wxString str( GetString( i ) );
|
||||||
|
|
||||||
@@ -333,7 +329,7 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
|
|
||||||
wLine = bounds.h ;
|
wLine = bounds.h ;
|
||||||
#else
|
#else
|
||||||
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
|
wLine = ::TextWidth( str.c_str() , 0 , str.length() ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lbWidth = wxMax( lbWidth, wLine ) ;
|
lbWidth = wxMax( lbWidth, wLine ) ;
|
||||||
|
@@ -410,7 +410,7 @@ wxString wxComboBox::GetValue() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxComboBox::GetCount() const
|
size_t wxComboBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_choice->GetCount() ;
|
return m_choice->GetCount() ;
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrows
|
|||||||
{
|
{
|
||||||
wxListBox* list = wxDynamicCast( (wxObject*) ref , wxListBox ) ;
|
wxListBox* list = wxDynamicCast( (wxObject*) ref , wxListBox ) ;
|
||||||
int i = itemID - 1 ;
|
int i = itemID - 1 ;
|
||||||
if (i >= 0 && i < list->GetCount() )
|
if (i >= 0 && i < (int)list->GetCount() )
|
||||||
{
|
{
|
||||||
bool trigger = false ;
|
bool trigger = false ;
|
||||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() );
|
||||||
@@ -119,7 +119,7 @@ static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
|
|||||||
{
|
{
|
||||||
wxListBox* list = wxDynamicCast( (wxObject*) ref , wxListBox ) ;
|
wxListBox* list = wxDynamicCast( (wxObject*) ref , wxListBox ) ;
|
||||||
int i = itemID - 1 ;
|
int i = itemID - 1 ;
|
||||||
if (i >= 0 && i < list->GetCount() )
|
if (i >= 0 && i < (int)list->GetCount() )
|
||||||
{
|
{
|
||||||
wxMacCFStringHolder cf( list->GetString( i ) , list->GetFont().GetEncoding() ) ;
|
wxMacCFStringHolder cf( list->GetString( i ) , list->GetFont().GetEncoding() ) ;
|
||||||
verify_noerr( ::SetDataBrowserItemDataText( itemData , cf ) ) ;
|
verify_noerr( ::SetDataBrowserItemDataText( itemData , cf ) ) ;
|
||||||
@@ -326,7 +326,7 @@ void wxListBox::FreeData()
|
|||||||
{
|
{
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
{
|
{
|
||||||
for ( size_t n = 0; n < (size_t)m_noItems; n++ )
|
for ( size_t n = 0; n < m_noItems; n++ )
|
||||||
{
|
{
|
||||||
delete GetClientObject( n );
|
delete GetClientObject( n );
|
||||||
}
|
}
|
||||||
@@ -347,7 +347,7 @@ void wxListBox::DoSetFirstItem(int n)
|
|||||||
|
|
||||||
void wxListBox::Delete(int n)
|
void wxListBox::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < m_noItems,
|
wxCHECK_RET( IsValid(n),
|
||||||
wxT("invalid index in wxListBox::Delete") );
|
wxT("invalid index in wxListBox::Delete") );
|
||||||
|
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
@@ -364,7 +364,7 @@ int wxListBox::DoAppend(const wxString& item)
|
|||||||
{
|
{
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
int index = m_noItems ;
|
size_t index = m_noItems ;
|
||||||
m_stringArray.Add( item ) ;
|
m_stringArray.Add( item ) ;
|
||||||
m_dataArray.Add( NULL );
|
m_dataArray.Add( NULL );
|
||||||
m_noItems++;
|
m_noItems++;
|
||||||
@@ -377,9 +377,9 @@ int wxListBox::DoAppend(const wxString& item)
|
|||||||
void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
||||||
{
|
{
|
||||||
Clear() ;
|
Clear() ;
|
||||||
int n = choices.GetCount();
|
size_t n = choices.GetCount();
|
||||||
|
|
||||||
for ( int i = 0 ; i < n ; ++i )
|
for ( size_t i = 0 ; i < n ; ++i )
|
||||||
{
|
{
|
||||||
if ( clientData )
|
if ( clientData )
|
||||||
Append( choices[i] , clientData[i] ) ;
|
Append( choices[i] , clientData[i] ) ;
|
||||||
@@ -392,28 +392,28 @@ int wxListBox::FindString(const wxString& s, bool bCase) const
|
|||||||
{
|
{
|
||||||
if ( s.Right(1) == wxT("*") )
|
if ( s.Right(1) == wxT("*") )
|
||||||
{
|
{
|
||||||
wxString search = s.Left( s.Length() - 1 ) ;
|
wxString search = s.Left( s.length() - 1 ) ;
|
||||||
int len = search.Length() ;
|
int len = search.length() ;
|
||||||
Str255 s1 , s2 ;
|
Str255 s1 , s2 ;
|
||||||
wxMacStringToPascal( search , s2 ) ;
|
wxMacStringToPascal( search , s2 ) ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < m_noItems ; ++ i )
|
for ( size_t i = 0 ; i < m_noItems ; ++ i )
|
||||||
{
|
{
|
||||||
wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
|
wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
|
||||||
|
|
||||||
if ( EqualString( s1 , s2 , bCase , false ) )
|
if ( EqualString( s1 , s2 , bCase , false ) )
|
||||||
return i ;
|
return (int)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( s.Left(1) == wxT("*") && s.Length() > 1 )
|
if ( s.Left(1) == wxT("*") && s.length() > 1 )
|
||||||
{
|
{
|
||||||
wxString st = s ;
|
wxString st = s ;
|
||||||
st.MakeLower() ;
|
st.MakeLower() ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < m_noItems ; ++i )
|
for ( size_t i = 0 ; i < m_noItems ; ++i )
|
||||||
{
|
{
|
||||||
if ( GetString( i ).Lower().Matches(st) )
|
if ( GetString( i ).Lower().Matches(st) )
|
||||||
return i ;
|
return (int)i ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -423,12 +423,12 @@ int wxListBox::FindString(const wxString& s, bool bCase) const
|
|||||||
|
|
||||||
wxMacStringToPascal( s , s2 ) ;
|
wxMacStringToPascal( s , s2 ) ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < m_noItems ; ++ i )
|
for ( size_t i = 0 ; i < m_noItems ; ++ i )
|
||||||
{
|
{
|
||||||
wxMacStringToPascal( m_stringArray[i] , s1 ) ;
|
wxMacStringToPascal( m_stringArray[i] , s1 ) ;
|
||||||
|
|
||||||
if ( EqualString( s1 , s2 , bCase , false ) )
|
if ( EqualString( s1 , s2 , bCase , false ) )
|
||||||
return i ;
|
return (int)i ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +446,7 @@ void wxListBox::Clear()
|
|||||||
|
|
||||||
void wxListBox::DoSetSelection(int n, bool select)
|
void wxListBox::DoSetSelection(int n, bool select)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n == wxNOT_FOUND || (n >= 0 && n < m_noItems) ,
|
wxCHECK_RET( n == wxNOT_FOUND || IsValid(n) ,
|
||||||
wxT("invalid index in wxListBox::SetSelection") );
|
wxT("invalid index in wxListBox::SetSelection") );
|
||||||
|
|
||||||
if ( n == wxNOT_FOUND )
|
if ( n == wxNOT_FOUND )
|
||||||
@@ -457,7 +457,7 @@ void wxListBox::DoSetSelection(int n, bool select)
|
|||||||
|
|
||||||
bool wxListBox::IsSelected(int n) const
|
bool wxListBox::IsSelected(int n) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && n < m_noItems, false,
|
wxCHECK_MSG( IsValid(n), false,
|
||||||
wxT("invalid index in wxListBox::Selected") );
|
wxT("invalid index in wxListBox::Selected") );
|
||||||
|
|
||||||
return MacIsSelected( n ) ;
|
return MacIsSelected( n ) ;
|
||||||
@@ -465,8 +465,9 @@ bool wxListBox::IsSelected(int n) const
|
|||||||
|
|
||||||
void *wxListBox::DoGetItemClientData(int n) const
|
void *wxListBox::DoGetItemClientData(int n) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && n < m_noItems, NULL,
|
wxCHECK_MSG( IsValid(n), NULL, wxT("invalid index in wxListBox::GetClientData"));
|
||||||
wxT("invalid index in wxListBox::GetClientData"));
|
|
||||||
|
wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) n , wxT("invalid client_data array") ) ;
|
||||||
|
|
||||||
return (void *)m_dataArray[n];
|
return (void *)m_dataArray[n];
|
||||||
}
|
}
|
||||||
@@ -478,8 +479,7 @@ wxClientData *wxListBox::DoGetItemClientObject(int n) const
|
|||||||
|
|
||||||
void wxListBox::DoSetItemClientData(int n, void *clientData)
|
void wxListBox::DoSetItemClientData(int n, void *clientData)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < m_noItems,
|
wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetClientData") );
|
||||||
wxT("invalid index in wxListBox::SetClientData") );
|
|
||||||
|
|
||||||
wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) n , wxT("invalid client_data array") ) ;
|
wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) n , wxT("invalid client_data array") ) ;
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@ int wxListBox::GetSelection() const
|
|||||||
// Find string for position
|
// Find string for position
|
||||||
wxString wxListBox::GetString(int n) const
|
wxString wxListBox::GetString(int n) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && n < m_noItems, wxEmptyString,
|
wxCHECK_MSG( IsValid(n), wxEmptyString,
|
||||||
wxT("invalid index in wxListBox::GetString") );
|
wxT("invalid index in wxListBox::GetString") );
|
||||||
|
|
||||||
return m_stringArray[n] ;
|
return m_stringArray[n] ;
|
||||||
@@ -517,14 +517,14 @@ wxString wxListBox::GetString(int n) const
|
|||||||
|
|
||||||
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
|
wxCHECK_RET( IsValidInsert(pos),
|
||||||
wxT("invalid index in wxListBox::InsertItems") );
|
wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
int nItems = items.GetCount();
|
size_t nItems = items.GetCount();
|
||||||
|
|
||||||
for ( int i = 0 ; i < nItems ; i++ )
|
for ( size_t i = 0 ; i < nItems ; i++ )
|
||||||
{
|
{
|
||||||
m_stringArray.Insert( items[i] , pos + i ) ;
|
m_stringArray.Insert( items[i] , pos + i ) ;
|
||||||
m_dataArray.Insert( NULL , pos + i ) ;
|
m_dataArray.Insert( NULL , pos + i ) ;
|
||||||
@@ -563,7 +563,7 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the widest line
|
// Find the widest line
|
||||||
for (int i = 0; i < GetCount(); i++)
|
for (size_t i = 0; i < GetCount(); i++)
|
||||||
{
|
{
|
||||||
wxString str( GetString( i ) );
|
wxString str( GetString( i ) );
|
||||||
|
|
||||||
@@ -581,7 +581,7 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
&baseline );
|
&baseline );
|
||||||
wLine = bounds.h ;
|
wLine = bounds.h ;
|
||||||
#else
|
#else
|
||||||
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
|
wLine = ::TextWidth( str.c_str() , 0 , str.length() ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lbWidth = wxMax( lbWidth, wLine );
|
lbWidth = wxMax( lbWidth, wLine );
|
||||||
@@ -603,7 +603,7 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
return wxSize( lbWidth, lbHeight );
|
return wxSize( lbWidth, lbHeight );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_noItems;
|
return m_noItems;
|
||||||
}
|
}
|
||||||
@@ -737,7 +737,7 @@ bool wxListBox::MacIsSelected( int n ) const
|
|||||||
|
|
||||||
int wxListBox::MacGetSelection() const
|
int wxListBox::MacGetSelection() const
|
||||||
{
|
{
|
||||||
for ( int i = 0 ; i < GetCount() ; ++i )
|
for ( size_t i = 0 ; i < GetCount() ; ++i )
|
||||||
{
|
{
|
||||||
if ( m_peer->IsItemSelected( i + 1 ) )
|
if ( m_peer->IsItemSelected( i + 1 ) )
|
||||||
return i ;
|
return i ;
|
||||||
|
@@ -101,7 +101,7 @@ bool wxRadioBox::Create( wxWindow *parent,
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
m_noItems = n;
|
m_noItems = (size_t)n;
|
||||||
m_noRowsOrCols = majorDim;
|
m_noRowsOrCols = majorDim;
|
||||||
m_radioButtonCycle = NULL;
|
m_radioButtonCycle = NULL;
|
||||||
|
|
||||||
@@ -148,14 +148,13 @@ bool wxRadioBox::Create( wxWindow *parent,
|
|||||||
//
|
//
|
||||||
bool wxRadioBox::Enable(bool enable)
|
bool wxRadioBox::Enable(bool enable)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
wxRadioButton *current;
|
wxRadioButton *current;
|
||||||
|
|
||||||
if (!wxControl::Enable( enable ))
|
if (!wxControl::Enable( enable ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
current = m_radioButtonCycle;
|
current = m_radioButtonCycle;
|
||||||
for (i = 0; i < m_noItems; i++)
|
for (size_t i = 0; i < m_noItems; i++)
|
||||||
{
|
{
|
||||||
current->Enable( enable );
|
current->Enable( enable );
|
||||||
current = current->NextInCycle();
|
current = current->NextInCycle();
|
||||||
@@ -285,11 +284,10 @@ void wxRadioBox::SetSelection(int item)
|
|||||||
//
|
//
|
||||||
bool wxRadioBox::Show(bool show)
|
bool wxRadioBox::Show(bool show)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
wxRadioButton *current;
|
wxRadioButton *current;
|
||||||
|
|
||||||
current = m_radioButtonCycle;
|
current = m_radioButtonCycle;
|
||||||
for (i=0; i<m_noItems; i++)
|
for (size_t i=0; i<m_noItems; i++)
|
||||||
{
|
{
|
||||||
current->Show( show );
|
current->Show( show );
|
||||||
current = current->NextInCycle();
|
current = current->NextInCycle();
|
||||||
@@ -389,7 +387,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
maxWidth = -1;
|
maxWidth = -1;
|
||||||
maxHeight = -1;
|
maxHeight = -1;
|
||||||
for (i = 0 ; i < m_noItems; i++)
|
for (size_t 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);
|
eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
|
||||||
@@ -479,7 +477,7 @@ wxSize wxRadioBox::DoGetBestSize() const
|
|||||||
maxWidth = -1;
|
maxWidth = -1;
|
||||||
maxHeight = -1;
|
maxHeight = -1;
|
||||||
|
|
||||||
for (int i = 0 ; i < m_noItems; i++)
|
for (size_t 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);
|
eachWidth = (int)(eachWidth + RADIO_SIZE);
|
||||||
@@ -506,4 +504,4 @@ wxSize wxRadioBox::DoGetBestSize() const
|
|||||||
return wxSize( totWidth, totHeight );
|
return wxSize( totWidth, totHeight );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // wxUSE_RADIOBOX
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: checklst.cpp
|
// Name: src/mac/classic/checklst.cpp
|
||||||
// Purpose: implementation of wxCheckListBox class
|
// Purpose: implementation of wxCheckListBox class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
// headers & declarations
|
// headers & declarations
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_CHECKLISTBOX
|
#if wxUSE_CHECKLISTBOX
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
|
|||||||
|
|
||||||
MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
|
MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
|
||||||
|
|
||||||
DrawText(text, 0 , text.Length());
|
DrawText(text, 0 , text.length());
|
||||||
// If the cell is hilited, do the hilite now. Paint the cell contents with the
|
// If the cell is hilited, do the hilite now. Paint the cell contents with the
|
||||||
// appropriate QuickDraw transform mode.
|
// appropriate QuickDraw transform mode.
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
LSetDrawingMode( true , (ListHandle) m_macList ) ;
|
LSetDrawingMode( true , (ListHandle) m_macList ) ;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -312,7 +312,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
bool wxCheckListBox::IsChecked(size_t item) const
|
bool wxCheckListBox::IsChecked(size_t item) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( item < m_checks.GetCount(), FALSE,
|
wxCHECK_MSG( IsValid(item), false,
|
||||||
_T("invalid index in wxCheckListBox::IsChecked") );
|
_T("invalid index in wxCheckListBox::IsChecked") );
|
||||||
|
|
||||||
return m_checks[item] != 0;
|
return m_checks[item] != 0;
|
||||||
@@ -320,7 +320,7 @@ bool wxCheckListBox::IsChecked(size_t item) const
|
|||||||
|
|
||||||
void wxCheckListBox::Check(size_t item, bool check)
|
void wxCheckListBox::Check(size_t item, bool check)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( item < m_checks.GetCount(),
|
wxCHECK_RET( IsValid(item),
|
||||||
_T("invalid index in wxCheckListBox::Check") );
|
_T("invalid index in wxCheckListBox::Check") );
|
||||||
|
|
||||||
// intermediate var is needed to avoid compiler warning with VC++
|
// intermediate var is needed to avoid compiler warning with VC++
|
||||||
@@ -339,7 +339,7 @@ void wxCheckListBox::Check(size_t item, bool check)
|
|||||||
|
|
||||||
void wxCheckListBox::Delete(int n)
|
void wxCheckListBox::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(), _T("invalid index in wxListBox::Delete") );
|
wxCHECK_RET( IsValid(n), _T("invalid index in wxListBox::Delete") );
|
||||||
|
|
||||||
wxListBox::Delete(n);
|
wxListBox::Delete(n);
|
||||||
|
|
||||||
@@ -352,7 +352,7 @@ int wxCheckListBox::DoAppend(const wxString& item)
|
|||||||
int pos = wxListBox::DoAppend(item);
|
int pos = wxListBox::DoAppend(item);
|
||||||
|
|
||||||
// the item is initially unchecked
|
// the item is initially unchecked
|
||||||
m_checks.Insert(FALSE, pos);
|
m_checks.Insert(false, pos);
|
||||||
LSetDrawingMode( true , (ListHandle) m_macList ) ;
|
LSetDrawingMode( true , (ListHandle) m_macList ) ;
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
@@ -365,7 +365,7 @@ void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
size_t count = items.GetCount();
|
size_t count = items.GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
m_checks.Insert(FALSE, pos + n);
|
m_checks.Insert(false, pos + n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ void wxCheckListBox::DoSetItems(const wxArrayString& items, void **clientData)
|
|||||||
size_t count = items.GetCount();
|
size_t count = items.GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
m_checks.Add(FALSE);
|
m_checks.Add(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
|
|||||||
#endif
|
#endif
|
||||||
size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
|
size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
|
||||||
|
|
||||||
if ( nItem < (size_t)m_noItems )
|
if ( nItem < m_noItems )
|
||||||
{
|
{
|
||||||
Check(nItem, !IsChecked(nItem) ) ;
|
Check(nItem, !IsChecked(nItem) ) ;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
|
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_CHOICE
|
#if wxUSE_CHOICE
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ int wxChoice::DoAppend(const wxString& item)
|
|||||||
int wxChoice::DoInsert(const wxString& item, int pos)
|
int wxChoice::DoInsert(const wxString& item, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
||||||
wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
if (pos == GetCount())
|
if (pos == GetCount())
|
||||||
return DoAppend(item);
|
return DoAppend(item);
|
||||||
@@ -114,7 +114,7 @@ int wxChoice::DoInsert(const wxString& item, int pos)
|
|||||||
|
|
||||||
void wxChoice::Delete(int n)
|
void wxChoice::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") );
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
{
|
{
|
||||||
delete GetClientObject(n);
|
delete GetClientObject(n);
|
||||||
@@ -166,7 +166,7 @@ void wxChoice::SetSelection(int n)
|
|||||||
// string list functions
|
// string list functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return m_strings.GetCount() ;
|
return m_strings.GetCount() ;
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ void wxChoice::SetString(int n, const wxString& s)
|
|||||||
|
|
||||||
wxString wxChoice::GetString(int n) const
|
wxString wxChoice::GetString(int n) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && (size_t)n < m_strings.GetCount(), wxEmptyString,
|
wxCHECK_MSG( IsValid(n), wxEmptyString,
|
||||||
_T("wxChoice::GetString(): invalid index") );
|
_T("wxChoice::GetString(): invalid index") );
|
||||||
|
|
||||||
return m_strings[n] ;
|
return m_strings[n] ;
|
||||||
@@ -272,7 +272,7 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
&baseline );
|
&baseline );
|
||||||
wLine = bounds.h ;
|
wLine = bounds.h ;
|
||||||
#else
|
#else
|
||||||
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
|
wLine = ::TextWidth( str.c_str() , 0 , str.length() ) ;
|
||||||
#endif
|
#endif
|
||||||
lbWidth = wxMax(lbWidth, wLine);
|
lbWidth = wxMax(lbWidth, wLine);
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,10 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_LISTBOX
|
||||||
|
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/listbox.h"
|
#include "wx/listbox.h"
|
||||||
#include "wx/button.h"
|
#include "wx/button.h"
|
||||||
@@ -304,7 +308,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
LSetDrawingMode( true , (ListHandle)m_macList ) ;
|
LSetDrawingMode( true , (ListHandle)m_macList ) ;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListBox::~wxListBox()
|
wxListBox::~wxListBox()
|
||||||
@@ -339,7 +343,7 @@ void wxListBox::FreeData()
|
|||||||
#endif // wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
{
|
{
|
||||||
for ( size_t n = 0; n < (size_t)m_noItems; n++ )
|
for ( size_t n = 0; n < m_noItems; n++ )
|
||||||
{
|
{
|
||||||
delete GetClientObject(n);
|
delete GetClientObject(n);
|
||||||
}
|
}
|
||||||
@@ -374,7 +378,7 @@ void wxListBox::DoSetFirstItem(int N)
|
|||||||
|
|
||||||
void wxListBox::Delete(int N)
|
void wxListBox::Delete(int N)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::Delete") );
|
wxT("invalid index in wxListBox::Delete") );
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -397,7 +401,7 @@ int wxListBox::DoAppend(const wxString& item)
|
|||||||
{
|
{
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
int index = m_noItems ;
|
size_t index = m_noItems ;
|
||||||
m_stringArray.Add( item ) ;
|
m_stringArray.Add( item ) ;
|
||||||
m_dataArray.Add( NULL );
|
m_dataArray.Add( NULL );
|
||||||
m_noItems ++;
|
m_noItems ++;
|
||||||
@@ -439,7 +443,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
|||||||
m_aItems.Empty();
|
m_aItems.Empty();
|
||||||
|
|
||||||
// then create new ones
|
// then create new ones
|
||||||
for ( ui = 0; ui < (size_t)m_noItems; ui++ ) {
|
for ( ui = 0; ui < m_noItems; ui++ ) {
|
||||||
wxOwnerDrawn *pNewItem = CreateItem(ui);
|
wxOwnerDrawn *pNewItem = CreateItem(ui);
|
||||||
pNewItem->SetName(choices[ui]);
|
pNewItem->SetName(choices[ui]);
|
||||||
m_aItems.Add(pNewItem);
|
m_aItems.Add(pNewItem);
|
||||||
@@ -458,26 +462,26 @@ int wxListBox::FindString(const wxString& s, bool bCase) const
|
|||||||
{
|
{
|
||||||
if ( s.Right(1) == wxT("*") )
|
if ( s.Right(1) == wxT("*") )
|
||||||
{
|
{
|
||||||
wxString search = s.Left( s.Length() - 1 ) ;
|
wxString search = s.Left( s.length() - 1 ) ;
|
||||||
int len = search.Length() ;
|
int len = search.length() ;
|
||||||
Str255 s1 , s2 ;
|
Str255 s1 , s2 ;
|
||||||
wxMacStringToPascal( search , s2 ) ;
|
wxMacStringToPascal( search , s2 ) ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < m_noItems ; ++ i )
|
for ( size_t i = 0 ; i < m_noItems ; ++ i )
|
||||||
{
|
{
|
||||||
wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
|
wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
|
||||||
|
|
||||||
if ( EqualString( s1 , s2 , bCase , false ) )
|
if ( EqualString( s1 , s2 , bCase , false ) )
|
||||||
return i ;
|
return (int)i ;
|
||||||
}
|
}
|
||||||
if ( s.Left(1) == wxT("*") && s.Length() > 1 )
|
if ( s.Left(1) == wxT("*") && s.length() > 1 )
|
||||||
{
|
{
|
||||||
wxString st = s ;
|
wxString st = s ;
|
||||||
st.MakeLower() ;
|
st.MakeLower() ;
|
||||||
for ( int i = 0 ; i < m_noItems ; ++i )
|
for ( size_t i = 0 ; i < m_noItems ; ++i )
|
||||||
{
|
{
|
||||||
if ( GetString(i).Lower().Matches(st) )
|
if ( GetString(i).Lower().Matches(st) )
|
||||||
return i ;
|
return (int)i ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,12 +492,12 @@ int wxListBox::FindString(const wxString& s, bool bCase) const
|
|||||||
|
|
||||||
wxMacStringToPascal( s , s2 ) ;
|
wxMacStringToPascal( s , s2 ) ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < m_noItems ; ++ i )
|
for ( size_t i = 0 ; i < m_noItems ; ++ i )
|
||||||
{
|
{
|
||||||
wxMacStringToPascal( m_stringArray[i] , s1 ) ;
|
wxMacStringToPascal( m_stringArray[i] , s1 ) ;
|
||||||
|
|
||||||
if ( EqualString( s1 , s2 , bCase , false ) )
|
if ( EqualString( s1 , s2 , bCase , false ) )
|
||||||
return i ;
|
return (int)i ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +515,7 @@ void wxListBox::Clear()
|
|||||||
|
|
||||||
void wxListBox::DoSetSelection(int N, bool select)
|
void wxListBox::DoSetSelection(int N, bool select)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::SetSelection") );
|
wxT("invalid index in wxListBox::SetSelection") );
|
||||||
MacSetSelection( N , select ) ;
|
MacSetSelection( N , select ) ;
|
||||||
GetSelections( m_selectionPreImage ) ;
|
GetSelections( m_selectionPreImage ) ;
|
||||||
@@ -519,7 +523,7 @@ void wxListBox::DoSetSelection(int N, bool select)
|
|||||||
|
|
||||||
bool wxListBox::IsSelected(int N) const
|
bool wxListBox::IsSelected(int N) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
|
wxCHECK_MSG( IsValid(N), false,
|
||||||
wxT("invalid index in wxListBox::Selected") );
|
wxT("invalid index in wxListBox::Selected") );
|
||||||
|
|
||||||
return MacIsSelected( N ) ;
|
return MacIsSelected( N ) ;
|
||||||
@@ -527,7 +531,7 @@ bool wxListBox::IsSelected(int N) const
|
|||||||
|
|
||||||
void *wxListBox::DoGetItemClientData(int N) const
|
void *wxListBox::DoGetItemClientData(int N) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
|
wxCHECK_MSG( IsValid(N), NULL,
|
||||||
wxT("invalid index in wxListBox::GetClientData"));
|
wxT("invalid index in wxListBox::GetClientData"));
|
||||||
|
|
||||||
return (void *)m_dataArray[N];
|
return (void *)m_dataArray[N];
|
||||||
@@ -540,7 +544,7 @@ wxClientData *wxListBox::DoGetItemClientObject(int N) const
|
|||||||
|
|
||||||
void wxListBox::DoSetItemClientData(int N, void *Client_data)
|
void wxListBox::DoSetItemClientData(int N, void *Client_data)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::SetClientData") );
|
wxT("invalid index in wxListBox::SetClientData") );
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -588,14 +592,14 @@ wxString wxListBox::GetString(int N) const
|
|||||||
|
|
||||||
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
|
wxCHECK_RET( IsValidInsert(pos),
|
||||||
wxT("invalid index in wxListBox::InsertItems") );
|
wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
int nItems = items.GetCount();
|
size_t nItems = items.GetCount();
|
||||||
|
|
||||||
for ( int i = 0 ; i < nItems ; i++ )
|
for ( size_t i = 0 ; i < nItems ; i++ )
|
||||||
{
|
{
|
||||||
m_stringArray.Insert( items[i] , pos + i ) ;
|
m_stringArray.Insert( items[i] , pos + i ) ;
|
||||||
m_dataArray.Insert( NULL , pos + i ) ;
|
m_dataArray.Insert( NULL , pos + i ) ;
|
||||||
@@ -647,7 +651,7 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
&baseline );
|
&baseline );
|
||||||
wLine = bounds.h ;
|
wLine = bounds.h ;
|
||||||
#else
|
#else
|
||||||
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
|
wLine = ::TextWidth( str.c_str() , 0 , str.length() ) ;
|
||||||
#endif
|
#endif
|
||||||
lbWidth = wxMax(lbWidth, wLine);
|
lbWidth = wxMax(lbWidth, wLine);
|
||||||
}
|
}
|
||||||
@@ -667,7 +671,7 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
return wxSize(lbWidth, lbHeight);
|
return wxSize(lbWidth, lbHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_noItems;
|
return m_noItems;
|
||||||
}
|
}
|
||||||
@@ -692,7 +696,7 @@ public:
|
|||||||
wxListBoxItem(const wxString& str = wxEmptyString);
|
wxListBoxItem(const wxString& str = wxEmptyString);
|
||||||
};
|
};
|
||||||
|
|
||||||
wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE)
|
wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, false)
|
||||||
{
|
{
|
||||||
// no bitmaps/checkmarks
|
// no bitmaps/checkmarks
|
||||||
SetMarginWidth(0);
|
SetMarginWidth(0);
|
||||||
@@ -721,7 +725,7 @@ list = (wxListBox*)refCon;
|
|||||||
::TextFont( kFontIDMonaco ) ;
|
::TextFont( kFontIDMonaco ) ;
|
||||||
::TextSize( 9 );
|
::TextSize( 9 );
|
||||||
::TextFace( 0 ) ;
|
::TextFace( 0 ) ;
|
||||||
DrawText(text, 0 , text.Length());
|
DrawText(text, 0 , text.length());
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -1017,3 +1021,5 @@ void wxListBox::OnChar(wxKeyEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_LISTBOX
|
||||||
|
@@ -13,9 +13,11 @@
|
|||||||
// headers
|
// headers
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/wxprec.h"
|
||||||
#include "wx/arrstr.h"
|
|
||||||
|
|
||||||
|
#if wxUSE_RADIOBOX
|
||||||
|
|
||||||
|
#include "wx/arrstr.h"
|
||||||
#include "wx/radiobox.h"
|
#include "wx/radiobox.h"
|
||||||
#include "wx/radiobut.h"
|
#include "wx/radiobut.h"
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
@@ -109,7 +111,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
m_noItems = n;
|
m_noItems = (size_t)n;
|
||||||
m_noRowsOrCols = majorDim;
|
m_noRowsOrCols = majorDim;
|
||||||
m_radioButtonCycle = NULL;
|
m_radioButtonCycle = NULL;
|
||||||
|
|
||||||
@@ -153,14 +155,13 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
|
|
||||||
bool wxRadioBox::Enable(bool enable)
|
bool wxRadioBox::Enable(bool enable)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
wxRadioButton *current;
|
wxRadioButton *current;
|
||||||
|
|
||||||
if (!wxControl::Enable(enable))
|
if (!wxControl::Enable(enable))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
current = m_radioButtonCycle;
|
current = m_radioButtonCycle;
|
||||||
for (i = 0; i < m_noItems; i++) {
|
for (size_t i = 0; i < m_noItems; i++) {
|
||||||
current->Enable(enable);
|
current->Enable(enable);
|
||||||
current = current->NextInCycle();
|
current = current->NextInCycle();
|
||||||
}
|
}
|
||||||
@@ -310,13 +311,12 @@ void wxRadioBox::SetSelection(int item)
|
|||||||
|
|
||||||
bool wxRadioBox::Show(bool show)
|
bool wxRadioBox::Show(bool show)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
wxRadioButton *current;
|
wxRadioButton *current;
|
||||||
|
|
||||||
wxControl::Show(show);
|
wxControl::Show(show);
|
||||||
|
|
||||||
current=m_radioButtonCycle;
|
current=m_radioButtonCycle;
|
||||||
for (i=0;i<m_noItems;i++)
|
for (size_t i=0; i<m_noItems; i++)
|
||||||
{
|
{
|
||||||
current->Show(show);
|
current->Show(show);
|
||||||
current=current->NextInCycle();
|
current=current->NextInCycle();
|
||||||
@@ -385,7 +385,7 @@ void wxRadioBox::SetFocus()
|
|||||||
|
|
||||||
void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
wxRadioButton *current;
|
wxRadioButton *current;
|
||||||
|
|
||||||
// define the position
|
// define the position
|
||||||
@@ -504,7 +504,7 @@ wxSize wxRadioBox::DoGetBestSize() const
|
|||||||
maxWidth = -1;
|
maxWidth = -1;
|
||||||
maxHeight = -1;
|
maxHeight = -1;
|
||||||
|
|
||||||
for (int i = 0 ; i < m_noItems; i++)
|
for (size_t i = 0 ; i < m_noItems; i++)
|
||||||
{
|
{
|
||||||
GetTextExtent(GetString(i), &eachWidth, &eachHeight);
|
GetTextExtent(GetString(i), &eachWidth, &eachHeight);
|
||||||
eachWidth = (int)(eachWidth + RADIO_SIZE) ;
|
eachWidth = (int)(eachWidth + RADIO_SIZE) ;
|
||||||
@@ -529,3 +529,5 @@ wxSize wxRadioBox::DoGetBestSize() const
|
|||||||
|
|
||||||
return wxSize(totWidth, totHeight);
|
return wxSize(totWidth, totHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_RADIOBOX
|
||||||
|
@@ -12,15 +12,13 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_CHOICE
|
||||||
|
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
#define XtDisplay XTDISPLAY
|
#define XtDisplay XTDISPLAY
|
||||||
#define XtParent XTPARENT
|
#define XtParent XTPARENT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
|
|
||||||
#if wxUSE_CHOICE
|
|
||||||
|
|
||||||
#include "wx/choice.h"
|
#include "wx/choice.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/arrstr.h"
|
#include "wx/arrstr.h"
|
||||||
@@ -192,7 +190,7 @@ static inline wxChar* MYcopystring(const wxChar* s)
|
|||||||
int wxChoice::DoInsert(const wxString& item, int pos)
|
int wxChoice::DoInsert(const wxString& item, int pos)
|
||||||
{
|
{
|
||||||
#ifndef XmNpositionIndex
|
#ifndef XmNpositionIndex
|
||||||
wxCHECK_MSG( pos == GetCount(), -1, wxT("insert not implemented"));
|
wxCHECK_MSG( (size_t)pos == GetCount(), -1, wxT("insert not implemented"));
|
||||||
#endif
|
#endif
|
||||||
Widget w = XtVaCreateManagedWidget (wxStripMenuCodes(item),
|
Widget w = XtVaCreateManagedWidget (wxStripMenuCodes(item),
|
||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
@@ -238,7 +236,7 @@ int wxChoice::DoInsert(const wxString& item, int pos)
|
|||||||
|
|
||||||
int wxChoice::DoAppend(const wxString& item)
|
int wxChoice::DoAppend(const wxString& item)
|
||||||
{
|
{
|
||||||
return DoInsert(item, GetCount());
|
return DoInsert(item, (int)GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Delete(int n)
|
void wxChoice::Delete(int n)
|
||||||
@@ -497,7 +495,7 @@ void wxChoice::ChangeForegroundColour()
|
|||||||
wxDoChangeForegroundColour(m_widgetArray[i], m_foregroundColour);
|
wxDoChangeForegroundColour(m_widgetArray[i], m_foregroundColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return m_noStrings;
|
return m_noStrings;
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if( !CreateControl( parent, id, pos, size, style, validator, name ) )
|
if( !CreateControl( parent, id, pos, size, style, validator, name ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_noStrings = n;
|
m_noStrings = (size_t)n;
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ int wxComboBox::DoAppend(const wxString& item)
|
|||||||
int wxComboBox::DoInsert(const wxString& item, int pos)
|
int wxComboBox::DoInsert(const wxString& item, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
||||||
wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
if (pos == GetCount())
|
if (pos == GetCount())
|
||||||
return DoAppend(item);
|
return DoAppend(item);
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_LISTBOX
|
||||||
|
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
#define XtParent XTPARENT
|
#define XtParent XTPARENT
|
||||||
#define XtDisplay XTDISPLAY
|
#define XtDisplay XTDISPLAY
|
||||||
@@ -87,7 +89,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
validator, name ) )
|
validator, name ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_noItems = n;
|
m_noItems = (size_t)n;
|
||||||
m_backgroundColour = * wxWHITE;
|
m_backgroundColour = * wxWHITE;
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
@@ -190,8 +192,9 @@ void wxListBox::DoSetFirstItem( int N )
|
|||||||
{
|
{
|
||||||
int count, length;
|
int count, length;
|
||||||
|
|
||||||
if (N < 0)
|
if (!IsValid(N))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XtVaGetValues ((Widget) m_mainWidget,
|
XtVaGetValues ((Widget) m_mainWidget,
|
||||||
XmNvisibleItemCount, &count,
|
XmNvisibleItemCount, &count,
|
||||||
XmNitemCount, &length,
|
XmNitemCount, &length,
|
||||||
@@ -663,7 +666,7 @@ void wxListBox::ChangeForegroundColour()
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_noItems;
|
return m_noItems;
|
||||||
}
|
}
|
||||||
@@ -714,3 +717,5 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
{
|
{
|
||||||
return wxDoGetListBoxBestSize( (Widget)m_mainWidget, this );
|
return wxDoGetListBoxBestSize( (Widget)m_mainWidget, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_LISTBOX
|
||||||
|
@@ -12,12 +12,12 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_RADIOBOX
|
||||||
|
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
#define XtDisplay XTDISPLAY
|
#define XtDisplay XTDISPLAY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
|
|
||||||
#include "wx/radiobox.h"
|
#include "wx/radiobox.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/arrstr.h"
|
#include "wx/arrstr.h"
|
||||||
@@ -59,7 +59,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
if( !CreateControl( parent, id, pos, size, style, val, name ) )
|
if( !CreateControl( parent, id, pos, size, style, val, name ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_noItems = n;
|
m_noItems = (size_t)n;
|
||||||
m_noRowsOrCols = majorDim;
|
m_noRowsOrCols = majorDim;
|
||||||
|
|
||||||
SetMajorDim(majorDim == 0 ? n : majorDim, style);
|
SetMajorDim(majorDim == 0 ? n : majorDim, style);
|
||||||
@@ -197,8 +197,7 @@ void wxRadioBox::SetSelection(int n)
|
|||||||
|
|
||||||
XmToggleButtonSetState ((Widget) m_radioButtons[n], True, False);
|
XmToggleButtonSetState ((Widget) m_radioButtons[n], True, False);
|
||||||
|
|
||||||
int i;
|
for (size_t i = 0; i < m_noItems; i++)
|
||||||
for (i = 0; i < m_noItems; i++)
|
|
||||||
if (i != n)
|
if (i != n)
|
||||||
XmToggleButtonSetState ((Widget) m_radioButtons[i], False, False);
|
XmToggleButtonSetState ((Widget) m_radioButtons[i], False, False);
|
||||||
|
|
||||||
@@ -259,8 +258,7 @@ bool wxRadioBox::Enable(bool enable)
|
|||||||
if ( !wxControl::Enable(enable) )
|
if ( !wxControl::Enable(enable) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int i;
|
for (size_t i = 0; i < m_noItems; i++)
|
||||||
for (i = 0; i < m_noItems; i++)
|
|
||||||
XtSetSensitive ((Widget) m_radioButtons[i], (Boolean) enable);
|
XtSetSensitive ((Widget) m_radioButtons[i], (Boolean) enable);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -335,8 +333,7 @@ void wxRadioBox::ChangeFont(bool keepOriginalSize)
|
|||||||
{
|
{
|
||||||
wxWindow::ChangeFont(keepOriginalSize);
|
wxWindow::ChangeFont(keepOriginalSize);
|
||||||
|
|
||||||
int i;
|
for (size_t i = 0; i < m_noItems; i++)
|
||||||
for (i = 0; i < m_noItems; i++)
|
|
||||||
{
|
{
|
||||||
WXWidget radioButton = m_radioButtons[i];
|
WXWidget radioButton = m_radioButtons[i];
|
||||||
|
|
||||||
@@ -352,8 +349,7 @@ void wxRadioBox::ChangeBackgroundColour()
|
|||||||
|
|
||||||
int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget));
|
int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget));
|
||||||
|
|
||||||
int i;
|
for (size_t i = 0; i < m_noItems; i++)
|
||||||
for (i = 0; i < m_noItems; i++)
|
|
||||||
{
|
{
|
||||||
WXWidget radioButton = m_radioButtons[i];
|
WXWidget radioButton = m_radioButtons[i];
|
||||||
|
|
||||||
@@ -369,8 +365,7 @@ void wxRadioBox::ChangeForegroundColour()
|
|||||||
{
|
{
|
||||||
wxWindow::ChangeForegroundColour();
|
wxWindow::ChangeForegroundColour();
|
||||||
|
|
||||||
int i;
|
for (size_t i = 0; i < m_noItems; i++)
|
||||||
for (i = 0; i < m_noItems; i++)
|
|
||||||
{
|
{
|
||||||
WXWidget radioButton = m_radioButtons[i];
|
WXWidget radioButton = m_radioButtons[i];
|
||||||
|
|
||||||
@@ -402,3 +397,5 @@ void wxRadioBoxCallback (Widget w, XtPointer clientData,
|
|||||||
event.SetEventObject(item);
|
event.SetEventObject(item);
|
||||||
item->ProcessCommand (event);
|
item->ProcessCommand (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_RADIOBOX
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msw/checklst.cpp
|
// Name: src/msw/checklst.cpp
|
||||||
// Purpose: implementation of wxCheckListBox class
|
// Purpose: implementation of wxCheckListBox class
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -337,7 +337,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
void wxCheckListBox::Delete(int N)
|
void wxCheckListBox::Delete(int N)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::Delete") );
|
wxT("invalid index in wxListBox::Delete") );
|
||||||
|
|
||||||
wxListBox::Delete(N);
|
wxListBox::Delete(N);
|
||||||
@@ -521,7 +521,7 @@ int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const
|
|||||||
MAKELPARAM(x, y)
|
MAKELPARAM(x, y)
|
||||||
);
|
);
|
||||||
|
|
||||||
return nItem >= m_noItems ? wxNOT_FOUND : nItem;
|
return nItem >= (int)m_noItems ? wxNOT_FOUND : nItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -534,4 +534,3 @@ wxSize wxCheckListBox::DoGetBestSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -239,7 +239,7 @@ int wxChoice::DoAppend(const wxString& item)
|
|||||||
int wxChoice::DoInsert(const wxString& item, int pos)
|
int wxChoice::DoInsert(const wxString& item, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
||||||
wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
int n = (int)SendMessage(GetHwnd(), CB_INSERTSTRING, pos, (LPARAM)item.c_str());
|
int n = (int)SendMessage(GetHwnd(), CB_INSERTSTRING, pos, (LPARAM)item.c_str());
|
||||||
if ( n == CB_ERR )
|
if ( n == CB_ERR )
|
||||||
@@ -258,7 +258,7 @@ int wxChoice::DoInsert(const wxString& item, int pos)
|
|||||||
|
|
||||||
void wxChoice::Delete(int n)
|
void wxChoice::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") );
|
||||||
|
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
{
|
{
|
||||||
@@ -326,9 +326,9 @@ void wxChoice::SetSelection(int n)
|
|||||||
// string list functions
|
// string list functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return (int)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0);
|
return (size_t)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::FindString(const wxString& s, bool bCase) const
|
int wxChoice::FindString(const wxString& s, bool bCase) const
|
||||||
@@ -336,8 +336,8 @@ int wxChoice::FindString(const wxString& s, bool bCase) const
|
|||||||
#if defined(__WATCOMC__) && defined(__WIN386__)
|
#if defined(__WATCOMC__) && defined(__WIN386__)
|
||||||
// For some reason, Watcom in WIN386 mode crashes in the CB_FINDSTRINGEXACT message.
|
// For some reason, Watcom in WIN386 mode crashes in the CB_FINDSTRINGEXACT message.
|
||||||
// wxChoice::Do it the long way instead.
|
// wxChoice::Do it the long way instead.
|
||||||
int count = GetCount();
|
size_t count = GetCount();
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( size_t i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
// as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too
|
// as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too
|
||||||
if ( GetString(i).IsSameAs(s, bCase) )
|
if ( GetString(i).IsSameAs(s, bCase) )
|
||||||
@@ -350,8 +350,8 @@ int wxChoice::FindString(const wxString& s, bool bCase) const
|
|||||||
//passed to SendMessage, so we have to do it ourselves in that case
|
//passed to SendMessage, so we have to do it ourselves in that case
|
||||||
if ( s.empty() )
|
if ( s.empty() )
|
||||||
{
|
{
|
||||||
int count = GetCount();
|
size_t count = GetCount();
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( size_t i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
if ( GetString(i).empty() )
|
if ( GetString(i).empty() )
|
||||||
return i;
|
return i;
|
||||||
@@ -376,8 +376,7 @@ int wxChoice::FindString(const wxString& s, bool bCase) const
|
|||||||
|
|
||||||
void wxChoice::SetString(int n, const wxString& s)
|
void wxChoice::SetString(int n, const wxString& s)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < GetCount(),
|
wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::SetString") );
|
||||||
wxT("invalid item index in wxChoice::SetString") );
|
|
||||||
|
|
||||||
// we have to delete and add back the string as there is no way to change a
|
// we have to delete and add back the string as there is no way to change a
|
||||||
// string in place
|
// string in place
|
||||||
|
@@ -250,7 +250,7 @@ WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|||||||
|
|
||||||
void wxListBox::DoSetFirstItem(int N)
|
void wxListBox::DoSetFirstItem(int N)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::SetFirstItem") );
|
wxT("invalid index in wxListBox::SetFirstItem") );
|
||||||
|
|
||||||
SendMessage(GetHwnd(), LB_SETTOPINDEX, (WPARAM)N, (LPARAM)0);
|
SendMessage(GetHwnd(), LB_SETTOPINDEX, (WPARAM)N, (LPARAM)0);
|
||||||
@@ -258,7 +258,7 @@ void wxListBox::DoSetFirstItem(int N)
|
|||||||
|
|
||||||
void wxListBox::Delete(int N)
|
void wxListBox::Delete(int N)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::Delete") );
|
wxT("invalid index in wxListBox::Delete") );
|
||||||
|
|
||||||
// for owner drawn objects, the data is used for storing wxOwnerDrawn
|
// for owner drawn objects, the data is used for storing wxOwnerDrawn
|
||||||
@@ -312,7 +312,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
|||||||
ListBox_ResetContent(GetHwnd());
|
ListBox_ResetContent(GetHwnd());
|
||||||
|
|
||||||
m_noItems = choices.GetCount();
|
m_noItems = choices.GetCount();
|
||||||
int i;
|
size_t i;
|
||||||
for (i = 0; i < m_noItems; i++)
|
for (i = 0; i < m_noItems; i++)
|
||||||
{
|
{
|
||||||
ListBox_AddString(GetHwnd(), choices[i]);
|
ListBox_AddString(GetHwnd(), choices[i]);
|
||||||
@@ -328,7 +328,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
|||||||
WX_CLEAR_ARRAY(m_aItems);
|
WX_CLEAR_ARRAY(m_aItems);
|
||||||
|
|
||||||
// then create new ones
|
// then create new ones
|
||||||
for ( size_t ui = 0; ui < (size_t)m_noItems; ui++ ) {
|
for ( size_t ui = 0; ui < m_noItems; ui++ ) {
|
||||||
wxOwnerDrawn *pNewItem = CreateLboxItem(ui);
|
wxOwnerDrawn *pNewItem = CreateLboxItem(ui);
|
||||||
pNewItem->SetName(choices[ui]);
|
pNewItem->SetName(choices[ui]);
|
||||||
m_aItems.Add(pNewItem);
|
m_aItems.Add(pNewItem);
|
||||||
@@ -384,7 +384,7 @@ void wxListBox::Free()
|
|||||||
#endif // wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
{
|
{
|
||||||
for ( size_t n = 0; n < (size_t)m_noItems; n++ )
|
for ( size_t n = 0; n < m_noItems; n++ )
|
||||||
{
|
{
|
||||||
delete GetClientObject(n);
|
delete GetClientObject(n);
|
||||||
}
|
}
|
||||||
@@ -393,8 +393,7 @@ void wxListBox::Free()
|
|||||||
|
|
||||||
void wxListBox::DoSetSelection(int N, bool select)
|
void wxListBox::DoSetSelection(int N, bool select)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N == wxNOT_FOUND ||
|
wxCHECK_RET( N == wxNOT_FOUND || IsValid(N),
|
||||||
(N >= 0 && N < m_noItems),
|
|
||||||
wxT("invalid index in wxListBox::SetSelection") );
|
wxT("invalid index in wxListBox::SetSelection") );
|
||||||
|
|
||||||
if ( HasMultipleSelection() )
|
if ( HasMultipleSelection() )
|
||||||
@@ -409,7 +408,7 @@ void wxListBox::DoSetSelection(int N, bool select)
|
|||||||
|
|
||||||
bool wxListBox::IsSelected(int N) const
|
bool wxListBox::IsSelected(int N) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( N >= 0 && N < m_noItems, false,
|
wxCHECK_MSG( IsValid(N), false,
|
||||||
wxT("invalid index in wxListBox::Selected") );
|
wxT("invalid index in wxListBox::Selected") );
|
||||||
|
|
||||||
return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? false : true;
|
return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? false : true;
|
||||||
@@ -422,7 +421,7 @@ wxClientData* wxListBox::DoGetItemClientObject(int n) const
|
|||||||
|
|
||||||
void *wxListBox::DoGetItemClientData(int n) const
|
void *wxListBox::DoGetItemClientData(int n) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && n < m_noItems, NULL,
|
wxCHECK_MSG( IsValid(n), NULL,
|
||||||
wxT("invalid index in wxListBox::GetClientData") );
|
wxT("invalid index in wxListBox::GetClientData") );
|
||||||
|
|
||||||
return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
|
return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
|
||||||
@@ -435,7 +434,7 @@ void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
|
|||||||
|
|
||||||
void wxListBox::DoSetItemClientData(int n, void *clientData)
|
void wxListBox::DoSetItemClientData(int n, void *clientData)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < m_noItems,
|
wxCHECK_RET( IsValid(n),
|
||||||
wxT("invalid index in wxListBox::SetClientData") );
|
wxT("invalid index in wxListBox::SetClientData") );
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -507,7 +506,7 @@ int wxListBox::GetSelection() const
|
|||||||
// Find string for position
|
// Find string for position
|
||||||
wxString wxListBox::GetString(int N) const
|
wxString wxListBox::GetString(int N) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( N >= 0 && N < m_noItems, wxEmptyString,
|
wxCHECK_MSG( IsValid(N), wxEmptyString,
|
||||||
wxT("invalid index in wxListBox::GetString") );
|
wxT("invalid index in wxListBox::GetString") );
|
||||||
|
|
||||||
int len = ListBox_GetTextLen(GetHwnd(), N);
|
int len = ListBox_GetTextLen(GetHwnd(), N);
|
||||||
@@ -522,7 +521,7 @@ wxString wxListBox::GetString(int N) const
|
|||||||
void
|
void
|
||||||
wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
|
wxCHECK_RET( IsValidInsert(pos),
|
||||||
wxT("invalid index in wxListBox::InsertItems") );
|
wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
int nItems = items.GetCount();
|
int nItems = items.GetCount();
|
||||||
@@ -564,7 +563,7 @@ int wxListBox::DoListHitTest(const wxPoint& point) const
|
|||||||
|
|
||||||
void wxListBox::SetString(int N, const wxString& s)
|
void wxListBox::SetString(int N, const wxString& s)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::SetString") );
|
wxT("invalid index in wxListBox::SetString") );
|
||||||
|
|
||||||
// remember the state of the item
|
// remember the state of the item
|
||||||
@@ -581,7 +580,7 @@ void wxListBox::SetString(int N, const wxString& s)
|
|||||||
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
|
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
|
||||||
|
|
||||||
int newN = N;
|
int newN = N;
|
||||||
if ( N == m_noItems - 1 )
|
if ( N == (int)(m_noItems - 1) )
|
||||||
newN = -1;
|
newN = -1;
|
||||||
|
|
||||||
ListBox_InsertString(GetHwnd(), newN, s);
|
ListBox_InsertString(GetHwnd(), newN, s);
|
||||||
@@ -610,7 +609,7 @@ void wxListBox::SetString(int N, const wxString& s)
|
|||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_noItems;
|
return m_noItems;
|
||||||
}
|
}
|
||||||
@@ -639,7 +638,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
|||||||
|
|
||||||
GetTextMetrics(dc, &lpTextMetric);
|
GetTextMetrics(dc, &lpTextMetric);
|
||||||
SIZE extentXY;
|
SIZE extentXY;
|
||||||
::GetTextExtentPoint32(dc, (LPTSTR) (const wxChar *)s, s.Length(), &extentXY);
|
::GetTextExtentPoint32(dc, (LPTSTR) (const wxChar *)s, s.length(), &extentXY);
|
||||||
int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
|
int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
|
||||||
|
|
||||||
if (oldFont)
|
if (oldFont)
|
||||||
@@ -659,7 +658,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
|||||||
|
|
||||||
GetTextMetrics(dc, &lpTextMetric);
|
GetTextMetrics(dc, &lpTextMetric);
|
||||||
|
|
||||||
for (int i = 0; i < m_noItems; i++)
|
for (size_t i = 0; i < m_noItems; i++)
|
||||||
{
|
{
|
||||||
wxString str = GetString(i);
|
wxString str = GetString(i);
|
||||||
SIZE extentXY;
|
SIZE extentXY;
|
||||||
@@ -681,7 +680,7 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
// find the widest string
|
// find the widest string
|
||||||
int wLine;
|
int wLine;
|
||||||
int wListbox = 0;
|
int wListbox = 0;
|
||||||
for ( int i = 0; i < m_noItems; i++ )
|
for ( size_t i = 0; i < m_noItems; i++ )
|
||||||
{
|
{
|
||||||
wxString str(GetString(i));
|
wxString str(GetString(i));
|
||||||
GetTextExtent(str, &wLine, NULL);
|
GetTextExtent(str, &wLine, NULL);
|
||||||
|
@@ -269,8 +269,8 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
|
|
||||||
int selectedButton = wxNOT_FOUND;
|
int selectedButton = wxNOT_FOUND;
|
||||||
|
|
||||||
int count = GetCount();
|
const size_t count = GetCount();
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( size_t i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
if ( id == wxGetWindowId((*m_radioButtons)[i]) )
|
if ( id == wxGetWindowId((*m_radioButtons)[i]) )
|
||||||
{
|
{
|
||||||
@@ -323,7 +323,7 @@ void wxRadioBox::SendNotificationEvent()
|
|||||||
// simple accessors
|
// simple accessors
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxRadioBox::GetCount() const
|
size_t wxRadioBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_radioButtons->GetCount();
|
return m_radioButtons->GetCount();
|
||||||
}
|
}
|
||||||
@@ -432,8 +432,8 @@ wxSize wxRadioBox::GetMaxButtonSize() const
|
|||||||
// calculate the max button size
|
// calculate the max button size
|
||||||
int widthMax = 0,
|
int widthMax = 0,
|
||||||
heightMax = 0;
|
heightMax = 0;
|
||||||
const int count = GetCount();
|
const size_t count = GetCount();
|
||||||
for ( int i = 0 ; i < count; i++ )
|
for ( size_t i = 0 ; i < count; i++ )
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
if ( m_radioWidth[i] < 0 )
|
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 startX = x_offset;
|
||||||
int startY = y_offset;
|
int startY = y_offset;
|
||||||
|
|
||||||
const int count = GetCount();
|
const size_t count = GetCount();
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( size_t i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
// the last button in the row may be wider than the other ones as the
|
// 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
|
// 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
|
// 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
|
// columns or if it is just the last item
|
||||||
int n = i + 1;
|
size_t n = i + 1;
|
||||||
isLastInTheRow = ((n % GetMajorDim()) == 0) || (n == count);
|
isLastInTheRow = ((n % GetMajorDim()) == 0) || (n == count);
|
||||||
}
|
}
|
||||||
else // wxRA_SPECIFY_ROWS
|
else // wxRA_SPECIFY_ROWS
|
||||||
|
@@ -156,8 +156,7 @@ void wxCheckListBox::OnSize(wxSizeEvent& event)
|
|||||||
|
|
||||||
void wxCheckListBox::Delete(int n)
|
void wxCheckListBox::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < GetCount(),
|
wxCHECK_RET( IsValid( n ), _T("invalid index in wxCheckListBox::Delete") );
|
||||||
_T("invalid index in wxCheckListBox::Delete") );
|
|
||||||
|
|
||||||
if ( !ListView_DeleteItem(GetHwnd(), n) )
|
if ( !ListView_DeleteItem(GetHwnd(), n) )
|
||||||
{
|
{
|
||||||
@@ -171,7 +170,7 @@ void wxCheckListBox::Delete(int n)
|
|||||||
|
|
||||||
bool wxCheckListBox::IsChecked(size_t uiIndex) const
|
bool wxCheckListBox::IsChecked(size_t uiIndex) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( uiIndex < (size_t)GetCount(), false,
|
wxCHECK_MSG( IsValid( uiIndex ), false,
|
||||||
_T("invalid index in wxCheckListBox::IsChecked") );
|
_T("invalid index in wxCheckListBox::IsChecked") );
|
||||||
|
|
||||||
return (ListView_GetCheckState(((HWND)GetHWND()), uiIndex) != 0);
|
return (ListView_GetCheckState(((HWND)GetHWND()), uiIndex) != 0);
|
||||||
@@ -179,7 +178,7 @@ bool wxCheckListBox::IsChecked(size_t uiIndex) const
|
|||||||
|
|
||||||
void wxCheckListBox::Check(size_t uiIndex, bool bCheck)
|
void wxCheckListBox::Check(size_t uiIndex, bool bCheck)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( uiIndex < (size_t)GetCount(),
|
wxCHECK_RET( IsValid( uiIndex ),
|
||||||
_T("invalid index in wxCheckListBox::Check") );
|
_T("invalid index in wxCheckListBox::Check") );
|
||||||
|
|
||||||
ListView_SetCheckState(((HWND)GetHWND()), uiIndex, bCheck)
|
ListView_SetCheckState(((HWND)GetHWND()), uiIndex, bCheck)
|
||||||
@@ -190,7 +189,7 @@ void wxCheckListBox::Check(size_t uiIndex, bool bCheck)
|
|||||||
|
|
||||||
void wxCheckListBox::Clear()
|
void wxCheckListBox::Clear()
|
||||||
{
|
{
|
||||||
int n = GetCount();
|
int n = (int)GetCount();
|
||||||
|
|
||||||
while ( n > 0 )
|
while ( n > 0 )
|
||||||
{
|
{
|
||||||
@@ -204,15 +203,15 @@ void wxCheckListBox::Clear()
|
|||||||
_T("broken wxCheckListBox::Clear()") );
|
_T("broken wxCheckListBox::Clear()") );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxCheckListBox::GetCount() const
|
size_t wxCheckListBox::GetCount() const
|
||||||
{
|
{
|
||||||
return ListView_GetItemCount( (HWND)GetHWND() );
|
return (size_t)ListView_GetItemCount( (HWND)GetHWND() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxCheckListBox::GetSelection() const
|
int wxCheckListBox::GetSelection() const
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < GetCount(); i++)
|
for (i = 0; (size_t)i < GetCount(); i++)
|
||||||
{
|
{
|
||||||
int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED);
|
int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED);
|
||||||
if (selState == LVIS_SELECTED)
|
if (selState == LVIS_SELECTED)
|
||||||
@@ -225,7 +224,7 @@ int wxCheckListBox::GetSelection() const
|
|||||||
int wxCheckListBox::GetSelections(wxArrayInt& aSelections) const
|
int wxCheckListBox::GetSelections(wxArrayInt& aSelections) const
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < GetCount(); i++)
|
for (i = 0; (size_t)i < GetCount(); i++)
|
||||||
{
|
{
|
||||||
int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED);
|
int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED);
|
||||||
if (selState == LVIS_SELECTED)
|
if (selState == LVIS_SELECTED)
|
||||||
@@ -253,7 +252,7 @@ bool wxCheckListBox::IsSelected(int n) const
|
|||||||
|
|
||||||
void wxCheckListBox::SetString(int n, const wxString& s)
|
void wxCheckListBox::SetString(int n, const wxString& s)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(),
|
wxCHECK_RET( IsValid( n ),
|
||||||
_T("invalid index in wxCheckListBox::SetString") );
|
_T("invalid index in wxCheckListBox::SetString") );
|
||||||
wxChar *buf = new wxChar[s.length()+1];
|
wxChar *buf = new wxChar[s.length()+1];
|
||||||
wxStrcpy(buf, s.c_str());
|
wxStrcpy(buf, s.c_str());
|
||||||
@@ -263,7 +262,7 @@ void wxCheckListBox::SetString(int n, const wxString& s)
|
|||||||
|
|
||||||
int wxCheckListBox::DoAppend(const wxString& item)
|
int wxCheckListBox::DoAppend(const wxString& item)
|
||||||
{
|
{
|
||||||
int n = GetCount();
|
int n = (int)GetCount();
|
||||||
LVITEM newItem;
|
LVITEM newItem;
|
||||||
wxZeroMemory(newItem);
|
wxZeroMemory(newItem);
|
||||||
newItem.iItem = n;
|
newItem.iItem = n;
|
||||||
@@ -286,7 +285,7 @@ wxClientData* wxCheckListBox::DoGetItemClientObject(int n) const
|
|||||||
|
|
||||||
void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos)
|
void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( pos >= 0 && pos <= GetCount(),
|
wxCHECK_RET( IsValidInsert( pos ),
|
||||||
wxT("invalid index in wxListBox::InsertItems") );
|
wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
for( size_t i = 0; i < items.GetCount(); i++ )
|
for( size_t i = 0; i < items.GetCount(); i++ )
|
||||||
|
@@ -24,17 +24,16 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_CHOICE && defined(__SMARTPHONE__) && defined(__WXWINCE__)
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/choice.h"
|
#include "wx/choice.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/spinbutt.h" // for wxSpinnerBestSize
|
|
||||||
|
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include "wx/msw/missing.h"
|
#include "wx/msw/missing.h"
|
||||||
#include "wx/msw/winundef.h"
|
#include "wx/msw/winundef.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if wxUSE_CHOICE && defined(__SMARTPHONE__) && defined(__WXWINCE__)
|
#include "wx/spinbutt.h" // for wxSpinnerBestSize
|
||||||
|
|
||||||
#if wxUSE_EXTENDED_RTTI
|
#if wxUSE_EXTENDED_RTTI
|
||||||
// TODO
|
// TODO
|
||||||
@@ -349,7 +348,7 @@ int wxChoice::DoAppend(const wxString& item)
|
|||||||
int wxChoice::DoInsert(const wxString& item, int pos)
|
int wxChoice::DoInsert(const wxString& item, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into choice"));
|
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into choice"));
|
||||||
wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
int n = (int)::SendMessage(GetBuddyHwnd(), LB_INSERTSTRING, pos, (LPARAM)item.c_str());
|
int n = (int)::SendMessage(GetBuddyHwnd(), LB_INSERTSTRING, pos, (LPARAM)item.c_str());
|
||||||
if ( n == LB_ERR )
|
if ( n == LB_ERR )
|
||||||
@@ -362,7 +361,7 @@ int wxChoice::DoInsert(const wxString& item, int pos)
|
|||||||
|
|
||||||
void wxChoice::Delete(int n)
|
void wxChoice::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") );
|
||||||
|
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
{
|
{
|
||||||
@@ -409,9 +408,9 @@ void wxChoice::SetSelection(int n)
|
|||||||
// string list functions
|
// string list functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return (int)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0);
|
return (size_t)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::FindString(const wxString& s, bool bCase) const
|
int wxChoice::FindString(const wxString& s, bool bCase) const
|
||||||
@@ -428,7 +427,7 @@ int wxChoice::FindString(const wxString& s, bool bCase) const
|
|||||||
|
|
||||||
void wxChoice::SetString(int n, const wxString& s)
|
void wxChoice::SetString(int n, const wxString& s)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < GetCount(),
|
wxCHECK_RET( IsValid(n),
|
||||||
wxT("invalid item index in wxChoice::SetString") );
|
wxT("invalid item index in wxChoice::SetString") );
|
||||||
|
|
||||||
// we have to delete and add back the string as there is no way to change a
|
// we have to delete and add back the string as there is no way to change a
|
||||||
|
@@ -272,7 +272,7 @@ wxCheckListBox::wxCheckListBox ( wxWindow* pParent,
|
|||||||
|
|
||||||
void wxCheckListBox::Delete( int n )
|
void wxCheckListBox::Delete( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < m_nNumItems,
|
wxCHECK_RET( IsValid(n),
|
||||||
wxT("invalid index in wxCheckListBox::Delete") );
|
wxT("invalid index in wxCheckListBox::Delete") );
|
||||||
wxListBox::Delete(n);
|
wxListBox::Delete(n);
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ void wxCheckListBox::OnLeftClick ( wxMouseEvent& rEvent )
|
|||||||
|
|
||||||
size_t nItem = (size_t)(nY / vHeight);
|
size_t nItem = (size_t)(nY / vHeight);
|
||||||
|
|
||||||
if (nItem < (size_t)m_nNumItems)
|
if (nItem < m_nNumItems)
|
||||||
GetItem(nItem)->Toggle();
|
GetItem(nItem)->Toggle();
|
||||||
//
|
//
|
||||||
// else: it's not an error, just click outside of client zone
|
// else: it's not an error, just click outside of client zone
|
||||||
|
@@ -12,8 +12,6 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
|
|
||||||
#if wxUSE_CHOICE
|
#if wxUSE_CHOICE
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
@@ -125,15 +123,12 @@ int wxChoice::DoAppend(
|
|||||||
return nIndex;
|
return nIndex;
|
||||||
} // end of wxChoice::DoAppend
|
} // end of wxChoice::DoAppend
|
||||||
|
|
||||||
int wxChoice::DoInsert(
|
int wxChoice::DoInsert( const wxString& rsItem, int pos )
|
||||||
const wxString& rsItem,
|
|
||||||
int pos
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
||||||
wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
if (pos == GetCount())
|
if ((size_t)pos == GetCount())
|
||||||
return DoAppend(rsItem);
|
return DoAppend(rsItem);
|
||||||
|
|
||||||
int nIndex;
|
int nIndex;
|
||||||
@@ -151,11 +146,9 @@ int wxChoice::DoInsert(
|
|||||||
return nIndex;
|
return nIndex;
|
||||||
} // end of wxChoice::DoInsert
|
} // end of wxChoice::DoInsert
|
||||||
|
|
||||||
void wxChoice::Delete(
|
void wxChoice::Delete( int n )
|
||||||
int n
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") );
|
||||||
::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, (MPARAM)0);
|
::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, (MPARAM)0);
|
||||||
} // end of wxChoice::Delete
|
} // end of wxChoice::Delete
|
||||||
|
|
||||||
@@ -189,9 +182,9 @@ void wxChoice::SetSelection(
|
|||||||
// string list functions
|
// string list functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return((int)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMCOUNT, (MPARAM)0, (MPARAM)0)));
|
return((size_t)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMCOUNT, (MPARAM)0, (MPARAM)0)));
|
||||||
} // end of wxChoice::GetCount
|
} // end of wxChoice::GetCount
|
||||||
|
|
||||||
void wxChoice::SetString( int n, const wxString& rsStr )
|
void wxChoice::SetString( int n, const wxString& rsStr )
|
||||||
@@ -318,19 +311,16 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
//
|
//
|
||||||
int nLineWidth;
|
int nLineWidth;
|
||||||
int nChoiceWidth = 0;
|
int nChoiceWidth = 0;
|
||||||
int nItems = GetCount();
|
|
||||||
int nCx;
|
int nCx;
|
||||||
int nCy;
|
int nCy;
|
||||||
wxFont vFont = (wxFont)GetFont();
|
wxFont vFont = (wxFont)GetFont();
|
||||||
|
|
||||||
for (int i = 0; i < nItems; i++)
|
const size_t nItems = GetCount();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nItems; i++)
|
||||||
{
|
{
|
||||||
wxString sStr(GetString(i));
|
wxString sStr(GetString(i));
|
||||||
|
GetTextExtent( sStr, &nLineWidth, NULL );
|
||||||
GetTextExtent( sStr
|
|
||||||
,&nLineWidth
|
|
||||||
,NULL
|
|
||||||
);
|
|
||||||
if (nLineWidth > nChoiceWidth)
|
if (nLineWidth > nChoiceWidth)
|
||||||
nChoiceWidth = nLineWidth;
|
nChoiceWidth = nLineWidth;
|
||||||
}
|
}
|
||||||
@@ -345,11 +335,7 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
//
|
//
|
||||||
// The combobox should be larger than the widest string
|
// The combobox should be larger than the widest string
|
||||||
//
|
//
|
||||||
wxGetCharSize( GetHWND()
|
wxGetCharSize( GetHWND(), &nCx, &nCy, &vFont );
|
||||||
,&nCx
|
|
||||||
,&nCy
|
|
||||||
,&vFont
|
|
||||||
);
|
|
||||||
nChoiceWidth += 5 * nCx;
|
nChoiceWidth += 5 * nCx;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -411,7 +397,7 @@ void wxChoice::Free()
|
|||||||
{
|
{
|
||||||
if (HasClientObjectData())
|
if (HasClientObjectData())
|
||||||
{
|
{
|
||||||
size_t nCount = GetCount();
|
const size_t nCount = GetCount();
|
||||||
|
|
||||||
for (size_t n = 0; n < nCount; n++)
|
for (size_t n = 0; n < nCount; n++)
|
||||||
{
|
{
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_LISTBOX
|
||||||
|
|
||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
#include "wx/os2/private.h"
|
#include "wx/os2/private.h"
|
||||||
|
|
||||||
@@ -32,8 +34,6 @@
|
|||||||
#include "wx/dynarray.h"
|
#include "wx/dynarray.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
#if wxUSE_LISTBOX
|
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
#include "wx/ownerdrw.h"
|
#include "wx/ownerdrw.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -100,17 +100,15 @@ bool wxListBox::Create(
|
|||||||
lStyle, rValidator, rsName);
|
lStyle, rValidator, rsName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListBox::Create(
|
bool wxListBox::Create( wxWindow* pParent,
|
||||||
wxWindow* pParent
|
wxWindowID vId,
|
||||||
, wxWindowID vId
|
const wxPoint& rPos,
|
||||||
, const wxPoint& rPos
|
const wxSize& rSize,
|
||||||
, const wxSize& rSize
|
int n,
|
||||||
, int n
|
const wxString asChoices[],
|
||||||
, const wxString asChoices[]
|
long lStyle,
|
||||||
, long lStyle
|
const wxValidator& rValidator,
|
||||||
, const wxValidator& rValidator
|
const wxString& rsName )
|
||||||
, const wxString& rsName
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
m_nNumItems = 0;
|
m_nNumItems = 0;
|
||||||
m_hWnd = 0;
|
m_hWnd = 0;
|
||||||
@@ -246,21 +244,17 @@ void wxListBox::SetupColours()
|
|||||||
// implementation of wxListBoxBase methods
|
// implementation of wxListBoxBase methods
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxListBox::DoSetFirstItem(
|
void wxListBox::DoSetFirstItem(int N)
|
||||||
int N
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_nNumItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::SetFirstItem") );
|
wxT("invalid index in wxListBox::SetFirstItem") );
|
||||||
|
|
||||||
::WinSendMsg(GetHwnd(), LM_SETTOPINDEX, MPFROMLONG(N), (MPARAM)0);
|
::WinSendMsg(GetHwnd(), LM_SETTOPINDEX, MPFROMLONG(N), (MPARAM)0);
|
||||||
} // end of wxListBox::DoSetFirstItem
|
} // end of wxListBox::DoSetFirstItem
|
||||||
|
|
||||||
void wxListBox::Delete(
|
void wxListBox::Delete(int N)
|
||||||
int N
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_nNumItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::Delete") );
|
wxT("invalid index in wxListBox::Delete") );
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -277,9 +271,7 @@ void wxListBox::Delete(
|
|||||||
m_nNumItems--;
|
m_nNumItems--;
|
||||||
} // end of wxListBox::DoSetFirstItem
|
} // end of wxListBox::DoSetFirstItem
|
||||||
|
|
||||||
int wxListBox::DoAppend(
|
int wxListBox::DoAppend(const wxString& rsItem)
|
||||||
const wxString& rsItem
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
long lIndex = 0;
|
long lIndex = 0;
|
||||||
LONG lIndexType = 0;
|
LONG lIndexType = 0;
|
||||||
@@ -288,6 +280,7 @@ int wxListBox::DoAppend(
|
|||||||
lIndexType = LIT_SORTASCENDING;
|
lIndexType = LIT_SORTASCENDING;
|
||||||
else
|
else
|
||||||
lIndexType = LIT_END;
|
lIndexType = LIT_END;
|
||||||
|
|
||||||
lIndex = (long)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)rsItem.c_str());
|
lIndex = (long)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)rsItem.c_str());
|
||||||
m_nNumItems++;
|
m_nNumItems++;
|
||||||
|
|
||||||
@@ -307,13 +300,10 @@ int wxListBox::DoAppend(
|
|||||||
return (int)lIndex;
|
return (int)lIndex;
|
||||||
} // end of wxListBox::DoAppend
|
} // end of wxListBox::DoAppend
|
||||||
|
|
||||||
void wxListBox::DoSetItems(
|
void wxListBox::DoSetItems( const wxArrayString& raChoices,
|
||||||
const wxArrayString& raChoices
|
void** ppClientData )
|
||||||
, void** ppClientData
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
BOOL bHideAndShow = IsShown();
|
BOOL bHideAndShow = IsShown();
|
||||||
int i;
|
|
||||||
LONG lIndexType = 0;
|
LONG lIndexType = 0;
|
||||||
|
|
||||||
if (bHideAndShow)
|
if (bHideAndShow)
|
||||||
@@ -322,9 +312,8 @@ void wxListBox::DoSetItems(
|
|||||||
}
|
}
|
||||||
::WinSendMsg(GetHwnd(), LM_DELETEALL, (MPARAM)0, (MPARAM)0);
|
::WinSendMsg(GetHwnd(), LM_DELETEALL, (MPARAM)0, (MPARAM)0);
|
||||||
m_nNumItems = raChoices.GetCount();
|
m_nNumItems = raChoices.GetCount();
|
||||||
for (i = 0; i < m_nNumItems; i++)
|
for (size_t i = 0; i < m_nNumItems; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_windowStyle & wxLB_SORT)
|
if (m_windowStyle & wxLB_SORT)
|
||||||
lIndexType = LIT_SORTASCENDING;
|
lIndexType = LIT_SORTASCENDING;
|
||||||
else
|
else
|
||||||
@@ -353,7 +342,7 @@ void wxListBox::DoSetItems(
|
|||||||
//
|
//
|
||||||
// Then create new ones
|
// Then create new ones
|
||||||
//
|
//
|
||||||
for (size_t ui = 0; ui < (size_t)m_nNumItems; ui++)
|
for (size_t ui = 0; ui < m_nNumItems; ui++)
|
||||||
{
|
{
|
||||||
wxOwnerDrawn* pNewItem = CreateItem(ui);
|
wxOwnerDrawn* pNewItem = CreateItem(ui);
|
||||||
|
|
||||||
@@ -391,12 +380,9 @@ void wxListBox::Clear()
|
|||||||
m_nNumItems = 0;
|
m_nNumItems = 0;
|
||||||
} // end of wxListBox::Clear
|
} // end of wxListBox::Clear
|
||||||
|
|
||||||
void wxListBox::DoSetSelection(
|
void wxListBox::DoSetSelection( int N, bool bSelect)
|
||||||
int N
|
|
||||||
, bool bSelect
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_nNumItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::SetSelection") );
|
wxT("invalid index in wxListBox::SetSelection") );
|
||||||
::WinSendMsg( GetHwnd()
|
::WinSendMsg( GetHwnd()
|
||||||
,LM_SELECTITEM
|
,LM_SELECTITEM
|
||||||
@@ -407,11 +393,9 @@ void wxListBox::DoSetSelection(
|
|||||||
Refresh();
|
Refresh();
|
||||||
} // end of wxListBox::SetSelection
|
} // end of wxListBox::SetSelection
|
||||||
|
|
||||||
bool wxListBox::IsSelected(
|
bool wxListBox::IsSelected( int N ) const
|
||||||
int N
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( N >= 0 && N < m_nNumItems, false,
|
wxCHECK_MSG( IsValid(N), false,
|
||||||
wxT("invalid index in wxListBox::Selected") );
|
wxT("invalid index in wxListBox::Selected") );
|
||||||
|
|
||||||
LONG lItem;
|
LONG lItem;
|
||||||
@@ -430,39 +414,27 @@ bool wxListBox::IsSelected(
|
|||||||
return (lItem == (LONG)N && lItem != LIT_NONE);
|
return (lItem == (LONG)N && lItem != LIT_NONE);
|
||||||
} // end of wxListBox::IsSelected
|
} // end of wxListBox::IsSelected
|
||||||
|
|
||||||
wxClientData* wxListBox::DoGetItemClientObject(
|
wxClientData* wxListBox::DoGetItemClientObject(int n) const
|
||||||
int n
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
return (wxClientData *)DoGetItemClientData(n);
|
return (wxClientData *)DoGetItemClientData(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* wxListBox::DoGetItemClientData(
|
void* wxListBox::DoGetItemClientData(int n) const
|
||||||
int n
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && n < m_nNumItems, NULL,
|
wxCHECK_MSG( IsValid(n), NULL,
|
||||||
wxT("invalid index in wxListBox::GetClientData") );
|
wxT("invalid index in wxListBox::GetClientData") );
|
||||||
|
|
||||||
return((void *)::WinSendMsg(GetHwnd(), LM_QUERYITEMHANDLE, MPFROMLONG(n), (MPARAM)0));
|
return((void *)::WinSendMsg(GetHwnd(), LM_QUERYITEMHANDLE, MPFROMLONG(n), (MPARAM)0));
|
||||||
} // end of wxListBox::DoGetItemClientData
|
} // end of wxListBox::DoGetItemClientData
|
||||||
|
|
||||||
void wxListBox::DoSetItemClientObject(
|
void wxListBox::DoSetItemClientObject(int n, wxClientData* pClientData)
|
||||||
int n
|
|
||||||
, wxClientData* pClientData
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
DoSetItemClientData( n
|
DoSetItemClientData(n, pClientData);
|
||||||
,pClientData
|
|
||||||
);
|
|
||||||
} // end of wxListBox::DoSetItemClientObject
|
} // end of wxListBox::DoSetItemClientObject
|
||||||
|
|
||||||
void wxListBox::DoSetItemClientData(
|
void wxListBox::DoSetItemClientData(int n, void* pClientData)
|
||||||
int n
|
|
||||||
, void* pClientData
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < m_nNumItems,
|
wxCHECK_RET( IsValid(n),
|
||||||
wxT("invalid index in wxListBox::SetClientData") );
|
wxT("invalid index in wxListBox::SetClientData") );
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -561,15 +533,13 @@ int wxListBox::GetSelection() const
|
|||||||
));
|
));
|
||||||
} // end of wxListBox::GetSelection
|
} // end of wxListBox::GetSelection
|
||||||
|
|
||||||
wxString wxListBox::GetString(
|
wxString wxListBox::GetString( int N ) const
|
||||||
int N
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
LONG lLen = 0;
|
LONG lLen = 0;
|
||||||
wxChar* zBuf;
|
wxChar* zBuf;
|
||||||
wxString sResult;
|
wxString sResult;
|
||||||
|
|
||||||
wxCHECK_MSG( N >= 0 && N < m_nNumItems, wxEmptyString,
|
wxCHECK_MSG( IsValid(N), wxEmptyString,
|
||||||
wxT("invalid index in wxListBox::GetClientData") );
|
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));
|
||||||
@@ -581,23 +551,20 @@ wxString wxListBox::GetString(
|
|||||||
return sResult;
|
return sResult;
|
||||||
} // end of wxListBox::GetString
|
} // end of wxListBox::GetString
|
||||||
|
|
||||||
void wxListBox::DoInsertItems(
|
void wxListBox::DoInsertItems( const wxArrayString& asItems,
|
||||||
const wxArrayString& asItems
|
int nPos )
|
||||||
, int nPos
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( nPos >= 0 && nPos <= m_nNumItems,
|
wxCHECK_RET( IsValidInsert(nPos),
|
||||||
wxT("invalid index in wxListBox::InsertItems") );
|
wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
int nItems = asItems.GetCount();
|
size_t nItems = asItems.GetCount();
|
||||||
|
|
||||||
for (int i = 0; i < nItems; i++)
|
for (size_t i = 0; i < nItems; i++)
|
||||||
{
|
{
|
||||||
int nIndex = (int)::WinSendMsg( GetHwnd()
|
int nIndex = (int)::WinSendMsg( GetHwnd(),
|
||||||
,LM_INSERTITEM
|
LM_INSERTITEM,
|
||||||
,MPFROMLONG((LONG)(i + nPos))
|
MPFROMLONG((LONG)(i + nPos)),
|
||||||
,(MPARAM)asItems[i].c_str()
|
(MPARAM)asItems[i].c_str() );
|
||||||
);
|
|
||||||
|
|
||||||
wxOwnerDrawn* pNewItem = CreateItem(nIndex);
|
wxOwnerDrawn* pNewItem = CreateItem(nIndex);
|
||||||
|
|
||||||
@@ -613,12 +580,9 @@ void wxListBox::DoInsertItems(
|
|||||||
}
|
}
|
||||||
} // end of wxListBox::DoInsertItems
|
} // end of wxListBox::DoInsertItems
|
||||||
|
|
||||||
void wxListBox::SetString(
|
void wxListBox::SetString(int N, const wxString& rsString)
|
||||||
int N
|
|
||||||
, const wxString& rsString
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_nNumItems,
|
wxCHECK_RET( IsValid(N),
|
||||||
wxT("invalid index in wxListBox::SetString") );
|
wxT("invalid index in wxListBox::SetString") );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -680,7 +644,7 @@ void wxListBox::SetString(
|
|||||||
#endif //USE_OWNER_DRAWN
|
#endif //USE_OWNER_DRAWN
|
||||||
} // end of wxListBox::SetString
|
} // end of wxListBox::SetString
|
||||||
|
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_nNumItems;
|
return m_nNumItems;
|
||||||
}
|
}
|
||||||
@@ -700,14 +664,11 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
int nCy;
|
int nCy;
|
||||||
wxFont vFont = (wxFont)GetFont();
|
wxFont vFont = (wxFont)GetFont();
|
||||||
|
|
||||||
for (int i = 0; i < m_nNumItems; i++)
|
for (size_t i = 0; i < m_nNumItems; i++)
|
||||||
{
|
{
|
||||||
wxString vStr(GetString(i));
|
wxString vStr(GetString(i));
|
||||||
|
|
||||||
GetTextExtent( vStr
|
GetTextExtent( vStr, &nLine, NULL );
|
||||||
,&nLine
|
|
||||||
,NULL
|
|
||||||
);
|
|
||||||
if (nLine > nListbox)
|
if (nLine > nListbox)
|
||||||
nListbox = nLine;
|
nListbox = nLine;
|
||||||
}
|
}
|
||||||
@@ -800,9 +761,7 @@ bool wxListBox::OS2Command(
|
|||||||
//
|
//
|
||||||
#define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1)
|
#define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1)
|
||||||
|
|
||||||
long wxListBox::OS2OnMeasure(
|
long wxListBox::OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem)
|
||||||
WXMEASUREITEMSTRUCT* pItem
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
pItem = (WXMEASUREITEMSTRUCT*)new OWNERITEM;
|
pItem = (WXMEASUREITEMSTRUCT*)new OWNERITEM;
|
||||||
@@ -944,4 +903,4 @@ bool wxListBox::OS2OnDraw (
|
|||||||
|
|
||||||
#endif // ndef for wxUSE_OWNER_DRAWN
|
#endif // ndef for wxUSE_OWNER_DRAWN
|
||||||
|
|
||||||
#endif // ndef for wxUSE_LISTBOX
|
#endif // wxUSE_LISTBOX
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_RADIOBOX
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "wx/wxchar.h"
|
#include "wx/wxchar.h"
|
||||||
@@ -79,7 +81,7 @@ wxRadioBox::~wxRadioBox()
|
|||||||
wxRemoveHandleAssociation(this);
|
wxRemoveHandleAssociation(this);
|
||||||
if (m_ahRadioButtons)
|
if (m_ahRadioButtons)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_nNoItems; i++)
|
for (size_t i = 0; i < m_nNoItems; i++)
|
||||||
{
|
{
|
||||||
wxWindow* pWin = wxFindWinFromHandle((WXHWND)m_ahRadioButtons[i]);
|
wxWindow* pWin = wxFindWinFromHandle((WXHWND)m_ahRadioButtons[i]);
|
||||||
wxRemoveHandleAssociation(pWin);
|
wxRemoveHandleAssociation(pWin);
|
||||||
@@ -94,17 +96,13 @@ wxRadioBox::~wxRadioBox()
|
|||||||
delete[] m_pnRadioHeight;
|
delete[] m_pnRadioHeight;
|
||||||
} // end of wxRadioBox::~wxRadioBox
|
} // end of wxRadioBox::~wxRadioBox
|
||||||
|
|
||||||
void wxRadioBox::Command (
|
void wxRadioBox::Command ( wxCommandEvent& rEvent )
|
||||||
wxCommandEvent& rEvent
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
SetSelection (rEvent.GetInt());
|
SetSelection (rEvent.GetInt());
|
||||||
ProcessCommand(rEvent);
|
ProcessCommand(rEvent);
|
||||||
} // end of wxRadioBox::Command
|
} // end of wxRadioBox::Command
|
||||||
|
|
||||||
bool wxRadioBox::ContainsHWND(
|
bool wxRadioBox::ContainsHWND( WXHWND hWnd ) const
|
||||||
WXHWND hWnd
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
size_t nCount = GetCount();
|
size_t nCount = GetCount();
|
||||||
size_t i;
|
size_t i;
|
||||||
@@ -117,18 +115,16 @@ bool wxRadioBox::ContainsHWND(
|
|||||||
return false;
|
return false;
|
||||||
} // end of wxRadioBox::ContainsHWND
|
} // end of wxRadioBox::ContainsHWND
|
||||||
|
|
||||||
bool wxRadioBox::Create(
|
bool wxRadioBox::Create( wxWindow* pParent,
|
||||||
wxWindow* pParent
|
wxWindowID vId,
|
||||||
, wxWindowID vId
|
const wxString& rsTitle,
|
||||||
, const wxString& rsTitle
|
const wxPoint& rPos,
|
||||||
, const wxPoint& rPos
|
const wxSize& rSize,
|
||||||
, const wxSize& rSize
|
const wxArrayString& asChoices,
|
||||||
, const wxArrayString& asChoices
|
int nMajorDim,
|
||||||
, int nMajorDim
|
long lStyle,
|
||||||
, long lStyle
|
const wxValidator& rVal,
|
||||||
, const wxValidator& rVal
|
const wxString& rsName )
|
||||||
, const wxString& rsName
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxCArrayString chs(asChoices);
|
wxCArrayString chs(asChoices);
|
||||||
|
|
||||||
@@ -136,19 +132,17 @@ bool wxRadioBox::Create(
|
|||||||
chs.GetStrings(), nMajorDim, lStyle, rVal, rsName);
|
chs.GetStrings(), nMajorDim, lStyle, rVal, rsName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRadioBox::Create(
|
bool wxRadioBox::Create( wxWindow* pParent,
|
||||||
wxWindow* pParent
|
wxWindowID vId,
|
||||||
, wxWindowID vId
|
const wxString& rsTitle,
|
||||||
, const wxString& rsTitle
|
const wxPoint& rPos,
|
||||||
, const wxPoint& rPos
|
const wxSize& rSize,
|
||||||
, const wxSize& rSize
|
int nNum,
|
||||||
, int nNum
|
const wxString asChoices[],
|
||||||
, const wxString asChoices[]
|
int nMajorDim,
|
||||||
, int nMajorDim
|
long lStyle,
|
||||||
, long lStyle
|
const wxValidator& rVal,
|
||||||
, const wxValidator& rVal
|
const wxString& rsName )
|
||||||
, const wxString& rsName
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxColour vColour;
|
wxColour vColour;
|
||||||
LONG lColor;
|
LONG lColor;
|
||||||
@@ -184,7 +178,7 @@ bool wxRadioBox::Create(
|
|||||||
//
|
//
|
||||||
// Now we can set m_nNoItems and let SetMajorDim set m_numCols/m_numRows
|
// Now we can set m_nNoItems and let SetMajorDim set m_numCols/m_numRows
|
||||||
//
|
//
|
||||||
m_nNoItems = nNum;
|
m_nNoItems = (size_t)nNum;
|
||||||
SetMajorDim(nMajorDim == 0 ? nNum : nMajorDim, lStyle);
|
SetMajorDim(nMajorDim == 0 ? nNum : nMajorDim, lStyle);
|
||||||
|
|
||||||
m_ahRadioButtons = new WXHWND[nNum];
|
m_ahRadioButtons = new WXHWND[nNum];
|
||||||
@@ -412,7 +406,7 @@ void wxRadioBox::DoSetSize(
|
|||||||
nStartX = nXOffset;
|
nStartX = nXOffset;
|
||||||
nStartY = nYOffset;
|
nStartY = nYOffset;
|
||||||
|
|
||||||
for (int i = 0; i < m_nNoItems; i++)
|
for (size_t i = 0; i < m_nNoItems; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// The last button in the row may be wider than the other ones as the
|
// The last button in the row may be wider than the other ones as the
|
||||||
@@ -525,18 +519,16 @@ bool wxRadioBox::Enable(int nItem, bool bEnable)
|
|||||||
return true;
|
return true;
|
||||||
} // end of wxRadioBox::Enable
|
} // end of wxRadioBox::Enable
|
||||||
|
|
||||||
bool wxRadioBox::Enable(
|
bool wxRadioBox::Enable(bool bEnable)
|
||||||
bool bEnable
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if ( !wxControl::Enable(bEnable) )
|
if ( !wxControl::Enable(bEnable) )
|
||||||
return false;
|
return false;
|
||||||
for (int i = 0; i < m_nNoItems; i++)
|
for (size_t i = 0; i < m_nNoItems; i++)
|
||||||
::WinEnableWindow((HWND)m_ahRadioButtons[i], bEnable);
|
::WinEnableWindow((HWND)m_ahRadioButtons[i], bEnable);
|
||||||
return true;
|
return true;
|
||||||
} // end of wxRadioBox::Enable
|
} // end of wxRadioBox::Enable
|
||||||
|
|
||||||
int wxRadioBox::GetCount() const
|
size_t wxRadioBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_nNoItems;
|
return m_nNoItems;
|
||||||
} // end of wxRadioBox::GetCount
|
} // end of wxRadioBox::GetCount
|
||||||
@@ -553,7 +545,7 @@ wxSize wxRadioBox::GetMaxButtonSize() const
|
|||||||
int nWidthMax = 0;
|
int nWidthMax = 0;
|
||||||
int nHeightMax = 0;
|
int nHeightMax = 0;
|
||||||
|
|
||||||
for (int i = 0 ; i < m_nNoItems; i++)
|
for (size_t i = 0 ; i < m_nNoItems; i++)
|
||||||
{
|
{
|
||||||
int nWidth;
|
int nWidth;
|
||||||
int nHeight;
|
int nHeight;
|
||||||
@@ -603,14 +595,10 @@ void wxRadioBox::GetSize( int* pnWidth, int* pnHeight ) const
|
|||||||
vRect.yBottom = -1;
|
vRect.yBottom = -1;
|
||||||
|
|
||||||
if (m_hWnd)
|
if (m_hWnd)
|
||||||
wxFindMaxSize( m_hWnd
|
wxFindMaxSize( m_hWnd, &vRect );
|
||||||
,&vRect
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int i = 0; i < m_nNoItems; i++)
|
for (size_t i = 0; i < m_nNoItems; i++)
|
||||||
wxFindMaxSize( m_ahRadioButtons[i]
|
wxFindMaxSize( m_ahRadioButtons[i], &vRect );
|
||||||
,&vRect
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pnWidth)
|
if (pnWidth)
|
||||||
*pnWidth = vRect.xRight - vRect.xLeft;
|
*pnWidth = vRect.xRight - vRect.xLeft;
|
||||||
@@ -701,7 +689,7 @@ bool wxRadioBox::OS2Command( WXUINT uCmd,
|
|||||||
if (wId == GetId())
|
if (wId == GetId())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int i = 0; i < m_nNoItems; i++)
|
for (size_t i = 0; i < m_nNoItems; i++)
|
||||||
{
|
{
|
||||||
if (wId == wxGetWindowId(m_ahRadioButtons[i]))
|
if (wId == wxGetWindowId(m_ahRadioButtons[i]))
|
||||||
{
|
{
|
||||||
@@ -750,9 +738,7 @@ void wxRadioBox::SetFocus()
|
|||||||
}
|
}
|
||||||
} // end of wxRadioBox::SetFocus
|
} // end of wxRadioBox::SetFocus
|
||||||
|
|
||||||
bool wxRadioBox::SetFont(
|
bool wxRadioBox::SetFont(const wxFont& rFont)
|
||||||
const wxFont& rFont
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!wxControl::SetFont(rFont))
|
if (!wxControl::SetFont(rFont))
|
||||||
{
|
{
|
||||||
@@ -764,13 +750,11 @@ bool wxRadioBox::SetFont(
|
|||||||
//
|
//
|
||||||
// Also set the font of our radio buttons
|
// Also set the font of our radio buttons
|
||||||
//
|
//
|
||||||
for (int n = 0; n < (int)m_nNoItems; n++)
|
for (size_t n = 0; n < m_nNoItems; n++)
|
||||||
{
|
{
|
||||||
HWND hWndBtn = (HWND)m_ahRadioButtons[n];
|
HWND hWndBtn = (HWND)m_ahRadioButtons[n];
|
||||||
|
|
||||||
wxOS2SetFont( hWndBtn
|
wxOS2SetFont( hWndBtn, rFont );
|
||||||
,rFont
|
|
||||||
);
|
|
||||||
::WinInvalidateRect(hWndBtn, NULL, FALSE);
|
::WinInvalidateRect(hWndBtn, NULL, FALSE);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -814,14 +798,12 @@ bool wxRadioBox::SetStringSelection(const wxString& rsStr)
|
|||||||
return false;
|
return false;
|
||||||
} // end of wxRadioBox::SetStringSelection
|
} // end of wxRadioBox::SetStringSelection
|
||||||
|
|
||||||
bool wxRadioBox::Show(
|
bool wxRadioBox::Show(bool bShow)
|
||||||
bool bShow
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!wxControl::Show(bShow))
|
if (!wxControl::Show(bShow))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int i = 0; i < m_nNoItems; i++)
|
for (size_t i = 0; i < m_nNoItems; i++)
|
||||||
{
|
{
|
||||||
::WinShowWindow((HWND)m_ahRadioButtons[i], (BOOL)bShow);
|
::WinShowWindow((HWND)m_ahRadioButtons[i], (BOOL)bShow);
|
||||||
}
|
}
|
||||||
@@ -959,3 +941,5 @@ MRESULT EXPENTRY wxRadioBoxWndProc( HWND hWnd,
|
|||||||
(MPARAM)lParam )
|
(MPARAM)lParam )
|
||||||
);
|
);
|
||||||
} // end of wxRadioBoxWndProc
|
} // end of wxRadioBoxWndProc
|
||||||
|
|
||||||
|
#endif // wxUSE_RADIOBOX
|
||||||
|
@@ -188,7 +188,7 @@ void wxChoice::SetSelection(int n)
|
|||||||
// string list functions
|
// string list functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
size_t wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -110,7 +110,7 @@ public:
|
|||||||
wxListBoxItem(const wxString& str = wxEmptyString);
|
wxListBoxItem(const wxString& str = wxEmptyString);
|
||||||
};
|
};
|
||||||
|
|
||||||
wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE)
|
wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, false)
|
||||||
{
|
{
|
||||||
// no bitmaps/checkmarks
|
// no bitmaps/checkmarks
|
||||||
SetMarginWidth(0);
|
SetMarginWidth(0);
|
||||||
@@ -254,9 +254,9 @@ void wxListBox::SetString(int N, const wxString& s)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::GetCount() const
|
size_t wxListBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_noItems;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -112,7 +112,7 @@ void wxRadioBox::Init()
|
|||||||
m_size = wxSize(0,0);
|
m_size = wxSize(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxRadioBox::GetCount() const
|
size_t wxRadioBox::GetCount() const
|
||||||
{
|
{
|
||||||
return m_radios.GetCount();
|
return m_radios.GetCount();
|
||||||
}
|
}
|
||||||
@@ -238,12 +238,12 @@ void wxRadioBox::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
|
|
||||||
const bool use_cols = HasFlag(wxRA_SPECIFY_COLS);
|
const bool use_cols = HasFlag(wxRA_SPECIFY_COLS);
|
||||||
|
|
||||||
const int n = GetCount();
|
const size_t n = GetCount();
|
||||||
int minor = n / GetMajorDim();
|
size_t minor = n / GetMajorDim();
|
||||||
if(n % GetMajorDim() > 0)
|
if(n % GetMajorDim() > 0)
|
||||||
minor++;
|
minor++;
|
||||||
|
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for ( int j = 0; j < minor; j++ )
|
for ( int j = 0; j < minor; j++ )
|
||||||
{
|
{
|
||||||
for ( int k = 0; k < GetMajorDim(); k++ )
|
for ( int k = 0; k < GetMajorDim(); k++ )
|
||||||
@@ -327,8 +327,8 @@ void wxRadioBox::SetFocus()
|
|||||||
// Enable all subcontrols
|
// Enable all subcontrols
|
||||||
bool wxRadioBox::Enable(bool enable)
|
bool wxRadioBox::Enable(bool enable)
|
||||||
{
|
{
|
||||||
for(int i=0; i<GetCount(); i++)
|
for(size_t i=0; i<GetCount(); i++)
|
||||||
Enable(i, enable);
|
Enable((int)i, enable);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,8 +343,8 @@ bool wxRadioBox::Enable(int item, bool enable)
|
|||||||
|
|
||||||
bool wxRadioBox::Show(bool show)
|
bool wxRadioBox::Show(bool show)
|
||||||
{
|
{
|
||||||
for(int i=0; i<GetCount(); i++)
|
for(size_t i=0; i<GetCount(); i++)
|
||||||
Show(i, show);
|
Show((int)i, show);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -540,7 +540,7 @@ bool wxComboListBox::SetSelection(const wxString& value)
|
|||||||
// always matches), but we want to show the first one in such case
|
// always matches), but we want to show the first one in such case
|
||||||
if ( value.empty() )
|
if ( value.empty() )
|
||||||
{
|
{
|
||||||
if ( GetCount() )
|
if ( GetCount() > 0 )
|
||||||
{
|
{
|
||||||
wxListBox::SetSelection(0);
|
wxListBox::SetSelection(0);
|
||||||
}
|
}
|
||||||
@@ -798,7 +798,7 @@ void wxComboBox::Clear()
|
|||||||
|
|
||||||
void wxComboBox::Delete(int n)
|
void wxComboBox::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( (n >= 0) && (n < GetCount()), _T("invalid index in wxComboBox::Delete") );
|
wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::Delete") );
|
||||||
|
|
||||||
if (GetSelection() == n)
|
if (GetSelection() == n)
|
||||||
GetText()->SetValue(wxEmptyString);
|
GetText()->SetValue(wxEmptyString);
|
||||||
@@ -806,21 +806,21 @@ void wxComboBox::Delete(int n)
|
|||||||
GetLBox()->Delete(n);
|
GetLBox()->Delete(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxComboBox::GetCount() const
|
size_t wxComboBox::GetCount() const
|
||||||
{
|
{
|
||||||
return GetLBox()->GetCount();
|
return GetLBox()->GetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxComboBox::GetString(int n) const
|
wxString wxComboBox::GetString(int n) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( (n >= 0) && (n < GetCount()), wxEmptyString, _T("invalid index in wxComboBox::GetString") );
|
wxCHECK_MSG( IsValid(n), wxEmptyString, _T("invalid index in wxComboBox::GetString") );
|
||||||
|
|
||||||
return GetLBox()->GetString(n);
|
return GetLBox()->GetString(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboBox::SetString(int n, const wxString& s)
|
void wxComboBox::SetString(int n, const wxString& s)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( (n >= 0) && (n < GetCount()), _T("invalid index in wxComboBox::SetString") );
|
wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::SetString") );
|
||||||
|
|
||||||
GetLBox()->SetString(n, s);
|
GetLBox()->SetString(n, s);
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ int wxComboBox::FindString(const wxString& s, bool bCase) const
|
|||||||
|
|
||||||
void wxComboBox::SetSelection(int n)
|
void wxComboBox::SetSelection(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( (n >= 0) && (n < GetCount()), _T("invalid index in wxComboBox::Select") );
|
wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::Select") );
|
||||||
|
|
||||||
GetLBox()->SetSelection(n);
|
GetLBox()->SetSelection(n);
|
||||||
GetText()->SetValue(GetLBox()->GetString(n));
|
GetText()->SetValue(GetLBox()->GetString(n));
|
||||||
@@ -859,9 +859,9 @@ int wxComboBox::DoAppend(const wxString& item)
|
|||||||
int wxComboBox::DoInsert(const wxString& item, int pos)
|
int wxComboBox::DoInsert(const wxString& item, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
|
||||||
wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
|
wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
|
||||||
|
|
||||||
if (pos == GetCount())
|
if ((size_t)pos == GetCount())
|
||||||
return DoAppend(item);
|
return DoAppend(item);
|
||||||
|
|
||||||
GetLBox()->Insert(item, pos);
|
GetLBox()->Insert(item, pos);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: univ/listbox.cpp
|
// Name: src/univ/listbox.cpp
|
||||||
// Purpose: wxListBox implementation
|
// Purpose: wxListBox implementation
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -327,7 +327,7 @@ void wxListBox::Clear()
|
|||||||
|
|
||||||
void wxListBox::Delete(int n)
|
void wxListBox::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n >= 0 && n < GetCount(),
|
wxCHECK_RET( IsValid(n),
|
||||||
_T("invalid index in wxListBox::Delete") );
|
_T("invalid index in wxListBox::Delete") );
|
||||||
|
|
||||||
// do it before removing the index as otherwise the last item will not be
|
// do it before removing the index as otherwise the last item will not be
|
||||||
@@ -574,7 +574,7 @@ void wxListBox::UpdateScrollbars()
|
|||||||
wxSize size = GetClientSize();
|
wxSize size = GetClientSize();
|
||||||
|
|
||||||
// is our height enough to show all items?
|
// is our height enough to show all items?
|
||||||
int nLines = GetCount();
|
size_t nLines = GetCount();
|
||||||
wxCoord lineHeight = GetLineHeight();
|
wxCoord lineHeight = GetLineHeight();
|
||||||
bool showScrollbarY = nLines*lineHeight > size.y;
|
bool showScrollbarY = nLines*lineHeight > size.y;
|
||||||
|
|
||||||
@@ -913,8 +913,8 @@ void wxListBox::SetCurrentItem(int n)
|
|||||||
|
|
||||||
bool wxListBox::FindItem(const wxString& prefix, bool strictlyAfter)
|
bool wxListBox::FindItem(const wxString& prefix, bool strictlyAfter)
|
||||||
{
|
{
|
||||||
int count = GetCount();
|
size_t count = GetCount();
|
||||||
if ( !count )
|
if ( count==0 )
|
||||||
{
|
{
|
||||||
// empty listbox, we can't find anything in it
|
// empty listbox, we can't find anything in it
|
||||||
return false;
|
return false;
|
||||||
@@ -937,13 +937,13 @@ bool wxListBox::FindItem(const wxString& prefix, bool strictlyAfter)
|
|||||||
int last = first == 0 ? count - 1 : first - 1;
|
int last = first == 0 ? count - 1 : first - 1;
|
||||||
|
|
||||||
// if this is not true we'd never exit from the loop below!
|
// if this is not true we'd never exit from the loop below!
|
||||||
wxASSERT_MSG( first < count && last < count, _T("logic error") );
|
wxASSERT_MSG( first < (int)count && last < (int)count, _T("logic error") );
|
||||||
|
|
||||||
// precompute it outside the loop
|
// precompute it outside the loop
|
||||||
size_t len = prefix.length();
|
size_t len = prefix.length();
|
||||||
|
|
||||||
// loop over all items in the listbox
|
// loop over all items in the listbox
|
||||||
for ( int item = first; item != last; item < count - 1 ? item++ : item = 0 )
|
for ( int item = first; item != (int)last; item < count - 1 ? item++ : item = 0 )
|
||||||
{
|
{
|
||||||
if ( wxStrnicmp(this->GetString(item).c_str(), prefix, len) == 0 )
|
if ( wxStrnicmp(this->GetString(item).c_str(), prefix, len) == 0 )
|
||||||
{
|
{
|
||||||
@@ -1055,8 +1055,8 @@ void wxListBox::ExtendSelection(int itemTo)
|
|||||||
SetSelection(n);
|
SetSelection(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = GetCount();
|
size_t count = GetCount();
|
||||||
for ( ; n < count; n++ )
|
for ( ; n < (int)count; n++ )
|
||||||
{
|
{
|
||||||
Deselect(n);
|
Deselect(n);
|
||||||
}
|
}
|
||||||
@@ -1230,7 +1230,7 @@ int wxStdListboxInputHandler::FixItemIndex(const wxListBox *lbox,
|
|||||||
// mouse is above the first item
|
// mouse is above the first item
|
||||||
item = 0;
|
item = 0;
|
||||||
}
|
}
|
||||||
else if ( item >= lbox->GetCount() )
|
else if ( (size_t)item >= lbox->GetCount() )
|
||||||
{
|
{
|
||||||
// mouse is below the last item
|
// mouse is below the last item
|
||||||
item = lbox->GetCount() - 1;
|
item = lbox->GetCount() - 1;
|
||||||
@@ -1241,7 +1241,7 @@ int wxStdListboxInputHandler::FixItemIndex(const wxListBox *lbox,
|
|||||||
|
|
||||||
bool wxStdListboxInputHandler::IsValidIndex(const wxListBox *lbox, int item)
|
bool wxStdListboxInputHandler::IsValidIndex(const wxListBox *lbox, int item)
|
||||||
{
|
{
|
||||||
return item >= 0 && item < lbox->GetCount();
|
return item >= 0 && (size_t)item < lbox->GetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxControlAction
|
wxControlAction
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: univ/radiobox.cpp
|
// Name: src/univ/radiobox.cpp
|
||||||
// Purpose: wxRadioBox implementation
|
// Purpose: wxRadioBox implementation
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -335,7 +335,7 @@ bool wxRadioBox::Enable(bool enable)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// also enable/disable the buttons
|
// also enable/disable the buttons
|
||||||
size_t count = m_buttons.GetCount();
|
const size_t count = m_buttons.GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
Enable(n, enable);
|
Enable(n, enable);
|
||||||
@@ -350,7 +350,7 @@ bool wxRadioBox::Show(bool show)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// also show/hide the buttons
|
// also show/hide the buttons
|
||||||
size_t count = m_buttons.GetCount();
|
const size_t count = m_buttons.GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
Show(n, show);
|
Show(n, show);
|
||||||
@@ -375,7 +375,7 @@ void wxRadioBox::DoSetToolTip(wxToolTip *tooltip)
|
|||||||
wxControl::DoSetToolTip(tooltip);
|
wxControl::DoSetToolTip(tooltip);
|
||||||
|
|
||||||
// Also set them for all Radio Buttons
|
// Also set them for all Radio Buttons
|
||||||
size_t count = m_buttons.GetCount();
|
const size_t count = m_buttons.GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
if (tooltip)
|
if (tooltip)
|
||||||
@@ -395,7 +395,7 @@ wxSize wxRadioBox::GetMaxButtonSize() const
|
|||||||
int widthMax, heightMax, width = 0, height = 0;
|
int widthMax, heightMax, width = 0, height = 0;
|
||||||
widthMax = heightMax = 0;
|
widthMax = heightMax = 0;
|
||||||
|
|
||||||
int count = GetCount();
|
const int count = GetCount();
|
||||||
for ( int n = 0; n < count; n++ )
|
for ( int n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
m_buttons[n]->GetBestSize(&width, &height);
|
m_buttons[n]->GetBestSize(&width, &height);
|
||||||
@@ -442,8 +442,8 @@ void wxRadioBox::DoMoveWindow(int x0, int y0, int width, int height)
|
|||||||
int x = x0,
|
int x = x0,
|
||||||
y = y0;
|
y = y0;
|
||||||
|
|
||||||
int count = GetCount();
|
const size_t count = GetCount();
|
||||||
for ( int n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
m_buttons[n]->SetSize(x, y, sizeBtn.x, sizeBtn.y);
|
m_buttons[n]->SetSize(x, y, sizeBtn.x, sizeBtn.y);
|
||||||
|
|
||||||
@@ -523,4 +523,3 @@ bool wxRadioBox::OnKeyDown(wxKeyEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_RADIOBOX
|
#endif // wxUSE_RADIOBOX
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user