File: messagebox.cpp

package info (click to toggle)
clanlib 0.5.4-1-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,320 kB
  • ctags: 10,893
  • sloc: cpp: 76,056; xml: 3,281; sh: 2,961; perl: 1,204; asm: 837; makefile: 775
file content (113 lines) | stat: -rw-r--r-- 2,690 bytes parent folder | download
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
	$Id: messagebox.cpp,v 1.11 2002/01/16 19:16:51 sphair Exp $
	
	ClanGUI, copyrights by various people. Have a look in the CREDITS file.
	
	This sourcecode is distributed using the Library GNU Public Licence,
	version 2 or (at your option) any later version. Please read LICENSE
	for details.
*/

#include "precomp.h"
#include <string>
#include "../API/GUI/messagebox.h"
#include "../API/GUI/component_options.h"
#include "../API/GUI/stylemanager.h"
#include "../API/GUI/gui_manager.h"
#include "messagebox_generic.h"

/////////////////////////////////////////////////////////////////////////////
// Construction:

CL_MessageBox::CL_MessageBox(CL_Component *parent, CL_StyleManager *style)
: CL_Window(parent, style), impl(0)
{
	impl = new CL_MessageBox_Generic(this, "", "", "", "", "");
}

CL_MessageBox::CL_MessageBox(
	const std::string &title,
	const std::string &text,
	const std::string &button1,
	const std::string &button2,
	const std::string &button3,
	CL_Component *parent,
	CL_StyleManager *style)
: CL_Window(parent, style), impl(0)
{
	impl = new CL_MessageBox_Generic(this, title, text, button1, button2, button3);
}

CL_MessageBox::~CL_MessageBox()
{
	delete impl;
}

void CL_MessageBox::info(
	const std::string &text,
	CL_Component *parent)
{
	CL_MessageBox message("Information", text, "Ok", "", "", NULL, parent->get_style_manager());
	message.run(parent);
}

void CL_MessageBox::info(
	const std::string &title,
	const std::string &text,
	CL_Component *parent)
{
	CL_MessageBox message(title, text, "Ok", "", "", NULL, parent->get_style_manager());
	message.run(parent);
}

int CL_MessageBox::info(
	const std::string &title,
	const std::string &text,
	const std::string &button1,
	const std::string &button2,
	const std::string &button3,
	CL_Component *parent)
{
	CL_MessageBox message(title, text, button1, button2, button3, NULL, parent->get_style_manager());
	message.run(parent);
	return message.get_result_button();
}

/////////////////////////////////////////////////////////////////////////////
// Attributes:

const std::string &CL_MessageBox::get_text() const
{
	return impl->text;
}

int CL_MessageBox::get_result_button() const
{
	return impl->result_button;
}

/////////////////////////////////////////////////////////////////////////////
// Operations:

void CL_MessageBox::set_text(const std::string &text)
{
	impl->text = text;
}

/////////////////////////////////////////////////////////////////////////////
// Signals:

CL_Signal_v0 &CL_MessageBox::sig_button1()
{
	return impl->sig_button[0];
}

CL_Signal_v0 &CL_MessageBox::sig_button2()
{
	return impl->sig_button[1];
}

CL_Signal_v0 &CL_MessageBox::sig_button3()
{
	return impl->sig_button[2];
}