wxCheckListBox works
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -16,6 +16,16 @@
|
|||||||
#pragma interface "univchecklst.h"
|
#pragma interface "univchecklst.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// actions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define wxACTION_CHECKLISTBOX_TOGGLE _T("toggle")
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxCheckListBox
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase
|
class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -43,6 +53,11 @@ public:
|
|||||||
virtual bool IsChecked(size_t item) const;
|
virtual bool IsChecked(size_t item) const;
|
||||||
virtual void Check(size_t item, bool check = TRUE);
|
virtual void Check(size_t item, bool check = TRUE);
|
||||||
|
|
||||||
|
// and input handling
|
||||||
|
virtual bool PerformAction(const wxControlAction& action,
|
||||||
|
long numArg = -1l,
|
||||||
|
const wxString& strArg = wxEmptyString);
|
||||||
|
|
||||||
// override all methods which add/delete items to update m_checks array as
|
// override all methods which add/delete items to update m_checks array as
|
||||||
// well
|
// well
|
||||||
virtual void Delete(int n);
|
virtual void Delete(int n);
|
||||||
@@ -60,6 +75,9 @@ protected:
|
|||||||
// take them also into account for size calculation
|
// take them also into account for size calculation
|
||||||
virtual wxSize DoGetBestClientSize() const;
|
virtual wxSize DoGetBestClientSize() const;
|
||||||
|
|
||||||
|
// our input handler
|
||||||
|
virtual wxString GetInputHandlerType() const;
|
||||||
|
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "wx/univ/renderer.h" // for wxHitTest
|
#include "wx/univ/renderer.h" // for wxHitTest
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxCheckListBox;
|
||||||
class WXDLLEXPORT wxListBox;
|
class WXDLLEXPORT wxListBox;
|
||||||
class WXDLLEXPORT wxRenderer;
|
class WXDLLEXPORT wxRenderer;
|
||||||
class WXDLLEXPORT wxScrollBar;
|
class WXDLLEXPORT wxScrollBar;
|
||||||
@@ -33,6 +34,7 @@ class WXDLLEXPORT wxScrollBar;
|
|||||||
#define wxINP_HANDLER_DEFAULT _T("")
|
#define wxINP_HANDLER_DEFAULT _T("")
|
||||||
#define wxINP_HANDLER_BUTTON _T("button")
|
#define wxINP_HANDLER_BUTTON _T("button")
|
||||||
#define wxINP_HANDLER_CHECKBOX _T("checkbox")
|
#define wxINP_HANDLER_CHECKBOX _T("checkbox")
|
||||||
|
#define wxINP_HANDLER_CHECKLISTBOX _T("checklistbox")
|
||||||
#define wxINP_HANDLER_RADIOBTN _T("radiobtn")
|
#define wxINP_HANDLER_RADIOBTN _T("radiobtn")
|
||||||
#define wxINP_HANDLER_SCROLLBAR _T("scrollbar")
|
#define wxINP_HANDLER_SCROLLBAR _T("scrollbar")
|
||||||
#define wxINP_HANDLER_LISTBOX _T("listbox")
|
#define wxINP_HANDLER_LISTBOX _T("listbox")
|
||||||
@@ -261,4 +263,20 @@ public:
|
|||||||
const wxMouseEvent& event);
|
const wxMouseEvent& event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxStdCheckListBoxHandler
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxStdCheckListboxInputHandler(wxInputHandler *inphand);
|
||||||
|
|
||||||
|
virtual bool HandleKey(wxControl *control,
|
||||||
|
const wxKeyEvent& event,
|
||||||
|
bool pressed);
|
||||||
|
virtual bool HandleMouse(wxControl *control,
|
||||||
|
const wxMouseEvent& event);
|
||||||
|
};
|
||||||
|
|
||||||
#endif // _WX_UNIV_INPHAND_H_
|
#endif // _WX_UNIV_INPHAND_H_
|
||||||
|
@@ -149,12 +149,19 @@ public:
|
|||||||
virtual void DrawScrollCorner(wxDC& dc,
|
virtual void DrawScrollCorner(wxDC& dc,
|
||||||
const wxRect& rect) = 0;
|
const wxRect& rect) = 0;
|
||||||
|
|
||||||
// draw an item of a wxControlWithItems
|
// draw an item of a wxListBox
|
||||||
virtual void DrawItem(wxDC& dc,
|
virtual void DrawItem(wxDC& dc,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0) = 0;
|
int flags = 0) = 0;
|
||||||
|
|
||||||
|
// draw an item of a wxCheckListBox
|
||||||
|
virtual void DrawCheckItem(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0) = 0;
|
||||||
|
|
||||||
// draw a checkbutton (bitmap may be invalid to use default one)
|
// draw a checkbutton (bitmap may be invalid to use default one)
|
||||||
virtual void DrawCheckButton(wxDC& dc,
|
virtual void DrawCheckButton(wxDC& dc,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
@@ -330,6 +337,12 @@ public:
|
|||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0)
|
int flags = 0)
|
||||||
{ m_renderer->DrawItem(dc, label, rect, flags); }
|
{ m_renderer->DrawItem(dc, label, rect, flags); }
|
||||||
|
virtual void DrawCheckItem(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0)
|
||||||
|
{ m_renderer->DrawCheckItem(dc, label, bitmap, rect, flags); }
|
||||||
virtual void DrawCheckButton(wxDC& dc,
|
virtual void DrawCheckButton(wxDC& dc,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxBitmap& bitmap,
|
const wxBitmap& bitmap,
|
||||||
|
@@ -70,13 +70,13 @@
|
|||||||
#define wxUSE_BMPBUTTON 1
|
#define wxUSE_BMPBUTTON 1
|
||||||
#define wxUSE_CARET 0
|
#define wxUSE_CARET 0
|
||||||
#define wxUSE_CHECKBOX 1
|
#define wxUSE_CHECKBOX 1
|
||||||
#define wxUSE_CHECKLISTBOX 0
|
#define wxUSE_CHECKLISTBOX 1
|
||||||
#define wxUSE_CHOICE 0
|
#define wxUSE_CHOICE 0
|
||||||
#define wxUSE_COMBOBOX 0
|
#define wxUSE_COMBOBOX 0
|
||||||
#define wxUSE_GAUGE 0
|
#define wxUSE_GAUGE 0
|
||||||
#define wxUSE_LISTBOX 1
|
#define wxUSE_LISTBOX 1
|
||||||
#define wxUSE_LISTCTRL 0
|
#define wxUSE_LISTCTRL 0
|
||||||
#define wxUSE_RADIOBOX 0
|
#define wxUSE_RADIOBOX 1
|
||||||
#define wxUSE_RADIOBTN 1
|
#define wxUSE_RADIOBTN 1
|
||||||
#define wxUSE_SASH 0
|
#define wxUSE_SASH 0
|
||||||
#define wxUSE_SCROLLBAR 1
|
#define wxUSE_SCROLLBAR 1
|
||||||
|
@@ -146,6 +146,10 @@ public:
|
|||||||
bool UseFgCol() const { return m_hasFgCol; }
|
bool UseFgCol() const { return m_hasFgCol; }
|
||||||
bool UseFont() const { return m_hasFont; }
|
bool UseFont() const { return m_hasFont; }
|
||||||
|
|
||||||
|
// returns the (low level) renderer to use for drawing the control by
|
||||||
|
// querying the current theme
|
||||||
|
wxRenderer *GetRenderer() const { return m_renderer; }
|
||||||
|
|
||||||
// overridden base class methods
|
// overridden base class methods
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
|
|
||||||
@@ -169,10 +173,6 @@ protected:
|
|||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnErase(wxEraseEvent& event);
|
void OnErase(wxEraseEvent& event);
|
||||||
|
|
||||||
// returns the (low level) renderer to use for drawing the control by
|
|
||||||
// querying the current theme
|
|
||||||
wxRenderer *GetRenderer() const { return m_renderer; }
|
|
||||||
|
|
||||||
// draw the control background, return TRUE if done
|
// draw the control background, return TRUE if done
|
||||||
virtual bool DoDrawBackground(wxControlRenderer *renderer);
|
virtual bool DoDrawBackground(wxControlRenderer *renderer);
|
||||||
|
|
||||||
|
@@ -51,6 +51,7 @@
|
|||||||
#include "wx/ctrlsub.h"
|
#include "wx/ctrlsub.h"
|
||||||
#include "wx/bmpbuttn.h"
|
#include "wx/bmpbuttn.h"
|
||||||
#include "wx/checkbox.h"
|
#include "wx/checkbox.h"
|
||||||
|
#include "wx/checklst.h"
|
||||||
#include "wx/choice.h"
|
#include "wx/choice.h"
|
||||||
#include "wx/scrolbar.h"
|
#include "wx/scrolbar.h"
|
||||||
#include "wx/stattext.h"
|
#include "wx/stattext.h"
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
#include "wx/msw/wx.rc"
|
#include "wx/msw/wx.rc"
|
||||||
|
|
||||||
|
/*
|
||||||
bricks BITMAP "bricks.bmp"
|
bricks BITMAP "bricks.bmp"
|
||||||
tip BITMAP "tip.bmp"
|
tip BITMAP "tip.bmp"
|
||||||
open BITMAP "open.bmp"
|
open BITMAP "open.bmp"
|
||||||
|
*/
|
||||||
|
@@ -72,7 +72,9 @@ void wxCheckListBox::Check(size_t item, bool check)
|
|||||||
wxCHECK_RET( item < m_checks.GetCount(),
|
wxCHECK_RET( item < m_checks.GetCount(),
|
||||||
_T("invalid index in wxCheckListBox::Check") );
|
_T("invalid index in wxCheckListBox::Check") );
|
||||||
|
|
||||||
if ( check != m_checks[item] )
|
// intermediate var is needed to avoid compiler warning with VC++
|
||||||
|
bool isChecked = m_checks[item] != 0;
|
||||||
|
if ( check != isChecked )
|
||||||
{
|
{
|
||||||
m_checks[item] = check;
|
m_checks[item] = check;
|
||||||
|
|
||||||
@@ -149,4 +151,85 @@ void wxCheckListBox::DoDrawRange(wxControlRenderer *renderer,
|
|||||||
renderer->DrawCheckItems(this, itemFirst, itemLast);
|
renderer->DrawCheckItems(this, itemFirst, itemLast);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// actions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxString wxCheckListBox::GetInputHandlerType() const
|
||||||
|
{
|
||||||
|
return wxINP_HANDLER_CHECKLISTBOX;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxCheckListBox::PerformAction(const wxControlAction& action,
|
||||||
|
long numArg,
|
||||||
|
const wxString& strArg)
|
||||||
|
{
|
||||||
|
if ( action == wxACTION_CHECKLISTBOX_TOGGLE )
|
||||||
|
{
|
||||||
|
int sel = (int)numArg;
|
||||||
|
if ( sel == -1 )
|
||||||
|
{
|
||||||
|
sel = GetSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( sel != -1 )
|
||||||
|
{
|
||||||
|
Check(sel, !IsChecked(sel));
|
||||||
|
|
||||||
|
SendEvent(sel, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return wxListBox::PerformAction(action, numArg, strArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxStdCheckListboxInputHandler
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxStdCheckListboxInputHandler::
|
||||||
|
wxStdCheckListboxInputHandler(wxInputHandler *inphand)
|
||||||
|
: wxStdListboxInputHandler(inphand)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxStdCheckListboxInputHandler::HandleKey(wxControl *control,
|
||||||
|
const wxKeyEvent& event,
|
||||||
|
bool pressed)
|
||||||
|
{
|
||||||
|
if ( pressed && (event.GetKeyCode() == WXK_SPACE) )
|
||||||
|
control->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE);
|
||||||
|
|
||||||
|
return wxStdListboxInputHandler::HandleKey(control, event, pressed);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxStdCheckListboxInputHandler::HandleMouse(wxControl *control,
|
||||||
|
const wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
if ( event.LeftDown() || event.LeftDClick() )
|
||||||
|
{
|
||||||
|
wxCheckListBox *lbox = wxStaticCast(control, wxCheckListBox);
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
const wxPoint& pt = event.GetPosition();
|
||||||
|
lbox->CalcUnscrolledPosition(pt.x, pt.y, &x, &y);
|
||||||
|
int item = y / lbox->GetLineHeight();
|
||||||
|
if ( x >= 0 &&
|
||||||
|
x < lbox->GetRenderer()->GetCheckBitmapSize().x &&
|
||||||
|
item >= 0 &&
|
||||||
|
item < lbox->GetCount() )
|
||||||
|
{
|
||||||
|
lbox->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE, item);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxStdListboxInputHandler::HandleMouse(control, event);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_CHECKLISTBOX
|
#endif // wxUSE_CHECKLISTBOX
|
||||||
|
@@ -650,10 +650,10 @@ void wxControlRenderer::DoDrawItems(const wxListBox *lbox,
|
|||||||
if ( checklstbox->IsChecked(n) )
|
if ( checklstbox->IsChecked(n) )
|
||||||
flags |= wxCONTROL_CHECKED;
|
flags |= wxCONTROL_CHECKED;
|
||||||
|
|
||||||
m_renderer->DrawCheckButton(m_dc, lbox->GetString(n),
|
m_renderer->DrawCheckItem(m_dc, lbox->GetString(n),
|
||||||
wxNullBitmap,
|
wxNullBitmap,
|
||||||
rect,
|
rect,
|
||||||
flags);
|
flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -109,6 +109,11 @@ public:
|
|||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0);
|
int flags = 0);
|
||||||
|
virtual void DrawCheckItem(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
virtual void DrawCheckButton(wxDC& dc,
|
virtual void DrawCheckButton(wxDC& dc,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxBitmap& bitmap,
|
const wxBitmap& bitmap,
|
||||||
@@ -431,6 +436,8 @@ wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control)
|
|||||||
handler = new wxGTKCheckboxInputHandler(GetDefaultInputHandler());
|
handler = new wxGTKCheckboxInputHandler(GetDefaultInputHandler());
|
||||||
else if ( control == wxINP_HANDLER_LISTBOX )
|
else if ( control == wxINP_HANDLER_LISTBOX )
|
||||||
handler = new wxStdListboxInputHandler(GetDefaultInputHandler());
|
handler = new wxStdListboxInputHandler(GetDefaultInputHandler());
|
||||||
|
else if ( control == wxINP_HANDLER_CHECKLISTBOX )
|
||||||
|
handler = new wxStdCheckListboxInputHandler(GetDefaultInputHandler());
|
||||||
else
|
else
|
||||||
handler = GetDefaultInputHandler();
|
handler = GetDefaultInputHandler();
|
||||||
|
|
||||||
@@ -941,6 +948,15 @@ void wxGTKRenderer::DrawItem(wxDC& dc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxGTKRenderer::DrawCheckItem(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
DrawCheckButton(dc, label, bitmap, rect, flags);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// check/radion buttons
|
// check/radion buttons
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -126,6 +126,11 @@ public:
|
|||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0);
|
int flags = 0);
|
||||||
|
virtual void DrawCheckItem(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
virtual void DrawCheckButton(wxDC& dc,
|
virtual void DrawCheckButton(wxDC& dc,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxBitmap& bitmap,
|
const wxBitmap& bitmap,
|
||||||
@@ -345,6 +350,251 @@ private:
|
|||||||
WX_DECLARE_THEME(win32)
|
WX_DECLARE_THEME(win32)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// standard bitmaps
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static char *checked_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 5 1",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
"ddddddddddddh",
|
||||||
|
"dbbbbbbbbbbgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwbwgh",
|
||||||
|
"dbwwwwwwbbwgh",
|
||||||
|
"dbwbwwwbbbwgh",
|
||||||
|
"dbwbbwbbbwwgh",
|
||||||
|
"dbwbbbbbwwwgh",
|
||||||
|
"dbwwbbbwwwwgh",
|
||||||
|
"dbwwwbwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dgggggggggggh",
|
||||||
|
"hhhhhhhhhhhhh"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *pressed_checked_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 4 1",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
"ddddddddddddh",
|
||||||
|
"dbbbbbbbbbbgh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbgggggggbggh",
|
||||||
|
"dbggggggbbggh",
|
||||||
|
"dbgbgggbbbggh",
|
||||||
|
"dbgbbgbbbgggh",
|
||||||
|
"dbgbbbbbggggh",
|
||||||
|
"dbggbbbgggggh",
|
||||||
|
"dbgggbggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dgggggggggggh",
|
||||||
|
"hhhhhhhhhhhhh"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *checked_item_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 3 1",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #808080",
|
||||||
|
/* pixels */
|
||||||
|
"wwwwwwwwwwwww",
|
||||||
|
"wdddddddddddw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwbwdw",
|
||||||
|
"wdwwwwwwbbwdw",
|
||||||
|
"wdwbwwwbbbwdw",
|
||||||
|
"wdwbbwbbbwwdw",
|
||||||
|
"wdwbbbbbwwwdw",
|
||||||
|
"wdwwbbbwwwwdw",
|
||||||
|
"wdwwwbwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdddddddddddw",
|
||||||
|
"wwwwwwwwwwwww"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *unchecked_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 5 1",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
"ddddddddddddh",
|
||||||
|
"dbbbbbbbbbbgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dgggggggggggh",
|
||||||
|
"hhhhhhhhhhhhh"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *pressed_unchecked_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 4 1",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
"ddddddddddddh",
|
||||||
|
"dbbbbbbbbbbgh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"hhhhhhhhhhhhh"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *unchecked_item_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 2 1",
|
||||||
|
"w c white",
|
||||||
|
"d c #808080",
|
||||||
|
/* pixels */
|
||||||
|
"wwwwwwwwwwwww",
|
||||||
|
"wdddddddddddw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdwwwwwwwwwdw",
|
||||||
|
"wdddddddddddw",
|
||||||
|
"wwwwwwwwwwwww"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *checked_radio_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 6 1",
|
||||||
|
" c None",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
" dddd ",
|
||||||
|
" ddbbbbdd ",
|
||||||
|
" dbbwwwwbbh ",
|
||||||
|
" dbwwwwwwgh ",
|
||||||
|
" dbwwwbbwwwgh",
|
||||||
|
" dbwwbbbbwwgh",
|
||||||
|
" dbwwbbbbwwgh",
|
||||||
|
" dbwwwbbwwwgh",
|
||||||
|
" dbwwwwwwgh ",
|
||||||
|
" dggwwwwggh ",
|
||||||
|
" hhgggghh ",
|
||||||
|
" hhhh ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *pressed_checked_radio_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 6 1",
|
||||||
|
" c None",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
" dddd ",
|
||||||
|
" ddbbbbdd ",
|
||||||
|
" dbbggggbbh ",
|
||||||
|
" dbgggggggh ",
|
||||||
|
" dbgggbbggggh",
|
||||||
|
" dbggbbbbgggh",
|
||||||
|
" dbggbbbbgggh",
|
||||||
|
" dbgggbbggggh",
|
||||||
|
" dbgggggggh ",
|
||||||
|
" dggggggggh ",
|
||||||
|
" hhgggghh ",
|
||||||
|
" hhhh ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *unchecked_radio_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 6 1",
|
||||||
|
" c None",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
" dddd ",
|
||||||
|
" ddbbbbdd ",
|
||||||
|
" dbbwwwwbbh ",
|
||||||
|
" dbwwwwwwgh ",
|
||||||
|
" dbwwwwwwwwgh",
|
||||||
|
" dbwwwwwwwwgh",
|
||||||
|
" dbwwwwwwwwgh",
|
||||||
|
" dbwwwwwwwwgh",
|
||||||
|
" dbwwwwwwgh ",
|
||||||
|
" dggwwwwggh ",
|
||||||
|
" hhgggghh ",
|
||||||
|
" hhhh ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *pressed_unchecked_radio_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 6 1",
|
||||||
|
" c None",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
" dddd ",
|
||||||
|
" ddbbbbdd ",
|
||||||
|
" dbbggggbbh ",
|
||||||
|
" dbgggggggh ",
|
||||||
|
" dbgggggggggh",
|
||||||
|
" dbgggggggggh",
|
||||||
|
" dbgggggggggh",
|
||||||
|
" dbgggggggggh",
|
||||||
|
" dbgggggggh ",
|
||||||
|
" dggggggggh ",
|
||||||
|
" hhgggghh ",
|
||||||
|
" hhhh ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -396,6 +646,8 @@ wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control)
|
|||||||
handler = new wxWin32CheckboxInputHandler(GetDefaultInputHandler());
|
handler = new wxWin32CheckboxInputHandler(GetDefaultInputHandler());
|
||||||
else if ( control == wxINP_HANDLER_LISTBOX )
|
else if ( control == wxINP_HANDLER_LISTBOX )
|
||||||
handler = new wxStdListboxInputHandler(GetDefaultInputHandler());
|
handler = new wxStdListboxInputHandler(GetDefaultInputHandler());
|
||||||
|
else if ( control == wxINP_HANDLER_CHECKLISTBOX )
|
||||||
|
handler = new wxStdCheckListboxInputHandler(GetDefaultInputHandler());
|
||||||
else
|
else
|
||||||
handler = GetDefaultInputHandler();
|
handler = GetDefaultInputHandler();
|
||||||
|
|
||||||
@@ -1131,6 +1383,10 @@ void wxWin32Renderer::DrawButtonLabel(wxDC& dc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// (check)listbox items
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxWin32Renderer::DrawItem(wxDC& dc,
|
void wxWin32Renderer::DrawItem(wxDC& dc,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
@@ -1164,206 +1420,38 @@ void wxWin32Renderer::DrawItem(wxDC& dc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWin32Renderer::DrawCheckItem(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
wxBitmap bmp;
|
||||||
|
if ( bitmap.Ok() )
|
||||||
|
{
|
||||||
|
bmp = bitmap;
|
||||||
|
}
|
||||||
|
else // use default bitmap
|
||||||
|
{
|
||||||
|
bmp = wxBitmap(flags & wxCONTROL_CHECKED ? checked_item_xpm
|
||||||
|
: unchecked_item_xpm);
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.DrawBitmap(bmp, rect.x, rect.y + (rect.height - bmp.GetHeight()) / 2,
|
||||||
|
TRUE /* use mask */);
|
||||||
|
|
||||||
|
wxRect rectLabel = rect;
|
||||||
|
int bmpWidth = bmp.GetWidth();
|
||||||
|
rectLabel.x += bmpWidth;
|
||||||
|
rectLabel.width -= bmpWidth;
|
||||||
|
|
||||||
|
DrawItem(dc, label, rectLabel, flags);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// check/radio buttons
|
// check/radio buttons
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static char *checked_xpm[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 13 5 1",
|
|
||||||
"w c white",
|
|
||||||
"b c black",
|
|
||||||
"d c #7f7f7f",
|
|
||||||
"g c #c0c0c0",
|
|
||||||
"h c #e0e0e0",
|
|
||||||
/* pixels */
|
|
||||||
"ddddddddddddh",
|
|
||||||
"dbbbbbbbbbbgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwbwgh",
|
|
||||||
"dbwwwwwwbbwgh",
|
|
||||||
"dbwbwwwbbbwgh",
|
|
||||||
"dbwbbwbbbwwgh",
|
|
||||||
"dbwbbbbbwwwgh",
|
|
||||||
"dbwwbbbwwwwgh",
|
|
||||||
"dbwwwbwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dgggggggggggh",
|
|
||||||
"hhhhhhhhhhhhh"
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *pressed_checked_xpm[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 13 4 1",
|
|
||||||
"b c black",
|
|
||||||
"d c #7f7f7f",
|
|
||||||
"g c #c0c0c0",
|
|
||||||
"h c #e0e0e0",
|
|
||||||
/* pixels */
|
|
||||||
"ddddddddddddh",
|
|
||||||
"dbbbbbbbbbbgh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbgggggggbggh",
|
|
||||||
"dbggggggbbggh",
|
|
||||||
"dbgbgggbbbggh",
|
|
||||||
"dbgbbgbbbgggh",
|
|
||||||
"dbgbbbbbggggh",
|
|
||||||
"dbggbbbgggggh",
|
|
||||||
"dbgggbggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dgggggggggggh",
|
|
||||||
"hhhhhhhhhhhhh"
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *unchecked_xpm[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 13 5 1",
|
|
||||||
"w c white",
|
|
||||||
"b c black",
|
|
||||||
"d c #7f7f7f",
|
|
||||||
"g c #c0c0c0",
|
|
||||||
"h c #e0e0e0",
|
|
||||||
/* pixels */
|
|
||||||
"ddddddddddddh",
|
|
||||||
"dbbbbbbbbbbgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dbwwwwwwwwwgh",
|
|
||||||
"dgggggggggggh",
|
|
||||||
"hhhhhhhhhhhhh"
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *pressed_unchecked_xpm[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 13 4 1",
|
|
||||||
"b c black",
|
|
||||||
"d c #7f7f7f",
|
|
||||||
"g c #c0c0c0",
|
|
||||||
"h c #e0e0e0",
|
|
||||||
/* pixels */
|
|
||||||
"ddddddddddddh",
|
|
||||||
"dbbbbbbbbbbgh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"dbggggggggggh",
|
|
||||||
"hhhhhhhhhhhhh"
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *checked_radio_xpm[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 13 6 1",
|
|
||||||
" c None",
|
|
||||||
"w c white",
|
|
||||||
"b c black",
|
|
||||||
"d c #7f7f7f",
|
|
||||||
"g c #c0c0c0",
|
|
||||||
"h c #e0e0e0",
|
|
||||||
/* pixels */
|
|
||||||
" dddd ",
|
|
||||||
" ddbbbbdd ",
|
|
||||||
" dbbwwwwbbh ",
|
|
||||||
" dbwwwwwwgh ",
|
|
||||||
" dbwwwbbwwwgh",
|
|
||||||
" dbwwbbbbwwgh",
|
|
||||||
" dbwwbbbbwwgh",
|
|
||||||
" dbwwwbbwwwgh",
|
|
||||||
" dbwwwwwwgh ",
|
|
||||||
" dggwwwwggh ",
|
|
||||||
" hhgggghh ",
|
|
||||||
" hhhh ",
|
|
||||||
" "
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *pressed_checked_radio_xpm[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 13 6 1",
|
|
||||||
" c None",
|
|
||||||
"w c white",
|
|
||||||
"b c black",
|
|
||||||
"d c #7f7f7f",
|
|
||||||
"g c #c0c0c0",
|
|
||||||
"h c #e0e0e0",
|
|
||||||
/* pixels */
|
|
||||||
" dddd ",
|
|
||||||
" ddbbbbdd ",
|
|
||||||
" dbbggggbbh ",
|
|
||||||
" dbgggggggh ",
|
|
||||||
" dbgggbbggggh",
|
|
||||||
" dbggbbbbgggh",
|
|
||||||
" dbggbbbbgggh",
|
|
||||||
" dbgggbbggggh",
|
|
||||||
" dbgggggggh ",
|
|
||||||
" dggggggggh ",
|
|
||||||
" hhgggghh ",
|
|
||||||
" hhhh ",
|
|
||||||
" "
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *unchecked_radio_xpm[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 13 6 1",
|
|
||||||
" c None",
|
|
||||||
"w c white",
|
|
||||||
"b c black",
|
|
||||||
"d c #7f7f7f",
|
|
||||||
"g c #c0c0c0",
|
|
||||||
"h c #e0e0e0",
|
|
||||||
/* pixels */
|
|
||||||
" dddd ",
|
|
||||||
" ddbbbbdd ",
|
|
||||||
" dbbwwwwbbh ",
|
|
||||||
" dbwwwwwwgh ",
|
|
||||||
" dbwwwwwwwwgh",
|
|
||||||
" dbwwwwwwwwgh",
|
|
||||||
" dbwwwwwwwwgh",
|
|
||||||
" dbwwwwwwwwgh",
|
|
||||||
" dbwwwwwwgh ",
|
|
||||||
" dggwwwwggh ",
|
|
||||||
" hhgggghh ",
|
|
||||||
" hhhh ",
|
|
||||||
" "
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *pressed_unchecked_radio_xpm[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 13 6 1",
|
|
||||||
" c None",
|
|
||||||
"w c white",
|
|
||||||
"b c black",
|
|
||||||
"d c #7f7f7f",
|
|
||||||
"g c #c0c0c0",
|
|
||||||
"h c #e0e0e0",
|
|
||||||
/* pixels */
|
|
||||||
" dddd ",
|
|
||||||
" ddbbbbdd ",
|
|
||||||
" dbbggggbbh ",
|
|
||||||
" dbgggggggh ",
|
|
||||||
" dbgggggggggh",
|
|
||||||
" dbgggggggggh",
|
|
||||||
" dbgggggggggh",
|
|
||||||
" dbgggggggggh",
|
|
||||||
" dbgggggggh ",
|
|
||||||
" dggggggggh ",
|
|
||||||
" hhgggghh ",
|
|
||||||
" hhhh ",
|
|
||||||
" "
|
|
||||||
};
|
|
||||||
|
|
||||||
wxBitmap wxWin32Renderer::GetCheckBitmap(int flags)
|
wxBitmap wxWin32Renderer::GetCheckBitmap(int flags)
|
||||||
{
|
{
|
||||||
char **xpm;
|
char **xpm;
|
||||||
|
Reference in New Issue
Block a user