1. wxListCtrl fixes

a) implemented GetColumnCount()
 b) columns are always created with some reasonable (i.e. != 0) width

2. wxRadioBox: keyboard navigation now works inside it (almost) as it should


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1821 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-02-27 23:52:48 +00:00
parent 212d0bb3c7
commit e373f51b6c
4 changed files with 311 additions and 470 deletions

View File

@@ -171,7 +171,7 @@ public:
int m_format; // left, right, centre
int m_width; // width of column
wxListItem(void);
wxListItem();
};
// type of compare function for wxListCtrl sort operation
@@ -185,7 +185,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
* Public interface
*/
wxListCtrl(void);
wxListCtrl();
inline wxListCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
@@ -193,7 +193,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
{
Create(parent, id, pos, size, style, validator, name);
}
~wxListCtrl(void);
~wxListCtrl();
bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxListCtrl");
@@ -222,10 +222,10 @@ class WXDLLEXPORT wxListCtrl: public wxControl
// visible area of the list control (list or report view)
// or the total number of items in the list control (icon
// or small icon view)
int GetCountPerPage(void) const;
int GetCountPerPage() const;
// Gets the edit control for editing labels.
wxTextCtrl* GetEditControl(void) const;
wxTextCtrl* GetEditControl() const;
// Gets information about the item
bool GetItem(wxListItem& info) const ;
@@ -267,10 +267,10 @@ class WXDLLEXPORT wxListCtrl: public wxControl
bool SetItemPosition(long item, const wxPoint& pos) ;
// Gets the number of items in the list control
int GetItemCount(void) const;
int GetItemCount() const;
// Gets the number of columns in the list control
int GetColumnCount(void) const;
int GetColumnCount() const { return m_colCount; }
// Retrieves the spacing between icons in pixels.
// If small is TRUE, gets the spacing for the small icon
@@ -278,17 +278,17 @@ class WXDLLEXPORT wxListCtrl: public wxControl
int GetItemSpacing(bool isSmall) const;
// Gets the number of selected items in the list control
int GetSelectedItemCount(void) const;
int GetSelectedItemCount() const;
// Gets the text colour of the listview
wxColour GetTextColour(void) const;
wxColour GetTextColour() const;
// Sets the text colour of the listview
void SetTextColour(const wxColour& col);
// Gets the index of the topmost visible item when in
// list or report view
long GetTopItem(void) const ;
long GetTopItem() const ;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = TRUE) ;
@@ -330,16 +330,16 @@ class WXDLLEXPORT wxListCtrl: public wxControl
bool DeleteItem(long item);
// Deletes all items
bool DeleteAllItems(void) ;
bool DeleteAllItems() ;
// Deletes a column
bool DeleteColumn(int col);
// Deletes all columns
bool DeleteAllColumns(void);
bool DeleteAllColumns();
// Clears items, and columns if there are any.
void ClearAll(void);
void ClearAll();
// Edit the label
wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl));
@@ -422,7 +422,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
// Recreate window - seems to be necessary when changing a style.
void RecreateWindow(void);
void RecreateWindow();
// Add to pool: necessary because Windows needs to have a string
// still exist across 3 callbacks.

View File

@@ -21,7 +21,7 @@
WXDLLEXPORT_DATA(extern const char*) wxRadioBoxNameStr;
// List box item
class WXDLLEXPORT wxBitmap ;
class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxRadioBox : public wxControl
{
@@ -35,18 +35,6 @@ public:
int x = -1, int y = -1, int width = -1, int height = -1,
int n = 0, char **choices = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr);
/*
inline wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
int x, int y, int width, int height,
int n, wxBitmap **choices,
int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr)
{
Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), n, (const wxBitmap **)choices, majorDim, style,
wxDefaultValidator, name);
Callback(func);
}
*/
#endif // WXWIN_COMPATIBILITY
wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
@@ -58,17 +46,6 @@ public:
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
}
/*
wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxBitmap *choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
{
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
}
*/
~wxRadioBox();
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
@@ -77,17 +54,9 @@ public:
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
/*
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxBitmap *choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
*/
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
int FindString(const wxString& s) const;
void SetSelection(int N);
@@ -99,20 +68,20 @@ public:
wxString GetLabel() const;
void SetLabel(const wxString& label);
void SetLabel(int item, const wxString& label) ;
void SetLabel(int item, wxBitmap *bitmap) ;
void SetLabel(int item, const wxString& label);
void SetLabel(int item, wxBitmap *bitmap);
wxString GetLabel(int item) const;
bool Show(bool show);
void SetFocus();
void Enable(bool enable);
void Enable(int item, bool enable);
void Show(int item, bool show) ;
void Show(int item, bool show);
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
void SetButtonFont(const wxFont& font) { SetFont(font); }
virtual wxString GetStringSelection() const;
virtual bool SetStringSelection(const wxString& s);
virtual int Number() const { return m_noItems; } ;
virtual int Number() const { return m_noItems; };
void Command(wxCommandEvent& event);
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
@@ -120,15 +89,21 @@ public:
// Implementation
WXHWND *GetRadioButtons() const { return m_radioButtons; }
bool ContainsHWND(WXHWND hWnd) const ;
bool ContainsHWND(WXHWND hWnd) const;
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
// get the number of buttons per column/row
inline int GetNumVer() const;
inline int GetNumHor() const;
protected:
void SubclassRadioButton(WXHWND hWndBtn);
WXHWND * m_radioButtons;
int m_majorDim ;
int * m_radioWidth ; // for bitmaps
int * m_radioHeight ;
int m_majorDim;
int * m_radioWidth; // for bitmaps
int * m_radioHeight;
int m_noItems;
int m_noRowsOrCols;