Sha256: 4186bb4d72f7383a8a27fb2eb328d33a3ba7bf40724673cb8c201497f3413730

Contents?: true

Size: 1.69 KB

Versions: 64

Compression:

Stored size: 1.69 KB

Contents

#pragma once

#if defined(OS_WINDOWS)

template <class T> class COkCancelModalDialog : public CDialogImpl<T> 
{
public:
	CButton		m_btnOk;
	CButton		m_btnCancel;

	COkCancelModalDialog() 
	{
		m_width = m_height = 0;
		m_xborder = m_yborder  =0;
		m_btnHeight = 0;
	};

	void CreateButtons () 
	{
		Maximize();

		RECT rect;
		rect.left    = 1;
		rect.top     = m_height - m_btnHeight;
		rect.right   = rect.left + (m_width >> 1) - 2;
		rect.bottom  = rect.top  + m_btnHeight;
		m_btnOk.Create(m_hWnd, rect, TEXT("Ok"), WS_CHILD | WS_VISIBLE, 0, IDOK);
	
		rect.left    = (m_width >> 1);
		rect.top     = m_height - m_btnHeight;
		rect.right   = rect.left + (m_width >> 1) + 2;
		rect.bottom  = rect.top  + m_btnHeight;
		m_btnCancel.Create(m_hWnd, rect,TEXT("Cancel"),WS_CHILD|WS_VISIBLE,0,IDCANCEL);
	}

private:

	void Maximize () 
	{
		RECT rect;
		NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };

		GetParent().GetWindowRect(&rect);
		SystemParametersInfo ( SPI_GETNONCLIENTMETRICS, 0, &ncm, false );

		m_width = rect.right - rect.left - GetSystemMetrics(SM_CXEDGE)*2;
		m_height = rect.bottom - rect.top - GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYEDGE)*2;
		m_xborder = GetSystemMetrics(SM_CXEDGE) > GetSystemMetrics(SM_CXBORDER) ? 
									GetSystemMetrics(SM_CXEDGE) : GetSystemMetrics(SM_CXBORDER);
		m_yborder = GetSystemMetrics(SM_CYEDGE) > GetSystemMetrics(SM_CYBORDER) ? 
									GetSystemMetrics(SM_CYEDGE) : GetSystemMetrics(SM_CYBORDER);
		m_btnHeight = ncm.iMenuHeight+ncm.iBorderWidth * 4 + 2;

		MoveWindow(rect.left + m_xborder, rect.top  + GetSystemMetrics(SM_CYCAPTION), m_width, m_height);
	}

private:
	int m_width, m_height;
	int m_xborder, m_yborder;
	int m_btnHeight;
};

#endif

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
rhodes-3.0.2 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.2.beta.1 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.1 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.1.beta.8 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.1.beta.7 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.1.beta.6 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.1.beta.5 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.1.beta.4 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.1.beta.3 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.1.beta.2 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.0 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.0.beta.7 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.0.beta.6 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.0.beta.5 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.0.beta.4 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.0.beta.3 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.0.beta.2 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-3.0.0.beta.1 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-2.4.1 platform/wm/rhodes/OkCancelModalDialog.h
rhodes-2.4.1.beta.1 platform/wm/rhodes/OkCancelModalDialog.h