Skip to content

Instantly share code, notes, and snippets.

@drautb
Last active December 17, 2015 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drautb/5606423 to your computer and use it in GitHub Desktop.
Save drautb/5606423 to your computer and use it in GitHub Desktop.
C++: wxWidgets Checkbox Without Label
/**
* TAKEN FROM: http://olecam.online.fr/wxNoLabelCheckBox/
*/
/////////////////////////////////////////////////////////////////////////////
// Name: wxNoLabelCheckBox.h
// Purpose:
// Author: Olivier Le Cam
// Modified by: Ben Draut, changed to inherit from wxPanel (Jul 2013)
// Created: 25/03/2008 19:01:21
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _WXNOLABELCHECKBOX_H_
#define _WXNOLABELCHECKBOX_H_
#include "wx/imaglist.h"
class wxNoLabelCheckBox : public wxPanel
{
DECLARE_DYNAMIC_CLASS(wxNoLabelCheckBox)
DECLARE_EVENT_TABLE()
public:
wxNoLabelCheckBox();
wxNoLabelCheckBox(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& name = wxCheckBoxNameStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0);
~wxNoLabelCheckBox();
void OnClicked(wxMouseEvent& event);
void OnKeyUp(wxKeyEvent& event);
void OnPaint(wxPaintEvent& event);
virtual void SetValue(bool value);
virtual bool GetValue() const;
virtual bool IsChecked() const;
private:
bool m_state;
wxImageList* m_pImageList;
void switchCheck();
};
#endif
@drautb
Copy link
Author

drautb commented Jul 17, 2013

I changed this component to inherit from wxPanel. The benefit here is that now this component will be part of the tab order of an application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment