67 lines
1.3 KiB
C++
67 lines
1.3 KiB
C++
/* -----------------------------------------------------------------------------
|
|
GSFramework
|
|
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
|
----------------------------------------------------------------------------- */
|
|
|
|
|
|
#ifndef __NUIWIDGETCHECK__
|
|
#define __NUIWIDGETCHECK__
|
|
|
|
|
|
#include "ui/widget_bitmap.h"
|
|
#include "ui/widget_text.h"
|
|
|
|
|
|
namespace GS {
|
|
namespace S2D {
|
|
|
|
/*!
|
|
@short Check widget.
|
|
@author Emmanuel Julien (ejulien@nworks.fr)
|
|
*/
|
|
class CheckWidget : public Widget
|
|
{
|
|
protected:
|
|
|
|
BitmapWidget check_bitmap;
|
|
TextWidget label;
|
|
|
|
bool state;
|
|
int marging;
|
|
|
|
public:
|
|
|
|
TextWidget &GetLabel() { return label; }
|
|
|
|
int GetMarging() const { return marging; }
|
|
void SetMarging(int m)
|
|
{
|
|
if (marging == m)
|
|
return;
|
|
Widget::Invalidate();
|
|
marging = m;
|
|
}
|
|
|
|
bool GetState() const { return state; }
|
|
void SetState(bool state);
|
|
|
|
virtual void Refresh();
|
|
virtual void Compose(Picture &, const iRect &out_rect);
|
|
virtual void Invalidate();
|
|
|
|
CheckWidget(int id = -1, const char *label = 0, FontEx *font = 0, int size = 16, bool b_state = true) :
|
|
Widget(id), check_bitmap(-1, 0), label(-1, label, font, size)
|
|
{
|
|
type = WidgetTypeCheck;
|
|
|
|
marging = 4;
|
|
SetState(b_state);
|
|
}
|
|
};
|
|
|
|
} // S2D
|
|
} // GS
|
|
|
|
|
|
#endif // __NUIWIDGETCHECK__
|