File: Checkbox.cpp

package info (click to toggle)
bullet 3.06%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 15,012 kB
  • sloc: cpp: 243,705; lisp: 12,017; ansic: 11,175; python: 626; makefile: 133; sh: 75
file content (42 lines) | stat: -rw-r--r-- 1,253 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "UnitTest.h"
#include "Gwen/Controls/CheckBox.h"

using namespace Gwen;

class Checkbox : public GUnit
{
public:
	GWEN_CONTROL_INLINE(Checkbox, GUnit)
	{
		Gwen::Controls::CheckBox* check = new Gwen::Controls::CheckBox(this);
		check->SetPos(10, 10);
		check->onChecked.Add(this, &Checkbox::OnChecked);
		check->onUnChecked.Add(this, &Checkbox::OnUnchecked);
		check->onCheckChanged.Add(this, &Checkbox::OnCheckChanged);

		Gwen::Controls::CheckBoxWithLabel* labeled = new Gwen::Controls::CheckBoxWithLabel(this);
		labeled->SetPos(10, 10);
		labeled->Label()->SetText("Labeled CheckBox");
		labeled->Checkbox()->onChecked.Add(this, &Checkbox::OnChecked);
		labeled->Checkbox()->onUnChecked.Add(this, &Checkbox::OnUnchecked);
		labeled->Checkbox()->onCheckChanged.Add(this, &Checkbox::OnCheckChanged);
		Gwen::Align::PlaceBelow(labeled, check, 10);
	}

	void OnChecked(Controls::Base* pControl)
	{
		UnitPrint(L"Checkbox Checked (using 'OnChecked' event)");
	}

	void OnUnchecked(Controls::Base* pControl)
	{
		UnitPrint(L"Checkbox Unchecked (using 'OnUnchecked' event)");
	}

	void OnCheckChanged(Controls::Base* pControl)
	{
		UnitPrint(L"Checkbox CheckChanged (using 'OnCheckChanged' event)");
	}
};

DEFINE_UNIT_TEST(Checkbox, L"Checkbox");