File: dlg_connect.cpp

package info (click to toggle)
clanlib 1.0~svn3827-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 24,600 kB
  • sloc: cpp: 101,591; xml: 6,410; makefile: 1,743; ansic: 463; perl: 424; php: 247; sh: 53
file content (87 lines) | stat: -rw-r--r-- 2,638 bytes parent folder | download | duplicates (7)
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

#include "precomp.h"
#include "dlg_connect.h"
#include "mainframe.h"

/////////////////////////////////////////////////////////////////////////////
// DlgConnect construction:

DlgConnect::DlgConnect(MainFrame *mainframe) :
	CL_Window(mainframe), mainframe(mainframe), components(0)
{
	set_position(CL_Rect(CL_Point(mainframe->get_width()/2-200, mainframe->get_height()/2-150), CL_Size(400, 300)));
	set_title("Connect to IRC Server");

	components = new CL_ComponentManager("Dialogs/connect", get_style_manager()->get_resources(), get_client_area());
	components->get_component("label_title", &label_title);
	components->get_component("label_server", &label_server);
	components->get_component("label_fullname", &label_fullname);
	components->get_component("label_username", &label_username);
	components->get_component("label_password", &label_password);
	components->get_component("inputbox_server", &inputbox_server);
	components->get_component("inputbox_fullname", &inputbox_fullname);
	components->get_component("inputbox_username", &inputbox_username);
	components->get_component("inputbox_password", &inputbox_password);
	components->get_component("button_ok", &button_ok);
	components->get_component("button_cancel", &button_cancel);

	inputbox_server->set_focus(); // bug in gui, should not be needed.

	inputbox_server->set_text("irc.freenode.net");
	inputbox_fullname->set_text("Anonymous CTalk User");
	inputbox_username->set_text("CTalk");	
	inputbox_password->set_text("");

	slots.connect(button_ok->sig_clicked(), this, &DlgConnect::on_button_ok_clicked);
	slots.connect(button_cancel->sig_clicked(), this, &DlgConnect::on_button_cancel_clicked);
}

DlgConnect::~DlgConnect()
{
	delete components;
}

/////////////////////////////////////////////////////////////////////////////
// DlgConnect attributes:

const std::string &DlgConnect::get_server()
{
	return inputbox_server->get_text();
}

const std::string &DlgConnect::get_nick()
{
	return inputbox_username->get_text();
}

const std::string &DlgConnect::get_username()
{
	return inputbox_username->get_text();
}

const std::string &DlgConnect::get_fullname()
{
	return inputbox_fullname->get_text();
}

const std::string &DlgConnect::get_password()
{
	return inputbox_password->get_text();
}

/////////////////////////////////////////////////////////////////////////////
// DlgConnect operations:


/////////////////////////////////////////////////////////////////////////////
// DlgConnect implementation:

void DlgConnect::on_button_ok_clicked()
{
	quit();
}

void DlgConnect::on_button_cancel_clicked()
{
	quit(); // todo: let quit() take an int as exit code.
}