Beispiel #1
0
Font FontSelectManager::Get() {
	Font f(face->GetData(), height->GetData());
	if(*bold) f.Bold();
	if(*italic) f.Italic();
	if(*naa) f.NonAntiAliased();
	return f;
}
Beispiel #2
0
	MyApp()
	{
		Add(dl.HSizePos().TopPos(5, Ctrl::STDSIZE));
		dl.SetDisplay(Single<FontFaceDisplay>());
		for(int i = 0; i < Font::GetFaceCount(); i++)
			dl.Add(i);
		SetRect(0, 0, 200, 70);
	}
Beispiel #3
0
void TemplateDlg::EnterTemplate()
{
	const PackageTemplate& tp = ActualTemplate();
	ArrayMap<String, EscValue> var;
	var.Add("PACKAGE", (String)~package);
	StdLib(var);
	label.Clear();
	ctrl.Clear();
	Point pos = templist.GetRect().BottomLeft();
	pos.y += 8;
	int cx = cancel.GetRect().right - pos.x;
	for(int i = 0; i < tp.item.GetCount(); i++) {
		const TemplateItem& m = tp.item[i];
		if(m.type == TEMPLATEITEM_OPTION)
			ctrl.Create<Option>().SetLabel(m.label);
		else {
			label.Add().SetLabel(m.label).LeftPos(pos.x, cx).TopPos(pos.y);
			Add(label.Top());
			pos.y += label.Top().GetMinSize().cy;
			switch(m.type) {
			case TEMPLATEITEM_ID: {
				EditField *e = new EditField;
				e->SetFilter(IdFilter);
				ctrl.Add(e);
				break;
			}
			case TEMPLATEITEM_FILENAME: {
				EditField *e = new EditField;
				e->SetFilter(FilenameFilter);
				ctrl.Add(e);
				break;
			}
			case TEMPLATEITEM_SELECT: {
				DropList *d = new DropList;
				for(int i = 0; i < m.value.GetCount(); i++)
					d->Add(i, m.value[i]);
				if(m.value.GetCount())
					d->SetIndex(0);
				ctrl.Add(d);
				break;
			}
			case TEMPLATEITEM_TEXT: {
			    EditField *e = new EditField;
			    ctrl.Add(e);
			    break;
			}
			}
		}
		Add(ctrl.Top());
		ctrl.Top() << ~delay;
		ctrl.Top().LeftPos(pos.x, cx).TopPos(pos.y);
		pos.y += ctrl.Top().GetMinSize().cy + 6;
		ctrl.Top().ClearModify();
	}
	Inits();
	Preview();
}
Beispiel #4
0
void DlCharset(DropList& d)
{
	d.Add(CHARSET_UTF8, "UTF8");
	d.Add(TextCtrl::CHARSET_UTF8_BOM, "UTF8 BOM");
	d.Add(TextCtrl::CHARSET_UTF16_LE, "UTF16 LE");
	d.Add(TextCtrl::CHARSET_UTF16_BE, "UTF16 BE");
	d.Add(TextCtrl::CHARSET_UTF16_LE_BOM, "UTF16 LE BOM");
	d.Add(TextCtrl::CHARSET_UTF16_BE_BOM, "UTF16 BE BOM");
	for(int i = 1; i < CharsetCount(); i++)
		d.Add(i, CharsetName(i));
}
Beispiel #5
0
	CETest() {
		Add(tst.BottomPos(40, 20).HSizePos());
		Add(h.TopPos(0, 20).HSizePos(20, 20));
		Add(option.SetLabel("Option").TopPos(20, 20).LeftPos(100, 100));
		Add(editor.TopPos(40, 20).LeftPos(0, 100));
		Add(button.SetLabel("U++").TopPos(200, 20).LeftPos(0, 100));
		for(int i = 0; i < 200; i++)
			h.Add(i);
		ball = CreateBall(80, Cyan);
		editor <<= Breaker();
		button <<= Breaker();
	}
Beispiel #6
0
		Control* createDropList(const Loader& e) {
			int max   = e.attribute("max", 0);
			int width = e.attribute("width", 0);
			int height= e.attribute("height", 0);
			int event = e.attribute("event", 0);
			DropList* list = new DropList(width, height, max, e.style(), event);
			// Child items
			for(XML::iterator i=e->begin(); i!=e->end(); ++i) {
				if(strcmp(i->name(), "item")==0) {
					const char* itm = i->text()? i->text(): i->attribute("name");
					list->addItem(itm, i->attribute("selected",0)>0);
				}
			}
			return list;
		}
Beispiel #7
0
void FontSelectManager::Set(DropList& _face, DropList& _height,
                            Option& _bold, Option& _italic, Option& _naa) {
	face = &_face;
	face->WhenAction = THISBACK(FaceSelect);
	height = &_height;
	height->WhenAction = THISBACK(Select);
	bold = &_bold;
	bold->WhenAction = THISBACK(Select);
	italic = &_italic;
	italic->WhenAction = THISBACK(Select);
	naa = &_naa;
	naa->WhenAction = THISBACK(Select);
	face->Clear();
	Index<String> fni;
	LoadFonts(face, fni, true);
	face->AddSeparator();
	LoadFonts(face, fni, false);
	face->SetIndex(0);
	height->ClearList();
	for(int i = 6; i < 64; i++)
		height->Add(i);
	FaceSelect();
}
Beispiel #8
0
void FontSelectManager::Set(Font f) {
	int fi = f.GetFace();
	if(!face->HasKey(fi)) {
		fi = face->FindValue(f.GetFaceName());
		if(fi < 0)
			fi = Font::COURIER;
		else
			fi = face->GetKey(fi);
	}
	face->SetData(fi);
	FaceSelect();
	height->SetData(f.GetHeight());
	for(int i = 0; i < height->GetCount(); i++) {
		int q = height->GetKey(i);
		if(f.GetHeight() <= q) {
			height->SetData(q);
			break;
		}
	}
	*bold = f.IsBold();
	*italic = f.IsItalic();
	*naa = f.IsNonAntiAliased();
}
Beispiel #9
0
void PropertiesWindow::Property(const String& id, const String& label, const String& type,
	const Array<String>& prop)
{
	if (type == "Option")
	{
		EditIntSpinEx* p = &_Properties.Create<EditIntSpinEx>(id);
		p->Min(0).Max(1);

		if (prop.GetCount())
		{
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "EditInt")
	{
		EditInt* p = &_Properties.Create<EditInt>(id);
		if (prop.GetCount())
		{
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "EditField")
	{
		EditField* p = &_Properties.Create<EditField>(id);
		if (prop.GetCount())
		{
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "EditTabs")
	{
		EditTabs* p = &_Properties.Create<EditTabs>(id);
		p->WhenEndEdit = THISBACK1(OnEndEdit, 0);
		if (prop.GetCount())
		{
			p->SetLabel(t_("Change tabs..."));
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "EditColumns")
	{
		EditColumns* p = &_Properties.Create<EditColumns>(id);
		p->WhenEndEdit = THISBACK1(OnEndEdit, 0);
		if (prop.GetCount())
		{
			p->SetLabel(t_("Change columns..."));
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "DropList")
	{
		if (prop.GetCount() < 2) return;

		DropList* p = &_Properties.Create<DropList>(id);
		for (int i = 1; i < prop.GetCount(); ++i)
			p->Add(prop[i]);

		if (prop.GetCount())
		{
			String option = prop[ prop[0].IsEmpty() ? 1 : 0 ];
			_Options.AddRow(label, option);
			p->SetData(option);
		}
	}
}
Beispiel #10
0
	void InitGrid()
	{
		const int names_cnt = 6;
		const int colors_cnt = 4;
		const int numbers_cnt = 10;

		const char * s_names[] = { "Jack", "Martin", "Smith", "Billy", "Eve", "Pamela" };
		const char * s_colors[] = { "Red", "Blue", "White", "Black" };

		#ifdef LOG_PANEL
		dlog = &log0;
		#endif

		grid.Inserting();
		grid.Appending();
		grid.Moving();
		grid.Removing();
		grid.Navigating();
		grid.Searching();
		grid.Editing();

		grid.WhenLeftDouble = THISBACK(Double);

		for(int i = 0; i < numsopt.total_cols; i++)
		{
			String name = Format("Column %d", i+1);
			int size = rand()%40 + 50;
			grid.AddColumn(name, size).Min(5);
			arr.AddColumn(name, size).HeaderTab().Min(5);
		}

		for(int i = 0; i < names_cnt; i++)
			names.Add(i, s_names[i]);
		for(int i = 0; i < colors_cnt; i++)
			colors.Add(i, s_colors[i]);
		for(int i = 0; i < numbers_cnt; i++)
			numbers.Add(i, Format("Number %d", i));

		grid.GetColumn(1).Edit(names).SetConvert(names);
		grid.GetColumn(2).Edit(numbers).SetConvert(numbers);
		grid.GetColumn(3).Edit(colors).SetConvert(colors);
		grid.GetColumn(4).Edit(edit0);
		grid.GetColumn(5).Edit(edit1);

		numbers.DropFocus();
		names.DropFocus();
		colors.DropFocus();


//		grid.Add(numsopt.total_rows);

		for(int i = 0; i < numsopt.total_rows; i++)
			for(int j = 0; j < numsopt.total_cols; j++)
			{
				switch(j)
				{
					case 0: grid.Set(i, j, Value(i + 1)); break;
					case 1: grid.Set(i, j, rand() % (names_cnt - 1)); break;
					case 2: grid.Set(i, j, rand() % (numbers_cnt - 1)); break;
					case 3: grid.Set(i, j, rand() % (colors_cnt - 1)); break;
					default:
						grid.Set(i, j, Value(rand()%500));

				}
				arr.Set(i, j, Value(rand()%500));
			}

		grid.ResizePaintMode(2);
		grid.ResizeColMode(0);
		grid.ResizeRowMode(0);
		grid.HorzGrid(lookopt.hgrid).VertGrid(lookopt.vgrid);
		grid.EvenColor();
		grid.ColoringMode(2);
		grid.EditCell();
		grid.MultiSelect(editopt.multiline);
		grid.SelectRow(editopt.select_row);
		grid.Sorting(editopt.sorting);
		grid.MovingCols(1).MovingRows(1);
		grid.SetToolBar();
		grid.Dragging();
		grid.SetCursor(0);

		//grid.AutoHideSb();

		arr.HeaderTab(0).SetRatio(10);
		arr.HeaderObject().Absolute();//ReduceNext();
		arr.MultiSelect();
		arr.Inserting();
		arr.SetLineCy(20);
		//arr.ColumnAt(1).Ctrls(MakeDropList);
		//arr.ColumnAt(2).Ctrls(MakeButton);
		arr.ColumnAt(1).Edit(e0);
		arr.ColumnAt(2).Edit(e1);


		grid1.AddColumn("c0");
		grid1.AddColumn("c1");
		grid2.AddColumn("c0");
		grid2.AddColumn("c1");

	}