Ejemplo n.º 1
0
LRESULT C_SpinButton::OnNegative(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	try {

		unsigned int len = SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0);

		DWORD dwStart;
		DWORD dwEnd;

		SendMessage(m_ed.m_hWnd, EM_GETSEL, reinterpret_cast<WPARAM>(&dwStart), reinterpret_cast<WPARAM>(&dwEnd));

		if (0 == dwStart && 0 == dwEnd && m_fValue > 0) {

			float value = -m_fValue;
			
			if (m_fMinValue == m_fMaxValue) {
				InternalSetValue(value);
			}
			else if (value <= m_fMaxValue && value >= m_fMinValue) {
				InternalSetValue(value);
			}
			else {
				return S_OK;
			}
		}
		else if (m_fMinValue == m_fMaxValue) {
			InternalSetValue(-1);
		}
		else if (-1 <= m_fMaxValue && -1 >= m_fMinValue) {
			InternalSetValue(-1);
		}
		else {

			MessageBeep(0xFFFFFFFF);
			return S_OK;
		}

		DisplayValue();

		TCHAR t[1024];
		SendMessage(m_ed.m_hWnd, WM_GETTEXT, 1023, reinterpret_cast<long>(t));
		
		String s(t);

		SendMessage(m_ed.m_hWnd, EM_SETSEL, 1, s.GetLength());

		FireChangeMessage();
	}
	catch (C_STLNonStackException const &exception) {
		exception.Log(_T("Exception in C_SpinButton::OnNegative"));
	}

	return S_OK;
}
Ejemplo n.º 2
0
void ezQtStandardPropertyWidget::SetSelection(const ezHybridArray<ezPropertySelection, 8>& items)
{
  ezQtPropertyWidget::SetSelection(items);

  m_OldValue = GetCommonValue(items, m_pProp);
  InternalSetValue(m_OldValue);
}
Ejemplo n.º 3
0
LRESULT C_SpinButton::OnTextChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	C_STLException::install();

	try {

		TCHAR t[32];
		m_ed.SendMessage(WM_GETTEXT, 1023, reinterpret_cast<LPARAM>(t));

		String s(t);

		StringPtr ptr = s.Find(_T('-'));

		if (ptr.isValid()) {

			if (ptr.Index() > 0) {

				s = s.Left(ptr.Index());
				m_ed.SendMessage(WM_SETTEXT, s.GetLength(), reinterpret_cast<LPARAM>(s.toLPCTSTR()));
				m_ed.SendMessage(EM_SETSEL, s.GetLength(), s.GetLength());

				return S_OK;
			}
		}

		float f = static_cast<float>(s.toDouble());
		
		if (m_fValue != f) {

			if (m_fMinValue == m_fMaxValue || (f >= m_fMinValue && f <= m_fMaxValue)) {

				InternalSetValue(f);
				FireChangeMessage();
			}
			else {
				
				MessageBeep(0xFFFFFFFF);
				DisplayValue();

				return S_OK;
			}
		}

		if (0 == s.GetLength()) {
			DisplayValue();
		}
	}
	catch (C_STLNonStackException const &exception) {
		exception.Log(_T("Exception in C_SpinButton::"));
	}

	return S_OK;
}
Ejemplo n.º 4
0
void C_SpinButton::SetValue(float f)				
{ 
	C_STLException::install();

	try {

		m_bIsLoaded = FALSE;

		InternalSetValue(f); 
		DisplayValue(); 

		m_ed.EnableWindow(TRUE);

		m_bIsLoaded = TRUE;
	}
	catch (C_STLNonStackException const &exception) {
		exception.Log(_T("Exception in C_SpinButton::"));
	}
}
Ejemplo n.º 5
0
void SetValueCProxy(const std::string& cvarName, std::string value) {
    InternalSetValue(cvarName, std::move(value), 0, true, false);
}
Ejemplo n.º 6
0
void SetValueForce(const std::string& cvarName, std::string value) {
    InternalSetValue(cvarName, std::move(value), 0, true, true);
}
Ejemplo n.º 7
0
LRESULT C_SpinButton::OnCommand(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	C_STLException::install();

	try {

		if (reinterpret_cast<HWND>(lParam) == m_btnUp.m_hWnd) {
			OnInc(0, 0, 0, bHandled);
		}
		else if (reinterpret_cast<HWND>(lParam) == m_btnDown.m_hWnd) {
			OnDec(0, 0, 0, bHandled);
		}
		else {

			float value = m_fValue;

			switch (wParam) {

			case IDR_MNU_MINUS_2: {	
					value -= 2;
				}
				break;
			case IDR_MNU_MINUS_5: {	
					value -= 5;
				}
				break;
			case IDR_MNU_MINUS_10: {		
					value -= 10;
				}
				break;
			case IDR_MNU_MINUS_15: {		
					value -= 15;
				}
				break;
			case IDR_MNU_MINUS_20: {		
					value -= 20;
				}
				break;
			case IDR_MNU_MINUS_50: {		
					value -= 50;
				}
				break;
			case IDR_MNU_PLUS_2: {	
					value += 2;
				}
				break;
			case IDR_MNU_PLUS_5: {	
					value += 5;
				}
				break;
			case IDR_MNU_PLUS_10: {		
					value += 10;
				}
				break;
			case IDR_MNU_PLUS_15: {		
					value += 15;
				}
				break;
			case IDR_MNU_PLUS_20: {		
					value += 20;
				}
				break;
			case IDR_MNU_PLUS_50: {		
					value += 50;
				}
				break;
			case IDC_BTN_INC: {		
					value++;
				}
				break;
			case IDC_BTN_DEC: {		
					value--;
				}
				break;
			default:
				return DefWindowProc();
			}

			if (m_fMinValue == m_fMaxValue) {
				InternalSetValue(value);
			}
			else {

				if (value <= m_fMaxValue && value >= m_fMinValue) {
					InternalSetValue(value);
				}
				else if (value > m_fMaxValue) {
					InternalSetValue(m_fMaxValue);
				}
				else if (value < m_fMinValue) {
					InternalSetValue(m_fMinValue);
				}
			}

			DisplayValue();
			FireChangeMessage();
		}

		return DefWindowProc();
	}
	catch (C_STLNonStackException const &exception) {
		exception.Log(_T("Exception in C_SpinButton::OnCommand"));
	}

	return S_OK;
}
Ejemplo n.º 8
0
 void SetValueCProxy(const std::string& cvarName, const std::string& value) {
     InternalSetValue(cvarName, value, 0, true, false);
 }
Ejemplo n.º 9
0
 void SetValueForce(const std::string& cvarName, const std::string& value) {
     InternalSetValue(cvarName, value, 0, true, true);
 }