File: combobox.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 (127 lines) | stat: -rw-r--r-- 2,559 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
	$Id: combobox.cpp,v 1.28 2001/12/27 22:45:46 mbn 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/combobox.h"
#include "API/GUI/component_options.h"
#include "API/GUI/stylemanager.h"
#include "combobox_generic.h"

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

CL_ComboBox::CL_ComboBox(CL_Component *parent, CL_StyleManager *style)
: CL_Component(parent, style), impl(0)
{
	impl = new CL_ComboBox_Generic(this);
	get_style_manager()->connect_styles("combobox", this);
}

CL_ComboBox::CL_ComboBox(
	const CL_Rect &pos,
	CL_Component *parent,
	CL_StyleManager *style)
: CL_Component(pos, parent, style), impl(NULL)
{
	impl = new CL_ComboBox_Generic(this);
	get_style_manager()->connect_styles("combobox", this);
}

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

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

int CL_ComboBox::get_count() const
{
	return impl->get_count();
}

std::list<std::string> &CL_ComboBox::get_items() const
{
	return impl->get_items();
}

std::string CL_ComboBox::get_current_text() const
{
	return impl->get_current_text();
}

std::string CL_ComboBox::get_text(int index) const
{
	return impl->get_text(index);
}

int CL_ComboBox::get_current_item() const
{
	return impl->get_current_item();
}

bool CL_ComboBox::is_selected(int index) const
{
	return impl->is_selected(index);
}

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

int CL_ComboBox::insert_item(const std::string &text, int index)
{
	return impl->insert_item(text, index);
}

void CL_ComboBox::remove_item(int index)
{
	impl->remove_item(index);
}

void CL_ComboBox::change_item(const std::string &text, int index)
{
	impl->change_item(text, index);
}

void CL_ComboBox::set_current_item(int index)
{
	impl->set_current_item(index);
}

void CL_ComboBox::clear_selection()
{
	impl->clear_selection();
}

void CL_ComboBox::sort(bool ascending)
{
	impl->sort(ascending);
}

void CL_ComboBox::clear()
{
	impl->clear();
}

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

CL_Signal_v1<int> &CL_ComboBox::sig_highlighted()
{
	return impl->sig_highlighted;
}

CL_Signal_v1<int> &CL_ComboBox::sig_activated()
{
	return impl->sig_activated;
}