Exemple #1
0
BOOL TrigEditorWindow::DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg )
	{
		case WM_ACTIVATE:
			if ( LOWORD(wParam) != WA_INACTIVE )
				chkd.SetCurrDialog(hWnd);
			return FALSE;
			break;

		case WM_INITDIALOG:
			SetSmallIcon((HANDLE)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PROGRAM_ICON), IMAGE_ICON, 16, 16, 0));
			CreateSubWindows(hWnd);
			ReplaceChildFonts(defaultFont);
			RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
			break;

		case WM_SIZE:
			DoSize();
			break;

		case WM_CLOSE:
			triggersWindow.trigModifyWindow.Hide();
			ClassDialog::DestroyDialog();
			return FALSE;
			break;

		default:
			return FALSE;
			break;
	}
	return TRUE;
}
//=================================================================== OnPaint
void CNSDateEdit::OnPaint()
{
    ASSERT( IsWindow( m_hWnd ) );

    char szSeparator[2];
#ifdef WIN32
    VERIFY( GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_SDATE, szSeparator, 2 ) == 2 );
#else
    static char cName [] = "intl" ;
    GetProfileString (cName, "sDate",  "/", szSeparator,     2) ;
#endif

    BOOL bEnabled = IsWindowEnabled();
    CPaintDC dc(this);
    CBrush winBrush( GetSysColor( bEnabled ? COLOR_WINDOW : COLOR_BTNFACE ) );
    dc.FillRect( &dc.m_ps.rcPaint, &winBrush );

    if ( m_bNeedControls )
        CreateSubWindows( );

    CFont *pOldFont = dc.SelectObject( CFont::FromHandle( (HFONT)::GetStockObject( ANSI_VAR_FONT ) ) );
    int oldMode = dc.SetBkMode( TRANSPARENT );
    COLORREF oldTextColor = dc.SetTextColor( GetSysColor( bEnabled ? COLOR_BTNTEXT : COLOR_GRAYTEXT ) );

    dc.DrawText( szSeparator, -1, m_Sep1, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
    dc.DrawText( szSeparator, -1, m_Sep2, DT_SINGLELINE | DT_CENTER | DT_VCENTER );

    dc.SelectObject( pOldFont );
    dc.SetBkMode( oldMode );
    dc.SetTextColor( oldTextColor );
}
void CNSDateEdit::OnSetFocus(CWnd* pOldWnd)
{
    if ( m_bNeedControls )
        CreateSubWindows( );

    m_pFields[0]->SetFocus();
    m_iCurrentField = 0;
}
void CNSDateEdit::OnSize( UINT nType, int cx, int cy )
{
    if ( m_bNeedControls )
        CreateSubWindows( );

    if ( nType != SIZE_MINIMIZED ) {
        RECT r;
        ::SetRect( &r, 0, 0, cx, cy );
        LayoutSubWindows( &r );
    }
}
Exemple #5
0
BOOL TrigModifyWindow::DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch ( msg )
    {
        case WM_SHOWWINDOW:
            if ( wParam == FALSE && onTrigTextTab() )
                trigModifyTextWindow.ParentHidden();
            else if ( wParam == FALSE && currTab == TAB_CONDITIONS )
                conditionsWindow.HideSuggestions();
            return FALSE;
            break;

        case WM_ACTIVATE:
            if ( LOWORD(wParam) != WA_INACTIVE )
                chkd.SetCurrDialog(hWnd);
            else // LOWORD(wParam) == WA_INACTIVE
                conditionsWindow.HideSuggestions();
            return FALSE;
            break;

        case WM_NCACTIVATE:
            if ( (BOOL)wParam == FALSE )
                conditionsWindow.HideSuggestions();
            return FALSE;
            break;

        case WM_INITDIALOG:
            {
                SetSmallIcon((HANDLE)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PROGRAM_ICON), IMAGE_ICON, 16, 16, 0 ));
                tabs.FindThis(hWnd, IDC_TRIGMODIFYTABS);
                const char* tabLabels[] = { "General", "Players", "Conditions", "Actions", "Text" };
                for ( int i=0; i<sizeof(tabLabels)/sizeof(const char*); i++ )
                    tabs.InsertTab(i, tabLabels[i]);
                CreateSubWindows(hWnd);
                DoSize();
                ReplaceChildFonts(defaultFont);
                RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
            }
            break;

        case WM_SIZE:
            DoSize();
            break;

        case WM_CLOSE:
            ShowWindow(hWnd, SW_HIDE);
            break;

        default:
            return FALSE;
            break;
    }
    return TRUE;
}
void CNSDateEdit::OnEnable( BOOL bEnable )
{
    if ( m_bNeedControls )
        CreateSubWindows( );

    m_YearField.EnableWindow( bEnable );
    m_MonthField.EnableWindow( bEnable );
    m_DayField.EnableWindow( bEnable );

    CStatic::OnEnable( bEnable );

    Invalidate();
}
Exemple #7
0
bool UnitSettingsWindow::CreateThis(HWND hParent, u32 windowId)
{
    if ( getHandle() != NULL )
        return SetParent(hParent);

    if ( ClassWindow::RegisterWindowClass(0, NULL, NULL, NULL, NULL, "UnitSettings", NULL, false) &&
         ClassWindow::CreateClassWindow(0, "UnitSettings", WS_VISIBLE|WS_CHILD, 4, 22, 592, 524, hParent, (HMENU)windowId) )
    {
        CreateSubWindows(getHandle());
        return true;
    }
    else
        return false;
}
Exemple #8
0
bool SwitchesWindow::CreateThis(HWND hParent, u32 windowId)
{
	if ( getHandle() != NULL )
		return SetParent(hParent);

	RECT rcCli;
	if ( GetWindowRect(hParent, &rcCli) &&
		 ClassWindow::RegisterWindowClass(0, NULL, NULL, NULL, NULL, "Switches", NULL, false) &&
		 ClassWindow::CreateClassWindow(0, "Switches", WS_CHILD,
			5, 22, rcCli.right-rcCli.left, rcCli.bottom-rcCli.top,
			hParent, (HMENU)windowId) )
	{
		CreateSubWindows(getHandle());
		return true;
	}
	else
		return false;
}
Exemple #9
0
ChildView::ChildView(wxMDIParentFrame *parent, const wxString& title, SimulatedWorld *sw)
: wxMDIChildFrame(parent, wxID_ANY, title, wxPoint(50,50), wxSize(500,400), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE),m_timer(this,ID_TIMER)
{
	
	mainWin = (MainWindow*)parent;
	m_splitter = (wxSplitterWindow *) NULL;
	toolbar = 0;
	s_world= sw;
	m_world = sw->getWorld();
	playsimu=false;
	isActivated=true;
	//call timer
	m_timer.Start(100);

	//make a toolbar
	CreateToolBar( wxNO_BORDER | wxTB_FLAT |wxTB_HORIZONTAL, wxID_ANY, wxT(""));
	toolbar = GetToolBar();
	if(toolbar)InitToolBar(toolbar);

	CreateSubWindows();
	
	

}