1. now clip wxPaintDC in its ctor

2. added wxCheckListBox


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8345 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-09-12 17:30:09 +00:00
parent 6e6616f755
commit 0ddd59282b
15 changed files with 342 additions and 65 deletions

View File

@@ -1,21 +1,52 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/checklst.h
// Purpose: wxCheckListBox class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 12.09.00
// RCS-ID: $Id$
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHECKLST_H_BASE_
#define _WX_CHECKLST_H_BASE_
#if defined(__WXMSW__)
#include "wx/msw/checklst.h"
#if wxUSE_CHECKLISTBOX
#include "wx/listbox.h"
// ----------------------------------------------------------------------------
// wxCheckListBox: a listbox whose items may be checked
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxCheckListBoxBase : public wxListBox
{
public:
// check list box specific methods
virtual bool IsChecked(size_t item) const = 0;
virtual void Check(size_t item, bool check = TRUE) = 0;
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/checklst.h"
#elif defined(__WXMSW__)
#include "wx/msw/checklst.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/checklst.h"
#include "wx/motif/checklst.h"
#elif defined(__WXGTK__)
#include "wx/gtk/checklst.h"
#include "wx/gtk/checklst.h"
#elif defined(__WXQT__)
#include "wx/qt/checklst.h"
#include "wx/qt/checklst.h"
#elif defined(__WXMAC__)
#include "wx/mac/checklst.h"
#include "wx/mac/checklst.h"
#elif defined(__WXPM__)
#include "wx/os2/checklst.h"
#include "wx/os2/checklst.h"
#elif defined(__WXSTUBS__)
#include "wx/stubs/checklst.h"
#include "wx/stubs/checklst.h"
#endif
#endif // wxUSE_CHECKLISTBOX
#endif
// _WX_CHECKLST_H_BASE_

View File

@@ -57,6 +57,17 @@
# endif
#endif /* controls */
#if wxUSE_CHECKLISTBOX
# if !wxUSE_LISTBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxCheckListBox requires wxListBox"
# else
# undef wxUSE_LISTBOX
# define wxUSE_LISTBOX 1
# endif
# endif
#endif /* wxUSE_RADIOBTN */
#if wxUSE_RADIOBTN
# if defined(__WXUNIVERSAL__) && !wxUSE_CHECKBOX
# ifdef wxABORT_ON_CONFIG_ERROR

View File

@@ -15,21 +15,6 @@
#pragma interface
#endif
#include "wx/defs.h"
#if wxUSE_CHECKLISTBOX
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
#include "wx/listbox.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxCheckListBox;
//-----------------------------------------------------------------------------
// wxCheckListBox
//-----------------------------------------------------------------------------
@@ -56,6 +41,4 @@ private:
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
};
#endif
#endif //__GTKCHECKLISTH__

View File

@@ -15,21 +15,6 @@
#pragma interface
#endif
#include "wx/defs.h"
#if wxUSE_CHECKLISTBOX
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
#include "wx/listbox.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxCheckListBox;
//-----------------------------------------------------------------------------
// wxCheckListBox
//-----------------------------------------------------------------------------
@@ -56,6 +41,4 @@ private:
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
};
#endif
#endif //__GTKCHECKLISTH__

View File

@@ -0,0 +1,74 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/univ/checklst.h
// Purpose: wxCheckListBox class for wxUniversal
// Author: Vadim Zeitlin
// Modified by:
// Created: 12.09.00
// RCS-ID: $Id$
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIV_CHECKLST_H_
#define _WX_UNIV_CHECKLST_H_
#ifdef __GNUG__
#pragma interface "univchecklst.h"
#endif
class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase
{
public:
// ctors
wxCheckListBox() { Init(); }
wxCheckListBox(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString *choices = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr)
{
Init();
Create(parent, id, pos, size, nStrings, choices, style, validator, name);
}
// no Create(): the base class does everything
// implement check list box methods
virtual bool IsChecked(size_t item) const;
virtual void Check(size_t item, bool check = TRUE);
// override all methods which add/delete items to update m_checks array as
// well
virtual void Delete(int n);
protected:
virtual int DoAppend(const wxString& item);
virtual void DoInsertItems(const wxArrayString& items, int pos);
virtual void DoSetItems(const wxArrayString& items, void **clientData);
virtual void DoClear();
// draw the check items instead of the usual ones
virtual void DoDrawRange(wxControlRenderer *renderer,
int itemFirst, int itemLast);
// take them also into account for size calculation
virtual wxSize DoGetBestClientSize() const;
// common part of all ctors
void Init();
private:
// the array containing the checked status of the items
wxArrayInt m_checks;
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
};
#endif // _WX_UNIV_CHECKLST_H_

View File

@@ -115,7 +115,8 @@ public:
virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL );
// the wxUniversal-specific additions
// the wxUniversal-specific methods
// --------------------------------
// the current item is the same as the selected one for wxLB_SINGLE
// listboxes but for the other ones it is just the focused item which may
@@ -178,7 +179,7 @@ protected:
void OnSize(wxSizeEvent& event);
// common part of Clear() and DoSetItems(): clears everything
void DoClear();
virtual void DoClear();
// refresh the given item(s) or everything
void RefreshItems(int from, int count);
@@ -195,6 +196,10 @@ protected:
bool HasHorzScrollbar() const
{ return (m_windowStyle & wxLB_HSCROLL) != 0; }
// redraw the items in the given range only: called from DoDraw()
virtual void DoDrawRange(wxControlRenderer *renderer,
int itemFirst, int itemLast);
// the array containing all items (it is sorted if the listbox has
// wxLB_SORT style)
wxArrayString m_strings;

View File

@@ -29,6 +29,7 @@
#define _WX_UNIV_RENDERER_H_
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxCheckListBox;
class WXDLLEXPORT wxListBox;
class WXDLLEXPORT wxScrollBar;
class WXDLLEXPORT wxWindow;
@@ -397,6 +398,8 @@ public:
wxCoord marginX = 0, wxCoord marginY = 0);
void DrawItems(const wxListBox *listbox,
size_t itemFirst, size_t itemLast);
void DrawCheckItems(const wxCheckListBox *listbox,
size_t itemFirst, size_t itemLast);
void DrawBorder();
void DrawButtonBorder();
// the line must be either horizontal or vertical
@@ -420,6 +423,11 @@ public:
wxRect& GetRect() { return m_rect; }
private:
// common part of DrawItems() and DrawCheckItems()
void DoDrawItems(const wxListBox *listbox,
size_t itemFirst, size_t itemLast,
bool isCheckLbox = FALSE);
wxWindow *m_window;
wxRenderer *m_renderer;
wxDC& m_dc;