ZLWin32ApplicationWindow::TextEditParameter::TextEditParameter(ZLApplication &application, HWND mainWindow, HWND toolbar, int idCommand, const ZLToolbar::ParameterItem &item) : myApplication(application), myMainWindow(mainWindow), myParameterItem(item) {
	const int index = SendMessage(toolbar, TB_COMMANDTOINDEX, idCommand, 0);
	RECT rect;
	SendMessage(toolbar, TB_GETITEMRECT, index, (LPARAM)&rect);
	DWORD style = WS_CHILD | WS_VISIBLE | WS_BORDER;
	if (item.type() == ZLToolbar::Item::COMBO_BOX) {
		style |= CBS_DROPDOWN | WS_VSCROLL;
	}
	myComboBox = CreateWindow(WC_COMBOBOX, 0, style, rect.left + 5, rect.top + 8, rect.right - rect.left - 10, rect.bottom - rect.top - 14, toolbar, (HMENU)idCommand, GetModuleHandle(0), 0);
	HWND textItem = getTextItem(myComboBox);
	DWORD textItemStyle = GetWindowLong(textItem, GWL_STYLE);
	textItemStyle |= ES_CENTER | ES_NOHIDESEL;
	if (item.symbolSet() == ZLToolbar::ParameterItem::SET_DIGITS) {
		textItemStyle |= ES_NUMBER;
	}
	SetWindowLong(textItem, GWL_STYLE, textItemStyle);

	addTooltipToWindow(myComboBox, item.tooltip());
	addTooltipToWindow(getTextItem(myComboBox), item.tooltip());

	myOriginalComboBoxCallback = (WndProc)SetWindowLong(myComboBox, GWL_WNDPROC, (LONG)ComboBoxCallback);
	SetWindowLong(myComboBox, GWL_USERDATA, (LONG)this);

	HWND textEdit = getTextItem(myComboBox);
	myOriginalTextEditCallback = (WndProc)SetWindowLong(textEdit, GWL_WNDPROC, (LONG)TextEditCallback);
	SetWindowLong(textEdit, GWL_USERDATA, (LONG)this);
}
ZLQtApplicationWindow::LineEditParameter::LineEditParameter(QToolBar *toolbar, ZLQtApplicationWindow &window, const ZLToolbar::ParameterItem &textFieldItem) : QLineEdit(toolbar), myWindow(window), myActionId(textFieldItem.actionId()) {
	setAlignment(Qt::AlignHCenter);
	setFocusPolicy(ClickFocus);
	setMaxLength(textFieldItem.maxWidth());
	setMaximumWidth(textFieldItem.maxWidth() * 12 + 12);
	QToolTip::add(this, QString::fromUtf8(textFieldItem.tooltip().c_str()));
	myWindow.addVisualParameter(textFieldItem.parameterId(), this);
}