File: menudata_generic.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 (135 lines) | stat: -rw-r--r-- 3,174 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
128
129
130
131
132
133
134
135
/*
	$Id: menudata_generic.cpp,v 1.4 2001/09/08 19:12:51 japj 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 "menudata_generic.h"
#include "API/Core/System/error.h"
#include "API/GUI/menudata.h"
#include "API/GUI/component_options.h"
#include "API/GUI/stylemanager.h"

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

CL_ComponentOptions CL_MenuData_Generic::create_options(
	const CL_Rect &pos)
{
	CL_ComponentOptions options;

	options.add_option("x", pos.x1);
	options.add_option("y", pos.y1);
	options.add_option("width", pos.get_width());
	options.add_option("height", pos.get_height());

	return options;
}

CL_MenuData_Generic::CL_MenuData_Generic(CL_MenuData *self, const CL_ComponentOptions &options, CL_StyleManager *style)
:
	menudata(self)
{
//	real_parent = NULL;
}

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

unsigned int CL_MenuData_Generic::get_count() const
{
	return menudata->get_children().size();
}

const std::string &CL_MenuData_Generic::get_text(int id) const
{
	throw CL_Error("get_text() not implemented");
}

bool CL_MenuData_Generic::is_item_enabled(int id) const
{
	throw CL_Error("is_item_enabled() not implemented");
}

bool CL_MenuData_Generic::is_item_checked(int id) const
{
	throw CL_Error("is_item_checked() not implemented");
}

int CL_MenuData_Generic::get_index(int id) const
{
	throw CL_Error("get_index() not implemented");
}

int CL_MenuData_Generic::get_id(int index) const
{
	throw CL_Error("get_id() not implemented");
}

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

int CL_MenuData_Generic::insert_item(const std::string &text, int id, int index)
{
	int new_id = generate_id(id);
//	items.push_back(new CL_MenuItem(text, new_id));
	return new_id;
}

int CL_MenuData_Generic::insert_separator(int id, int index)
{
	int new_id = generate_id(id);
//	items.push_back(new CL_MenuItem(new_id));
	return new_id;
}

void CL_MenuData_Generic::remove_item(int id)
{
	throw CL_Error("remove_item() not implemented");
}

void CL_MenuData_Generic::remove_item_at(int index)
{
	throw CL_Error("remove_item_at() not implemented");
}

void CL_MenuData_Generic::clear()
{
	throw CL_Error("clear() not implemented");
}

void CL_MenuData_Generic::change_item(const std::string &text, int id)
{
	throw CL_Error("change_item() not implemented");
}

void CL_MenuData_Generic::enable_item(int id, bool enable)
{
	throw CL_Error("enable_item() not implemented");
}

void CL_MenuData_Generic::check_item(int id, bool check)
{
	throw CL_Error("check_item() not implemented");
}

void CL_MenuData_Generic::set_id(int index, int id)
{
	throw CL_Error("set_id() not implemented");
}

/////////////////////////////////////////////////////////////////////////////
// Implementation:

int CL_MenuData_Generic::generate_id(int id)
{
	if(id != -1)
		return get_count();
	else 
		return id;
}