File: PanelDynamic.cpp

package info (click to toggle)
mygui 3.2.2%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 36,228 kB
  • sloc: cpp: 118,031; ansic: 30,202; xml: 15,544; cs: 12,602; tcl: 776; python: 417; makefile: 34
file content (68 lines) | stat: -rw-r--r-- 1,758 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
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
/*!
	@file
	@author		Albert Semenov
	@date		08/2008
*/
#include "Precompiled.h"
#include "PanelDynamic.h"

namespace demo
{

	PanelDynamic::PanelDynamic() : BasePanelViewItem("")
	{
	}

	void PanelDynamic::initialise()
	{
		mPanelCell->setCaption("Dynamic panel");

		const int height = 24;
		const int height_step = 26;
		const int width = 55;
		const int width_step = 3;
		int height_current = 0;
		for (size_t pos = 0; pos < 16; ++pos)
		{
			MyGUI::TextBox* text = mWidgetClient->createWidget<MyGUI::TextBox>("TextBox", MyGUI::IntCoord(width_step, height_current, width, height), MyGUI::Align::Left | MyGUI::Align::Top);
			text->setTextAlign(MyGUI::Align::Right | MyGUI::Align::VCenter);
			text->setCaption(MyGUI::utility::toString("line ", pos + 1, " : "));
			mItemsText.push_back(text);

			MyGUI::EditBox* edit = mWidgetClient->createWidget<MyGUI::EditBox>("Edit", MyGUI::IntCoord(width_step + width_step + width, height_current, mWidgetClient->getWidth() - (width_step + width_step + width_step + width), height), MyGUI::Align::HStretch | MyGUI::Align::Top);
			mItemsEdit.push_back(edit);

			height_current += height_step;
		}

		mPanelCell->setClientHeight(height_current, false);
	}

	void PanelDynamic::shutdown()
	{
		mItemsText.clear();
		mItemsEdit.clear();
	}

	void PanelDynamic::setVisibleCount(size_t _count)
	{
		const int height_step = 26;
		int height_current = 0;
		for (size_t pos = 0; pos < 16; ++pos)
		{
			if (pos < _count)
			{
				mItemsText[pos]->setVisible(true);
				mItemsEdit[pos]->setVisible(true);
				height_current += height_step;
			}
			else
			{
				mItemsText[pos]->setVisible(false);
				mItemsEdit[pos]->setVisible(false);
			}
		}
		mPanelCell->setClientHeight(height_current, true);
	}

} // namespace demo