Example #1
0
void CTabPanelWin::ShowToolbar(bool bShow)
{
	if (bShow)
	{
		if (!IsToolbarCreated() && (CreateToolbar() != NULL))
		{
			REBARBANDINFO rbBand = {80}; // не используем size, т.к. приходит "новый" размер из висты и в XP обламываемся

			rbBand.fMask  = RBBIM_SIZE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_ID | RBBIM_STYLE | RBBIM_COLORS;
			rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDSIZE | RBBS_VARIABLEHEIGHT;
			rbBand.clrBack = GetSysColor(COLOR_BTNFACE);
			rbBand.clrFore = GetSysColor(COLOR_BTNTEXT);

			SIZE sz = {0,0};
			SendMessage(mh_Toolbar, TB_GETMAXSIZE, 0, (LPARAM)&sz);

			// Set values unique to the band with the toolbar.
			rbBand.wID        = 2;
			rbBand.hwndChild  = mh_Toolbar;
			rbBand.cx = rbBand.cxMinChild = rbBand.cxIdeal = mn_LastToolbarWidth = sz.cx;
			rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = sz.cy + mn_ThemeHeightDiff;

			// Add the band that has the toolbar.
			if (!SendMessage(mh_Rebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand))
			{
				DisplayLastError(_T("Can't initialize rebar (toolbar)"));
			}
		}
	}
	else
	{
		_ASSERTEX(bShow);
	}
}
Example #2
0
FB_Frame::FB_Frame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) :
    wxFrame( parent, id, caption, pos, size, style ) {
    wxSystemOptions::SetOption(wxT("msw.notebook.themed-background"), 0);
    m_Config = new FB_Config(  );
    m_DocList = new FB_DocList;
    m_StatusBar = new FB_StatusBar( this );
    m_ToolBar = new FB_ToolBar( this );
        
    if ( m_Config->winw==-1||m_Config->winh==-1 ) {
        SetSize(300, 200);
        Centre();
        Maximize();
    }
    else {
        Move(m_Config->winx, m_Config->winy);
        SetSize(m_Config->winw, m_Config->winh);
    }
    Show( true );
        
    m_Code_area = NULL;
    m_ActiveTabID = -1;
    
    Freeze();
        CreateMenus();
        CreateToolbar();
        CreatePanels();
        CreateStatusBar();
    Thaw();

    SendSizeEvent();
    SetStatus();
    m_Config->m_FileHistory->AddFilesToMenu();
}
Example #3
0
HWND Explorerplusplus::CreateTabToolbar(HWND hParent,int idCommand,TCHAR *szTip)
{
	HWND TabToolbar = CreateToolbar(hParent,WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|
		TBSTYLE_TOOLTIPS|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|TBSTYLE_FLAT|CCS_NODIVIDER|
		CCS_NOPARENTALIGN|CCS_NORESIZE,TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DOUBLEBUFFER);
	
	SendMessage(TabToolbar,TB_SETBITMAPSIZE,0,MAKELONG(7,7));
	SendMessage(TabToolbar,TB_BUTTONSTRUCTSIZE,sizeof(TBBUTTON),0);
	SendMessage(TabToolbar,TB_SETBUTTONSIZE,0,MAKELPARAM(16,16));

	/* TODO: The image list is been leaked. */
	HIMAGELIST himl = ImageList_Create(7,7,ILC_COLOR32|ILC_MASK,0,2);
	HBITMAP hb = LoadBitmap(GetModuleHandle(0),MAKEINTRESOURCE(IDB_TABTOOLBAR_CLOSE));
	int iIndex = ImageList_Add(himl,hb,NULL);
	SendMessage(TabToolbar,TB_SETIMAGELIST,0,reinterpret_cast<LPARAM>(himl));
	DeleteObject(hb);

	/* Add the close button, used to close tabs. */
	TBBUTTON tbButton;
	tbButton.iBitmap	= iIndex;
	tbButton.idCommand	= idCommand;
	tbButton.fsState	= TBSTATE_ENABLED;
	tbButton.fsStyle	= TBSTYLE_BUTTON|TBSTYLE_AUTOSIZE;
	tbButton.dwData		= 0;
	tbButton.iString	= reinterpret_cast<INT_PTR>(szTip);
	SendMessage(TabToolbar,TB_INSERTBUTTON,0,reinterpret_cast<LPARAM>(&tbButton));

	SendMessage(TabToolbar,TB_AUTOSIZE,0,0);

	return TabToolbar;
}
Example #4
0
	void InitDlg ( HWND hDlg ) const
	{
		DlgTxt ( hDlg, IDC_TO, T_DLG_TO );
		DlgTxt ( hDlg, IDCANCEL, T_TBAR_CANCEL );
		DlgTxt ( hDlg, IDC_RETRY, T_DLG_RETRY );
		DlgTxt ( hDlg, IDC_SKIP, T_DLG_SKIP );
		DlgTxt ( hDlg, IDC_SKIP_ALL, T_DLG_SKIP_ALL );

		CreateToolbar ( hDlg, IDM_CANCEL );

		SetDlgItemText ( hDlg, IDC_OPERATION, Txt ( T_OP_HEAD_COPY + m_eOperationMode ) );
		SendMessage ( GetDlgItem ( hDlg, IDC_OPERATION ), WM_SETFONT, (WPARAM)g_tResources.m_hBoldSystemFont, TRUE );

		AlignFileName ( GetDlgItem ( hDlg, IDC_FILE1 ), m_sFile1 );
		if ( IsTwoFileDlg () )
			AlignFileName ( GetDlgItem ( hDlg, IDC_FILE2 ), m_sFile2 );
		
		SetDlgItemText ( hDlg, IDC_ERROR, m_sDesc );

		// set proper button name
		if ( m_dErrorBtns [m_eOperationMode] == EB_O_OA_S_SA_C )
		{
			SetDlgItemText ( hDlg, IDC_OVER, Txt ( m_eOperationMode + T_OP_BTN_COPY ) );
			SetDlgItemText ( hDlg, IDC_OVER_ALL, Txt ( T_OP_ALL ) );
		}
	}
Example #5
0
static BOOL CALLBACK RenameDlgProc ( HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam )
{  
	switch ( Msg )
	{
	case WM_INITDIALOG:
        {
			DlgTxt ( hDlg, IDOK, T_TBAR_OK );
			DlgTxt ( hDlg, IDCANCEL, T_TBAR_CANCEL );
			DlgTxt ( hDlg, IDC_TITLE, T_DLG_RENAME_TITLE );
			DlgTxt ( hDlg, IDC_TO, T_DLG_TO );

			CreateToolbar ( hDlg, IDM_OK_CANCEL );

			g_hCombo = GetDlgItem ( hDlg, IDC_RENAME_COMBO );
			SetFocus ( g_hCombo );

			SendMessage ( GetDlgItem ( hDlg, IDC_TITLE ), WM_SETFONT, (WPARAM)g_tResources.m_hBoldSystemFont, TRUE );

			PopulateRenameList ( g_hCombo, g_szDest );
			SetWindowText ( g_hCombo, g_szDest );

			Assert( g_pList );
			bool bDir = g_pList->IsDir ();

			Str_c sFileName = g_szDest;
			int iDotPos = sFileName.RFind ( L'.' );
			int iLast = 0;
			iLast = ( iDotPos == -1 || bDir ) ? sFileName.Length () : iDotPos;

			SendMessage ( g_hCombo, CB_SETEDITSEL, 0, iLast );

			AlignFileName ( GetDlgItem ( hDlg, IDC_RENAME_TEXT ), g_szDest );
        }
	    break;

    case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDOK:
			GetWindowText ( g_hCombo, g_szDest, PATH_BUFFER_SIZE );
		case IDCANCEL:
			SipShowIM ( SIPF_OFF );
			EndDialog ( hDlg, LOWORD (wParam) );
            break;
		}
		break;

	case WM_HELP:
		Help ( L"Rename" );
		return TRUE;
	}

	DWORD dwRes = HandleDlgColor ( hDlg, Msg, wParam, lParam );
	if ( dwRes )
		return dwRes;

	return MovingWindowProc ( hDlg, Msg, wParam, lParam );
}
Example #6
0
MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
                  const wxPoint &position, const wxSize& size, long style )
        :wxFrame( parent, id, title, position, size, style )
{
    m_preview_state = ID_PREVIEW;

    // set the frame icon
    SetIcon(wxICON(mondrian));

    SetMinSize(wxSize(200, 200));

    // set-up the menu, toolbar, statusbar so we know what the client size will be
    m_menubar = new wxMenuBar();
    SetMenuBar(m_menubar);
    m_toolBar = CreateToolBar();

#if wxUSE_STATUSBAR
    CreateStatusBar(2);
    int status_text_width = 0, status_text_height = 0;
    GetStatusBar()->GetTextExtent(MyVideoCaptureWindow::GetStatusText(999999, 9999),
                                  &status_text_width, &status_text_height);
    int status_widths[2] = {-1, status_text_width};
    SetStatusWidths(2, status_widths);
#endif // wxUSE_STATUSBAR

    m_splitterWin = new wxSplitterWindow(this, wxID_ANY);
    m_splitterWin->SetMinimumPaneSize(20);

    m_logPanel = new wxPanel( m_splitterWin, wxID_ANY );
    wxBoxSizer *logpanelsizer = new wxBoxSizer(wxVERTICAL);
    m_logTextCtrl = new wxTextCtrl(m_logPanel, wxID_ANY,
                                   wxT("Event Log for wxVideoCaptureWindow : \n"),
                                   wxDefaultPosition, wxDefaultSize,
                                   wxTE_MULTILINE|wxTE_RICH2|wxTE_READONLY );
    logpanelsizer->Add(m_logTextCtrl, 1, wxEXPAND);
    m_logPanel->SetAutoLayout( true );
    m_logPanel->SetSizer(logpanelsizer);
    logpanelsizer->Fit( m_logPanel );
    logpanelsizer->SetSizeHints( m_logPanel );

    m_vidCapWin = new MyVideoCaptureWindow( m_splitterWin, ID_VIDEOWIN,
                                            wxDefaultPosition, wxDefaultSize);

#ifdef WXVIDCAP_AVI_SUPPORT
    SetTitle(wxT("wxVidCap - ") + m_vidCapWin->GetCaptureFilename());
#else
    SetTitle(wxT("wxVidCap"));
#endif // WXVIDCAP_AVI_SUPPORT

    m_logPanel->Show(false);
    m_vidCapWin->Show(true);
    m_splitterWin->Initialize(m_vidCapWin);

    CreateMenus();
    CreateToolbar();
    SetupVideoMenus();
}
Example #7
0
void Explorerplusplus::CreateBookmarksToolbar(void)
{
	m_hBookmarksToolbar = CreateToolbar(m_hMainRebar,BookmarkToolbarStyles,
		TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DRAWDDARROWS|
		TBSTYLE_EX_DOUBLEBUFFER|TBSTYLE_EX_HIDECLIPPEDBUTTONS);

	m_pBookmarksToolbar = new CBookmarksToolbar(m_hBookmarksToolbar,
		*m_bfAllBookmarks,m_guidBookmarksToolbar,TOOLBAR_BOOKMARK_START,TOOLBAR_BOOKMARK_END);
}
Example #8
0
/*
 * Create the toolbar, initially unpopulated.
 *  (just like the menu, there are no defaults, it's all
 *  set up through menu.vim)
 */
    static void
initialise_toolbar(void)
{
    s_toolbarhwnd = CreateToolbar(
		    s_hwnd,
		    WS_CHILD | WS_VISIBLE,
		    CMD_TB_BASE, /*<vn>*/
		    31,			//number of images in initial bitmap
		    s_hinst,
		    IDR_TOOLBAR1,	// id of initial bitmap
		    NULL,
		    0			// initial number of buttons
		    );

    gui_mch_show_toolbar(vim_strchr(p_go, GO_TOOLBAR) != NULL);
}
void Explorerplusplus::CreateMainToolbar()
{
	m_hMainToolbar = CreateToolbar(m_hMainRebar, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
		TBSTYLE_TOOLTIPS | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_FLAT | CCS_NODIVIDER |
		CCS_NORESIZE | CCS_ADJUSTABLE, TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS |
		TBSTYLE_EX_DOUBLEBUFFER | TBSTYLE_EX_HIDECLIPPEDBUTTONS);

	HIMAGELIST *phiml = NULL;
	int cx;
	int cy;

	if(m_bLargeToolbarIcons)
	{
		cx = TOOLBAR_IMAGE_SIZE_LARGE_X;
		cy = TOOLBAR_IMAGE_SIZE_LARGE_Y;
		phiml = &m_himlToolbarLarge;
	}
	else
	{
		cx = TOOLBAR_IMAGE_SIZE_SMALL_X;
		cy = TOOLBAR_IMAGE_SIZE_SMALL_Y;
		phiml = &m_himlToolbarSmall;
	}

	SendMessage(m_hMainToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(cx, cy));
	SendMessage(m_hMainToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);

	/* Add the custom buttons to the toolbars image list. */
	SendMessage(m_hMainToolbar, TB_SETIMAGELIST, 0, (LPARAM) *phiml);

	AddStringsToMainToolbar();
	AddButtonsToMainToolbar();

	if(!m_bLoadSettingsFromXML)
	{
		if(m_bAttemptToolbarRestore)
		{
			TBSAVEPARAMS	tbSave;

			tbSave.hkr = HKEY_CURRENT_USER;
			tbSave.pszSubKey = REG_SETTINGS_KEY;
			tbSave.pszValueName = _T("ToolbarState");

			SendMessage(m_hMainToolbar, TB_SAVERESTORE, FALSE, (LPARAM) &tbSave);
		}
	}
}
Example #10
0
static BOOL CALLBACK FilterDlgProc ( HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam )
{  
	switch ( Msg )
	{
	case WM_INITDIALOG:
        {
			DlgTxt ( hDlg, IDOK, T_TBAR_OK );
			DlgTxt ( hDlg, IDCANCEL, T_TBAR_CANCEL );
			
			CreateToolbar ( hDlg, IDM_OK_CANCEL );

			g_hFilterCombo = GetDlgItem ( hDlg, IDC_FILTER_COMBO );

			HWND hHeader = GetDlgItem ( hDlg, IDC_FILTER_HEADER );
			SetWindowText ( hHeader, Txt ( g_bMark ? T_DLG_SELECT_FILES : T_DLG_CLEAR_FILES ) );
			SendMessage ( hHeader, WM_SETFONT, (WPARAM)g_tResources.m_hBoldSystemFont, TRUE );

			PopulateFilterList ( g_hFilterCombo );
        }
	    break;

    case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDOK:
			{
				wchar_t szFilter [PATH_BUFFER_SIZE];
				GetWindowText ( g_hFilterCombo, szFilter, PATH_BUFFER_SIZE );
				g_sFilter = szFilter;
			}
		case IDCANCEL:
			SipShowIM ( SIPF_OFF );
			EndDialog ( hDlg, LOWORD (wParam) );
            break;
		}
		break;

	case WM_HELP:
		Help ( L"Toolbar" );
		return TRUE;
	}

	return MovingWindowProc ( hDlg, Msg, wParam, lParam );
}
Example #11
0
void CTabPanelWin::ShowToolsPane(bool bShow)
{
	if (bShow)
	{
		_ASSERTE(isMainThread());
		if (!IsToolbarCreated() && (CreateToolbar() != NULL))
		{
			REBARBANDINFO rbBand = {REBARBANDINFO_SIZE}; // не используем size, т.к. приходит "новый" размер из висты и в XP обламываемся

			rbBand.fMask  = RBBIM_SIZE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_ID | RBBIM_STYLE;
			rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDSIZE | RBBS_VARIABLEHEIGHT;

			#if 0
			rbBand.fMask |= RBBIM_COLORS;
			rbBand.clrFore = RGB(255,255,255);
			rbBand.clrBack = RGB(0,0,255);
			#endif

			SIZE sz = {0,0};
			SendMessage(mh_Toolbar, TB_GETMAXSIZE, 0, (LPARAM)&sz);

			rbBand.wID        = rbi_ToolBar;
			rbBand.hwndChild  = mh_Toolbar;
			rbBand.cx = rbBand.cxMinChild = rbBand.cxIdeal = mn_LastToolbarWidth = sz.cx;
			rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = sz.cy + mn_ThemeHeightDiff;

			if (!SendMessage(mh_Rebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand))
			{
				DisplayLastError(_T("Can't initialize rebar (toolbar)"));
			}
		}
	}
	else
	{
		_ASSERTEX(!bShow);
		INT_PTR nPaneIndex = SendMessage(mh_Rebar, RB_IDTOINDEX, rbi_ToolBar, 0);
		if (nPaneIndex >= 0)
		{
			SendMessage(mh_Rebar, RB_DELETEBAND, nPaneIndex, 0);
			DestroyWindow(mh_Toolbar);
			mh_Toolbar = NULL;
		}
	}
}
Example #12
0
    BOOL CreateLayout()
    {
        bool b = TRUE;

        m_ClientPanel = new CUiPanel();
        m_ClientPanel->m_VerticalAlignment = UiAlign_Stretch;
        m_ClientPanel->m_HorizontalAlignment = UiAlign_Stretch;

        // Top level
        b = b && CreateStatusBar();
        b = b && CreateToolbar();
        b = b && CreateSearchBar();
        b = b && CreateVSplitter();

        // Inside V Splitter
        b = b && CreateHSplitter();
        b = b && CreateTreeView();

        // Inside H Splitter
        b = b && CreateListView();
        b = b && CreateRichEdit();

        if (b)
        {
            RECT rTop;
            RECT rBottom;

            /* Size status bar */
            m_StatusBar->SendMessage(WM_SIZE, 0, 0);

            /* Size tool bar */
            m_Toolbar->AutoSize();

            ::GetWindowRect(m_Toolbar->m_hWnd, &rTop);
            ::GetWindowRect(m_StatusBar->m_hWnd, &rBottom);

            m_VSplitter->m_Margin.top = rTop.bottom - rTop.top;
            m_VSplitter->m_Margin.bottom = rBottom.bottom-rBottom.top;
        }

        return b;
    }
PWBOBJ wbCreateToolbar(PWBOBJ pwboParent, PWBITEM pitem[], int nItems, int nBtnWidth, int nBtnHeight, HBITMAP hbm)
{
	int i;
	PWBOBJ pwbo;
	HWND hToolbar;

	if(!pwboParent || !pwboParent->hwnd || !IsWindow(pwboParent->hwnd))
		return NULL;

	// Create the toolbar

	hToolbar = CreateToolbar((HWND)pwboParent->hwnd, nItems, nBtnWidth, nBtnHeight, hbm);
	if(!hToolbar) {
		wbError(__FUNCTION__, MB_ICONWARNING, "Could not create toolbar");
		return NULL;
	}

	pwbo = wbMalloc(sizeof(WBOBJ));
	pwbo->hwnd = hToolbar;
	pwbo->id = 0;
	pwbo->uClass = ToolBar;
	pwbo->item = -1;
	pwbo->subitem = -1;
	pwbo->style = 0;
	pwbo->pszCallBackFn = NULL;
	pwbo->pszCallBackObj = NULL;
	pwbo->lparam = 0;
	pwbo->parent = pwboParent;

	for(i = 0; i < nItems; i++) {
		if(!pitem[i] || !pitem[i]->id)
			CreateToolbarButton(hToolbar, 0, i, NULL);				// Separator
		else
			CreateToolbarButton(hToolbar, pitem[i]->id, pitem[i]->index, pitem[i]->pszHint);
	}

	SetWindowLong(pwbo->hwnd, GWL_USERDATA, (LONG)pwbo);

	return pwbo;
}
Example #14
0
void gw_create_toolbar (GUI_WINDOW *gwp)

{
    RECT        rect;
#if _MSC_VER <= 900
    int         i;
#endif
    
    /* check that we can do it. */
    if (!o_toolbar (gwp))
        return;
    if (gwp->toolbarHWnd != NULL)
        return;

    /* get borders size */
    cxborder = GetSystemMetrics (SM_CXBORDER);
    cyborder = GetSystemMetrics (SM_CYBORDER);

    /* create the toolbar */
#if _MSC_VER > 900
    gwp->toolbarHWnd = CreateToolbarEx (gwp->frameHWnd,
                                       WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS,
                                       1, 15, hInst, IDT_ELVIS,
                                       buttons, 21, 16, 15, 15, 14,
                                       sizeof (TBBUTTON));
#else
    gwp->toolbarHWnd = CreateToolbar (gwp->frameHWnd,
                                     WS_CHILD | WS_VISIBLE,
                                     1, 15, hInst, IDT_ELVIS,
                                     buttons, 1);
    for (i = 1; i < 21; i++)
        SendMessage (gwp->toolbarHWnd, TB_ADDBUTTONS, 1, (LPARAM)&buttons[i]);
#endif

    /* size the toolbar */
    GetClientRect (gwp->frameHWnd, &rect);
    gw_size_toolbar (gwp, &rect);
}
Example #15
0
int WINAPI WinMain( HINSTANCE hInstance,
		    HINSTANCE hPreInstance,
		    LPSTR cmdLine,
		    int cmdShow ){

  HWND hWnd;
  WNDCLASSEX wc;

  wc.cbSize = sizeof(WNDCLASSEX);
  wc.style = CS_HREDRAW | CS_VREDRAW;
  wc.lpfnWndProc = WindowProc;
  wc.cbClsExtra = 0;
  wc.cbWndExtra = 0;
  wc.hInstance = hInstance;
  wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  wc.hbrBackground = NULL;
  wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
  wc.lpszClassName = g_windowClassName;
  wc.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));

  if( !RegisterClassEx(&wc) ){
    MessageBox( NULL, "Registration Failed!", "ERROR", 0 );
    return 0;
  }

  hWnd = CreateWindowEx( NULL,
			 g_windowClassName,
			 g_applicationName,
			 WS_OVERLAPPED | WS_VISIBLE | WS_CAPTION | WS_SYSMENU,
			 GetSystemMetrics(SM_CXSCREEN)/2 - WINDOWWIDTH/2,
			 GetSystemMetrics(SM_CYSCREEN)/2 - WINDOWHEIGHT/2,
			 WINDOWWIDTH,
			 WINDOWHEIGHT,
			 NULL,
			 NULL,
			 hInstance,
			 NULL );

  if( !hWnd ){
    MessageBox( NULL, "CreateWindow Failed!", "ERROR", 0 );
  }

  g_hwndToolbar = CreateToolbar( hWnd, hInstance );

  SendMessage( hWnd, UM_TOOLBAR_HAS_BEEN_CREATED, NULL, NULL );

  g_pathFinder->CreateGraph( NUMCELLSX, NUMCELLSY );

  MSG msg;
  while(GetMessage( &msg, NULL, 0, 0 )){
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }

  delete g_pathFinder;

  UnregisterClass( g_windowClassName, wc.hInstance );

  return msg.wParam;
}
Example #16
0
static BOOL CALLBACK CopyDlgProc ( HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam )
{  
	switch ( Msg )
	{
	case WM_INITDIALOG:
        {
			DlgTxt ( hDlg, IDC_TITLE, T_DLG_COPY_TITLE );
			DlgTxt ( hDlg, IDC_TO, T_DLG_TO );
			DlgTxt ( hDlg, IDC_COPY, T_TBAR_COPY );
			DlgTxt ( hDlg, IDC_MOVE, T_DLG_MOVE );
			DlgTxt ( hDlg, IDC_COPY_SHORTCUT, T_DLG_COPY_SHORTCUT );
			DlgTxt ( hDlg, IDCANCEL, T_TBAR_CANCEL );
			DlgTxt ( hDlg, IDC_TREE, T_CMN_TREE );

			HWND hTB = CreateToolbar ( hDlg, IDM_OK_CANCEL, 0, false );
			SetToolbarText ( hTB, IDOK, Txt ( T_TBAR_COPY ) );
			SetToolbarText ( hTB, IDCANCEL, Txt ( T_TBAR_CANCEL ) );

			g_hCombo = GetDlgItem ( hDlg, IDC_COPY_COMBO );

			SendMessage ( GetDlgItem ( hDlg, IDC_TITLE ), WM_SETFONT, (WPARAM)g_tResources.m_hBoldSystemFont, TRUE );

			PopulateCopyList ( g_hCombo, g_szDest );
			SetWindowText ( g_hCombo, g_szDest );
			SetCopyText ( GetDlgItem ( hDlg, IDC_COPY_TEXT ) );

			bool bCanShortcut = g_pList->m_dFiles.Length () == 1;
			if ( ! bCanShortcut )
				EnableWindow ( GetDlgItem ( hDlg, IDC_COPY_SHORTCUT ), FALSE );
        }
	    break;

    case WM_COMMAND:
		{
			int iCommand = LOWORD(wParam);
			if ( iCommand == IDOK )
				iCommand = IDC_COPY;

			switch ( iCommand )
			{
			case IDC_TREE:
				{
					GetWindowText ( g_hCombo, g_szDest, PATH_BUFFER_SIZE );
					Str_c sPath = g_szDest;
					if ( ShowDirTreeDlg ( hDlg, sPath ) )
						SetComboTextFocused ( g_hCombo, sPath );
				}
				break;
			case IDC_COPY:
			case IDC_COPY_SHORTCUT:
			case IDC_MOVE:
				GetWindowText ( g_hCombo, g_szDest, PATH_BUFFER_SIZE );
			case IDCANCEL:
				SipShowIM ( SIPF_OFF );
				EndDialog ( hDlg, iCommand );
				break;
			}
		}
		break;

	case WM_HELP:
		Help ( L"CopyMove" );
		return TRUE;
	}

	DWORD dwRes = HandleDlgColor ( hDlg, Msg, wParam, lParam );
	if ( dwRes )
		return dwRes;

	return MovingWindowProc ( hDlg, Msg, wParam, lParam );
}
Example #17
0
//-----------------------------------------------------------------------------
// NAME: FrameProc(HWND, unsigned, WORD, LONG)
// DESCRIPTION:  Processes messages for the main window.
//-----------------------------------------------------------------------------
LRESULT CALLBACK FrameProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message) 
    {   
        case WM_CREATE: // This happens when window is first created
        {
            CLIENTCREATESTRUCT ccs; 
 
            // Open the registry key we will be using
            g_reg.OpenKey(IMASM_REGISTRY_KEY);

            // Retrieve the handle to the window menu and assign the 
            // first child window identifier.  
            ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), 3); 
            ccs.idFirstChild = IDC_CHILDBASE; 
 
            // Create the MDI client window. 
            g_hMDIClient = CreateWindowEx(0,
                                        "MDICLIENT",
                                        (LPCTSTR)NULL,
                                        WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
                                        CW_USEDEFAULT,
                                        CW_USEDEFAULT,
                                        CW_USEDEFAULT,
                                        CW_USEDEFAULT,
                                        hWnd,
                                        (HMENU)IDC_CLIENT,
                                        g_hInst,
                                        (LPVOID)&ccs);  
            ShowWindow(g_hMDIClient, SW_SHOW); 

            // Create the file pane window
            g_pFP = new FilePane(hWnd);
    
            // Create the status bar
            g_hStatBar = CreateWindowEx(    0,
                                            STATUSCLASSNAME,
                                            NULL,
                                            WS_VISIBLE | WS_CHILD | SBARS_SIZEGRIP,
                                            CW_USEDEFAULT,
                                            CW_USEDEFAULT,
                                            CW_USEDEFAULT,
                                            CW_USEDEFAULT,
                                            hWnd,
                                            (HMENU)IDC_STATUS,
                                            g_hInst,
                                            0);

            CreateToolbar(hWnd);
    
            if (g_bAutoUpdate)
            {
                SendMessage(g_hToolBar, TB_SETSTATE, (WPARAM)IDC_AUTO, (LPARAM)(TBSTATE_ENABLED | TBSTATE_CHECKED));
            }

            // Fill up the popup structure
            HMENU hMenu = GetMenu(hWnd);
            HMENU hFile = GetSubMenu(hMenu, 0);
            HMENU hFormat = GetSubMenu(hMenu, 1);
            HMENU hProject = GetSubMenu(hMenu, 2);
            HMENU hWindow = GetSubMenu(hMenu, 3);
            HMENU hHelp = GetSubMenu(hMenu, 4);

            g_aPopup[0].hMenu = hMenu;
            g_aPopup[0].uiString = IDS_FILE_MENU;
            g_aPopup[1].hMenu = hFile;
            g_aPopup[1].uiString = IDS_FILE_MENU;
            g_aPopup[2].hMenu = hFormat;
            g_aPopup[2].uiString = IDS_FORMAT_MENU;
            g_aPopup[3].hMenu = hProject;
            g_aPopup[3].uiString = IDS_PROJECT_MENU;
            g_aPopup[4].hMenu = hWindow;
            g_aPopup[4].uiString = IDS_WINDOW_MENU;
            g_aPopup[5].hMenu = hHelp;
            g_aPopup[5].uiString = IDS_HELP_MENU;
            g_aPopup[6].hMenu = 0;
            g_aPopup[6].uiString = 0;
            
            return 0;
        }// WM_CREATE

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDC_NEW:
                    HandleIDC_NEW(g_hMDIClient);
                    break;
                    
                case IDC_OPEN:
                    HandleIDC_OPEN(g_hMDIClient);
                    break;

                case IDC_OPENPROJECT:
                    HandleIDC_OPENPROJECT(g_hMDIClient, g_pFP);
                    break;

                case IDC_SAVEAS:
                    if (HandleIDC_SAVEAS(g_hCurChild) == 0)
                    {
                        break;
                    }
                    // FALLTHROUGH:

                case IDC_SAVE:
                    HandleIDC_SAVE(g_hCurChild);
                    break;

                case IDC_FONT:
                    HandleIDC_FONT(g_hMDIClient);
                    break;

                case IDC_EXIT:
                    PostMessage(hWnd, WM_CLOSE, 0, 0);
                    break;

                case IDC_ABOUT:
                    DialogBoxParam( g_hInst,
                                    MAKEINTRESOURCE(IDD_ABOUT),
                                    hWnd,
                                    (DLGPROC)AboutProc,
                                    0);
                    break;

                case IDC_AUTO:
                {
                    DWORD dwState = SendMessage(g_hToolBar, TB_GETSTATE, (WPARAM)IDC_AUTO, 0);

                    if ((dwState & TBSTATE_CHECKED) != 0)
                    {
                        g_bAutoUpdate = true;
                        HighlightDoc(GetDlgItem(g_hCurChild, IDC_MAINRICHED));
                        SetTimer(hWnd, UPDATETIMER, 20000, NULL);
                    }
                    else
                    {
                        g_bAutoUpdate = false;
                        KillTimer(hWnd, UPDATETIMER);
                    }
                    break;
                }

                case IDC_PRECOMPILE:
                    HandleIDC_PRECOMPILE(g_hCurChild);
                    break;

                case IDC_CASCADE:
                    SendMessage(g_hMDIClient, WM_MDICASCADE, MDITILE_SKIPDISABLED, 0);
                    break;

                case IDC_TILEHORIZ:
                    SendMessage(g_hMDIClient, WM_MDITILE, MDITILE_HORIZONTAL | MDITILE_SKIPDISABLED, 0);
                    break;
                
                case IDC_TILEVERT:
                    SendMessage(g_hMDIClient, WM_MDITILE, MDITILE_VERTICAL | MDITILE_SKIPDISABLED, 0);
                    break;

                case IDC_PROJECTNEW:
                    HandleIDC_PROJECTNEW(hWnd, g_pFP);
                    break;

                case IDC_PROJECTADDSOURCE:
                    HandleIDC_PROJECTADDSOURCE(hWnd, g_pFP);
                    break;

                case IDC_PROJECTADDINCLUDE:
                    HandleIDC_PROJECTADDINCLUDE(hWnd, g_pFP);
                    break;

                case IDC_PROJECTADDOTHER:
                    HandleIDC_PROJECTADDOTHER(hWnd, g_pFP);
                    break;

                case IDC_PROJECTREMOVE:
                    HandleIDC_PROJECTREMOVE(hWnd, g_pFP);
                    break;
            }
            break;

        case WM_NOTIFY: 
        {
            LPNMHDR pHdr = (LPNMHDR)lParam;

            switch (pHdr->code) 
            { 
                case TTN_GETDISPINFO: 
                { 
                    LPTOOLTIPTEXT lpttt; 

                    lpttt = (LPTOOLTIPTEXT)lParam; 
                    lpttt->hinst = g_hInst; 

                    // Specify the resource identifier of the descriptive 
                    // text for the given button. 
                    switch (lpttt->hdr.idFrom) 
                    { 
                        case IDC_NEW: 
                            lpttt->lpszText = MAKEINTRESOURCE(IDS_NEW); 
                            break; 
                        case IDC_OPEN: 
                            lpttt->lpszText = MAKEINTRESOURCE(IDS_OPEN); 
                            break; 
                        case IDC_OPENPROJECT: 
                            lpttt->lpszText = MAKEINTRESOURCE(IDS_OPENPROJECT); 
                            break; 
                        case IDC_SAVE: 
                            lpttt->lpszText = MAKEINTRESOURCE(IDS_SAVE); 
                            break; 
                        case IDC_SAVEAS: 
                            lpttt->lpszText = MAKEINTRESOURCE(IDS_SAVEAS); 
                            break; 
                        case IDC_AUTO: 
                            lpttt->lpszText = MAKEINTRESOURCE(IDS_AUTO); 
                            break; 
                        case IDC_PRECOMPILE: 
                            lpttt->lpszText = MAKEINTRESOURCE(IDS_PRECOMPILE); 
                            break; 
                    } 
                    break; 
                }

                case NM_DBLCLK:
                case NM_RETURN:
                {
                    char szPath[MAX_PATH];

                    if (g_pFP->GetCurSelPath(szPath, MAX_PATH))
                    {
                        LoadFileIntoNewWindow(szPath);
                    }
                    break;
                }

                case TVN_KEYDOWN:
                {
                    NMTVKEYDOWN *pKD;

                    pKD = (NMTVKEYDOWN *)lParam;

                    if (pKD->wVKey == VK_DELETE)
                    {
                        g_pFP->RemoveSelected();
                    }
                    break;
                }
                
                default: 
                    break; 
            } 
            break;
        }

        case WM_MENUSELECT:
        {
            UINT uFlags = (UINT)HIWORD(wParam);
            HMENU hMain = NULL;
            UINT i = 0;

            if (uFlags & MF_SYSMENU) // Handle non-system popup menus
            {
                MenuHelp(WM_MENUSELECT, wParam, lParam, NULL, g_hInst, g_hStatBar, &i);
            }
            else if (uFlags & MF_POPUP)
            {
                MenuHelp(WM_MENUSELECT, wParam, lParam, GetMenu(hWnd), g_hInst, g_hStatBar, (UINT *)g_aPopup);
            }
            else
            {
                for (i = 1; i < iNumMenus; i++)
                {
                    if ((HMENU)lParam == g_aPopup[i].hMenu)
                    {
                        MenuHelp(WM_MENUSELECT, wParam, lParam, GetMenu(hWnd), g_hInst, g_hStatBar, (LPUINT)&g_aPopup[i].uiString);
                        break;
                    }
                }               
            }

            

            return 0;
        }

        case WM_CLOSE:
            DestroyChildren(g_hMDIClient);
            DestroyWindow(hWnd);
            break;
        
        case WM_SIZE:  // Get size of client
        {
            int iClientX = LOWORD(lParam);
            int iClientY = HIWORD(lParam);

            SendMessage(g_hToolBar, TB_AUTOSIZE, 0, 0);
            
            int aiParts[] = {iClientX - 210, iClientX - 110, iClientX - 80, iClientX - 50, iClientX - 20};
            SendMessage(g_hStatBar, SB_SETPARTS, (WPARAM)5, (LPARAM)aiParts);
            SendMessage(g_hStatBar, WM_SIZE, 0, 0);
            UpdateStatusBar(g_hCurChild);
            
            RECT rc;

            GetWindowRect(g_hToolBar, &rc);

            int cyTool = rc.bottom - rc.top;

            GetWindowRect(g_hStatBar, &rc);

            int cyStat = rc.bottom - rc.top;

            // Now resize the file pane
            int cxFilePane = iClientX / 5;
            g_pFP->Resize(0, cyTool, cxFilePane, iClientY - cyTool - cyStat);           

            // And resize the MDI Client window
            MoveWindow(g_hMDIClient, cxFilePane, cyTool, iClientX - cxFilePane, iClientY - cyTool - cyStat, TRUE);              
            
            // Do this on the first WM_SIZE message so the window is sized properly
            if (*g_szCmdLineFile != NUL)
            {   
                LoadFileIntoNewWindow(g_szCmdLineFile);
                *g_szCmdLineFile = NUL;
            }

            return 0; // WM_SIZE
        }
        
        case WM_DESTROY:            
            if (g_pFP)
            {
                delete g_pFP;
            }

            DoExitProcessing(hWnd);
            PostQuitMessage(0);         
            break; // WM_DESTROY

        default:    // Otherwise, let Windows process message       
            break;
   }// end switch

   return DefFrameProc(hWnd, g_hMDIClient, message, wParam, lParam);
}
Example #18
0
void CTabPanelWin::CreateRebar()
{
	RECT rcWnd = {-32000, -32000, -32000+300, -32000+100};
	if (ghWnd)
	{
		rcWnd = gpConEmu->GetGuiClientRect();
	}
	else
	{
		_ASSERTE(ghWnd!=NULL); // вроде ReBar для теста не создается.
	}

	gpSetCls->CheckTheming();

	if (NULL == (mh_Rebar = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL,
								(ghWnd ? (WS_VISIBLE | WS_CHILD) : 0)
								|WS_CLIPSIBLINGS|WS_CLIPCHILDREN
	                            |/*CCS_NORESIZE|*/CCS_NOPARENTALIGN
	                            |RBS_FIXEDORDER|RBS_AUTOSIZE|/*RBS_VARHEIGHT|*/CCS_NODIVIDER,
	                            0,0,rcWnd.right,16, ghWnd, NULL, g_hInstance, NULL)))
		return;

#if !defined(__GNUC__)
#pragma warning (disable : 4312)
#endif
	// Надо
	TabPanelWinMap map = {this}; //{ CTabPanelWin* object; HWND hWnd; WNDPROC defaultProc; };
	map.defaultProc = (WNDPROC)SetWindowLongPtr(mh_Rebar, GWLP_WNDPROC, (LONG_PTR)_ReBarProc);
	map.hWnd = mh_Rebar;
	gp_TabPanelWinMap->Set(mh_Rebar, map);


	REBARINFO     rbi = {sizeof(REBARINFO)};
	REBARBANDINFO rbBand = {80}; // не используем size, т.к. приходит "новый" размер из висты и в XP обламываемся

	if (!SendMessage(mh_Rebar, RB_SETBARINFO, 0, (LPARAM)&rbi))
	{
		DisplayLastError(_T("Can't initialize rebar!"));
		DestroyWindow(mh_Rebar);
		mh_Rebar = NULL;
		return;
	}

	rbBand.fMask  = RBBIM_SIZE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_ID | RBBIM_STYLE | RBBIM_COLORS;
	rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDSIZE | RBBS_VARIABLEHEIGHT;
	rbBand.clrBack = GetSysColor(COLOR_BTNFACE);
	rbBand.clrFore = GetSysColor(COLOR_BTNTEXT);
	SendMessage(mh_Rebar, RB_SETBKCOLOR, 0, GetSysColor(COLOR_BTNFACE));
	SendMessage(mh_Rebar, RB_SETWINDOWTHEME, 0, (LPARAM)L" ");
	CreateTabbar();
	CreateToolbar();
	SIZE sz = {0,0};

	if (mh_Toolbar)
	{
		SendMessage(mh_Toolbar, TB_GETMAXSIZE, 0, (LPARAM)&sz);
	}
	else
	{
		RECT rcClient = gpConEmu->GetGuiClientRect();
		TabCtrl_AdjustRect(mh_Tabbar, FALSE, &rcClient);
		sz.cy = rcClient.top - 3 - mn_ThemeHeightDiff;
	}

	if (mh_Tabbar)
	{
		// Set values unique to the band with the toolbar.
		rbBand.wID          = 1;
		rbBand.hwndChild  = mh_Tabbar;
		rbBand.cxMinChild = 100;
		rbBand.cx = rbBand.cxIdeal = rcWnd.right - sz.cx - 80;
		rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = mn_TabHeight; // sz.cy;

		if (!SendMessage(mh_Rebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand))
		{
			DisplayLastError(_T("Can't initialize rebar (tabbar)"));
		}
	}

	if (mh_Toolbar)
	{
		// Set values unique to the band with the toolbar.
		rbBand.wID        = 2;
		rbBand.hwndChild  = mh_Toolbar;
		rbBand.cx = rbBand.cxMinChild = rbBand.cxIdeal = mn_LastToolbarWidth = sz.cx;
		rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = sz.cy + mn_ThemeHeightDiff;

		// Add the band that has the toolbar.
		if (!SendMessage(mh_Rebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand))
		{
			DisplayLastError(_T("Can't initialize rebar (toolbar)"));
		}

		//if (mn_ThemeHeightDiff) {
		//	POINT pt = {0,0};
		//	MapWindowPoints(mh_Toolbar, mh_Rebar, &pt, 1);
		//	pt.y = 0;
		//	SetWindowPos(mh_Toolbar, NULL, pt.x, pt.y, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
		//}
	}

#ifdef _DEBUG
	RECT rc;
	GetWindowRect(mh_Rebar, &rc);
#endif
	//GetWindowRect(mh_Rebar, &rc);
	//mn_TabHeight = rc.bottom - rc.top;
	//if (gpSet->nTabsLocation == 1)
	//	m_Margins = MakeRect(0,0,0,mn_TabHeight);
	//else
	//	m_Margins = MakeRect(0,mn_TabHeight,0,0);
	//gpSet->UpdateMargins(m_Margins);
	//_hwndTab = mh_Rebar; // пока...
}
void CManageBookmarksDialog::SetupToolbar()
{
	m_hToolbar = CreateToolbar(m_hDlg,
		WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|
		TBSTYLE_TOOLTIPS|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|
		TBSTYLE_FLAT|CCS_NODIVIDER|CCS_NORESIZE,
		TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DRAWDDARROWS|
		TBSTYLE_EX_DOUBLEBUFFER|TBSTYLE_EX_HIDECLIPPEDBUTTONS);

	SendMessage(m_hToolbar,TB_SETBITMAPSIZE,0,MAKELONG(16,16));
	SendMessage(m_hToolbar,TB_BUTTONSTRUCTSIZE,static_cast<WPARAM>(sizeof(TBBUTTON)),0);

	m_himlToolbar = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48);
	HBITMAP hBitmap = LoadBitmap(GetInstance(),MAKEINTRESOURCE(IDB_SHELLIMAGES));
	ImageList_Add(m_himlToolbar,hBitmap,NULL);
	DeleteObject(hBitmap);
	SendMessage(m_hToolbar,TB_SETIMAGELIST,0,reinterpret_cast<LPARAM>(m_himlToolbar));

	TBBUTTON tbb;
	TCHAR szTemp[64];

	tbb.iBitmap		= SHELLIMAGES_BACK;
	tbb.idCommand	= TOOLBAR_ID_BACK;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE;
	tbb.dwData		= 0;
	SendMessage(m_hToolbar,TB_INSERTBUTTON,0,reinterpret_cast<LPARAM>(&tbb));

	tbb.iBitmap		= SHELLIMAGES_FORWARD;
	tbb.idCommand	= TOOLBAR_ID_FORWARD;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE;
	tbb.dwData		= 0;
	SendMessage(m_hToolbar,TB_INSERTBUTTON,1,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_ORGANIZE,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_COPY;
	tbb.idCommand	= TOOLBAR_ID_ORGANIZE;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,2,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_VIEWS,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_VIEWS;
	tbb.idCommand	= TOOLBAR_ID_VIEWS;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,3,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_IMPORTEXPORT,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_PROPERTIES;
	tbb.idCommand	= TOOLBAR_ID_IMPORTEXPORT;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,4,reinterpret_cast<LPARAM>(&tbb));

	RECT rcTreeView;
	GetWindowRect(GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_TREEVIEW),&rcTreeView);
	MapWindowPoints(HWND_DESKTOP,m_hDlg,reinterpret_cast<LPPOINT>(&rcTreeView),2);

	RECT rcSearch;
	GetWindowRect(GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_EDITSEARCH),&rcSearch);
	MapWindowPoints(HWND_DESKTOP,m_hDlg,reinterpret_cast<LPPOINT>(&rcSearch),2);

	DWORD dwButtonSize = static_cast<DWORD>(SendMessage(m_hToolbar,TB_GETBUTTONSIZE,0,0));
	SetWindowPos(m_hToolbar,NULL,rcTreeView.left,rcSearch.top - (HIWORD(dwButtonSize) - GetRectHeight(&rcSearch)) / 2,
		rcSearch.left - rcTreeView.left - 10,HIWORD(dwButtonSize),0);
}
Example #20
0
INT main(VOID)
{
	HAB hab;
	HMQ hmq;
	QMSG qmsg;
    HWND hwndFrame;
    HWND hwndTb;
    SWP swp;

    hab = WinInitialize(0);

    if(!hab)
    {
        return -1;
    }

    hmq = WinCreateMsgQueue(hab, 0);

    if(!hmq)
    {
        WinTerminate(hab);
        return -2;
    }

    ToolkitInit(hab);

    WinQueryWindowPos(HWND_DESKTOP, &swp);

    hwndFrame = CreateCell(&mainClient, HWND_DESKTOP, 0);
    if(hwndFrame)
    {
        HWND hwndSubframe = CellWindowFromID(hwndFrame, ID_LPANE);

        WinSetWindowPos(hwndFrame, NULLHANDLE,
        	            swp.x + swp.cx / 8,
            	        swp.y + swp.cy / 8,
                	    (swp.cx / 4) * 3,
                    	(swp.cy / 4) * 3,
	                    SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW);


        CreateToolbar(hwndFrame, &mainTb);
        CreateToolbar(hwndFrame, &mainTb1);
        CreateToolbar(hwndFrame, &mainTb2);
        CreateToolbar(hwndFrame, &mainTb3);
        CreateToolbar(hwndFrame, &mainTb4);

        if(hwndSubframe)
            CreateToolbar(hwndSubframe, &mainTb5);

        while (WinGetMsg(hab, &qmsg, 0, 0, 0))
        	WinDispatchMsg(hab, &qmsg);

        WinDestroyWindow(hwndFrame);
    }

	WinDestroyMsgQueue(hmq);
	WinTerminate(hab);

    return 0;
}
Example #21
0
long FAR PASCAL 
WinWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HICON hIcon;
	FARPROC lpDlg = (FARPROC)NULL;
	LPNMHDR pnmh;

	pnmh = (LPNMHDR) lParam; 

	switch (message) {
	case WM_CREATE:
		hInstance = ( ( LPCREATESTRUCT )lParam )->hInstance;
		InitCommonControls();
        CreateToolbar(hWnd);
		CreateStatusBar(hWnd);
		break;
	case WM_MENUSELECT:
		GetMenuSelect (hWndStatus, message, wParam, lParam);
		break;
	case WM_NOTIFY:
		switch (pnmh->code)
		{
			case TTN_NEEDTEXT:
				GetToolTipText((LPTOOLTIPTEXT)lParam);
				break;
			default:
				return (DefWindowProc(hWnd, message, 
					wParam, lParam));
		}	
		break;
	case WM_COMMAND:
        	switch (wParam) {
        	case IDM_ABOUT:
               		hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
	       		    ShellAbout(hWnd, Program, Title, hIcon);
               		DestroyIcon(hIcon);
               		break;
	    	case IDM_UPDOWN:
               		if ( DialogBox ( hInstance, MAKEINTRESOURCE 
					( IDD_UPDOWNTEST ), hWnd,
                     			(DLGPROC)UpDownProc ) == -1 )
                       		MessageBox ( hWnd, "Dialog Failed", "Error", 
						MB_OK);
	       	    	break;
			case IDM_PROPSHEET:
					CreatePropSheet(hWnd);
					break;
			case IDM_EXIT:
	       		DestroyWindow(hWnd);
	       		break;
          	 }
	break;
	case WM_SIZE:
       		SendMessage(hWndToolbar, message, wParam, lParam);
     		SendMessage(hWndStatus, message, wParam, lParam);
       		switch (wParam) {
       		case SIZEICONIC:
	    		MessageBeep(0);
           	}
           	break;
    	    case WM_DESTROY:
       		    PostQuitMessage(0);
        	    break;
	default:
        	return (DefWindowProc(hWnd, message, wParam, lParam));
	}
	return (0);
}
Example #22
0
LRESULT CALLBACK CMainWindow::WinMsgHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    if (uMsg == TaskBarButtonCreated)
    {
        SetUUIDOverlayIcon(hwnd);
    }
    switch (uMsg)
    {
    case WM_CREATE:
        {
            m_hwnd = hwnd;
            picWindow1.RegisterAndCreateWindow(hwnd);
            picWindow2.RegisterAndCreateWindow(hwnd);
            if (selectionPaths.empty())
            {
                picWindow1.SetPic(leftpicpath, leftpictitle, true);
                picWindow2.SetPic(rightpicpath, rightpictitle, false);

                picWindow1.SetOtherPicWindow(&picWindow2);
                picWindow2.SetOtherPicWindow(&picWindow1);
            }
            else
            {
                picWindow3.RegisterAndCreateWindow(hwnd);

                picWindow1.SetPic(selectionPaths[FileTypeMine], selectionTitles[FileTypeMine], false);
                picWindow2.SetPic(selectionPaths[FileTypeBase], selectionTitles[FileTypeBase], false);
                picWindow3.SetPic(selectionPaths[FileTypeTheirs], selectionTitles[FileTypeTheirs], false);
            }

            picWindow1.SetSelectionMode(!selectionPaths.empty());
            picWindow2.SetSelectionMode(!selectionPaths.empty());
            picWindow3.SetSelectionMode(!selectionPaths.empty());

            CreateToolbar();
            // center the splitter
            RECT rect;
            GetClientRect(hwnd, &rect);
            if (selectionPaths.size() != 3)
            {
                nSplitterPos = (rect.right-rect.left)/2;
                nSplitterPos2 = 0;
            }
            else
            {
                nSplitterPos = (rect.right-rect.left)/3;
                nSplitterPos2 = (rect.right-rect.left)*2/3;
            }

            PositionChildren(&rect);
            picWindow1.FitImageInWindow();
            picWindow2.FitImageInWindow();
            picWindow3.FitImageInWindow();
        }
        break;
    case WM_COMMAND:
        {
            return DoCommand(LOWORD(wParam), lParam);
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc;
            RECT rect;

            ::GetClientRect(*this, &rect);
            hdc = BeginPaint(hwnd, &ps);
            SetBkColor(hdc, GetSysColor(COLOR_3DFACE));
            ::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
            EndPaint(hwnd, &ps);
        }
        break;
    case WM_GETMINMAXINFO:
        {
            MINMAXINFO * mmi = (MINMAXINFO*)lParam;
            mmi->ptMinTrackSize.x = WINDOW_MINWIDTH;
            mmi->ptMinTrackSize.y = WINDOW_MINHEIGHT;
            return 0;
        }
        break;
    case WM_SIZE:
        {
            RECT rect;
            GetClientRect(hwnd, &rect);
            if (bVertical)
            {
                RECT tbRect;
                GetWindowRect(hwndTB, &tbRect);
                LONG tbHeight = tbRect.bottom-tbRect.top-1;
                if (selectionPaths.size() != 3)
                {
                    nSplitterPos = (rect.bottom-rect.top)/2+tbHeight;
                    nSplitterPos2 = 0;
                }
                else
                {
                    nSplitterPos = (rect.bottom-rect.top)/3+tbHeight;
                    nSplitterPos2 = (rect.bottom-rect.top)*2/3+tbHeight;
                }
            }
            else
            {
                if (selectionPaths.size() != 3)
                {
                    nSplitterPos = (rect.right-rect.left)/2;
                    nSplitterPos2 = 0;
                }
                else
                {
                    nSplitterPos = (rect.right-rect.left)/3;
                    nSplitterPos2 = (rect.right-rect.left)*2/3;
                }
            }
            PositionChildren(&rect);
        }
        break;
    case WM_SETCURSOR:
        {
            if ((HWND)wParam == *this)
            {
                RECT rect;
                POINT pt;
                GetClientRect(*this, &rect);
                GetCursorPos(&pt);
                ScreenToClient(*this, &pt);
                if (PtInRect(&rect, pt))
                {
                    if (bVertical)
                    {
                        HCURSOR hCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS));
                        SetCursor(hCur);
                    }
                    else
                    {
                        HCURSOR hCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE));
                        SetCursor(hCur);
                    }
                    return TRUE;
                }
            }
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
        }
        break;
    case WM_LBUTTONDOWN:
        Splitter_OnLButtonDown(hwnd, uMsg, wParam, lParam);
        break;
    case WM_LBUTTONUP:
        Splitter_OnLButtonUp(hwnd, uMsg, wParam, lParam);
        break;
    case WM_CAPTURECHANGED:
        Splitter_CaptureChanged();
        break;
    case WM_MOUSEMOVE:
        Splitter_OnMouseMove(hwnd, uMsg, wParam, lParam);
        break;
    case WM_MOUSEWHEEL:
        {
            // find out if the mouse cursor is over one of the views, and if
            // it is, pass the mouse wheel message to that view
            POINT pt;
            DWORD ptW = GetMessagePos();
            pt.x = GET_X_LPARAM(ptW);
            pt.y = GET_Y_LPARAM(ptW);
            RECT rect;
            GetWindowRect(picWindow1, &rect);
            if (PtInRect(&rect, pt))
            {
                picWindow1.OnMouseWheel(GET_KEYSTATE_WPARAM(wParam), GET_WHEEL_DELTA_WPARAM(wParam));
            }
            else
            {
                GetWindowRect(picWindow2, &rect);
                if (PtInRect(&rect, pt))
                {
                    picWindow2.OnMouseWheel(GET_KEYSTATE_WPARAM(wParam), GET_WHEEL_DELTA_WPARAM(wParam));
                }
                else
                {
                    GetWindowRect(picWindow3, &rect);
                    if (PtInRect(&rect, pt))
                    {
                        picWindow3.OnMouseWheel(GET_KEYSTATE_WPARAM(wParam), GET_WHEEL_DELTA_WPARAM(wParam));
                    }
                }
            }
        }
        break;
    case WM_MOUSEHWHEEL:
        {
            // find out if the mouse cursor is over one of the views, and if
            // it is, pass the mouse wheel message to that view
            POINT pt;
            DWORD ptW = GetMessagePos();
            pt.x = GET_X_LPARAM(ptW);
            pt.y = GET_Y_LPARAM(ptW);
            RECT rect;
            GetWindowRect(picWindow1, &rect);
            if (PtInRect(&rect, pt))
            {
                picWindow1.OnMouseWheel(GET_KEYSTATE_WPARAM(wParam)|MK_SHIFT, GET_WHEEL_DELTA_WPARAM(wParam));
            }
            else
            {
                GetWindowRect(picWindow2, &rect);
                if (PtInRect(&rect, pt))
                {
                    picWindow2.OnMouseWheel(GET_KEYSTATE_WPARAM(wParam)|MK_SHIFT, GET_WHEEL_DELTA_WPARAM(wParam));
                }
                else
                {
                    GetWindowRect(picWindow3, &rect);
                    if (PtInRect(&rect, pt))
                    {
                        picWindow3.OnMouseWheel(GET_KEYSTATE_WPARAM(wParam)|MK_SHIFT, GET_WHEEL_DELTA_WPARAM(wParam));
                    }
                }
            }
        }
        break;
    case WM_NOTIFY:
        {
            LPNMHDR pNMHDR = (LPNMHDR)lParam;
            if (pNMHDR->code == TTN_GETDISPINFO)
            {
                LPTOOLTIPTEXT lpttt;

                lpttt = (LPTOOLTIPTEXT) lParam;
                lpttt->hinst = hResource;

                // Specify the resource identifier of the descriptive
                // text for the given button.
                TCHAR stringbuf[MAX_PATH] = {0};
                MENUITEMINFO mii;
                mii.cbSize = sizeof(MENUITEMINFO);
                mii.fMask = MIIM_TYPE;
                mii.dwTypeData = stringbuf;
                mii.cch = _countof(stringbuf);
                GetMenuItemInfo(GetMenu(*this), (UINT)lpttt->hdr.idFrom, FALSE, &mii);
                _tcscpy_s(lpttt->lpszText, 80, stringbuf);
            }
        }
        break;
    case WM_DESTROY:
        bWindowClosed = TRUE;
        PostQuitMessage(0);
        break;
    case WM_CLOSE:
        ImageList_Destroy(hToolbarImgList);
        ::DestroyWindow(m_hwnd);
        break;
    default:
        return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }

    return 0;
};
Example #23
0
BOOL CreateWinGHCiMainWindow(INT nCmdShow)
{
	//hWndMain = CreateDialog(hThisInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, &MainWndProc);

	
	if (!RegisterWinGHCiWindowClass(hThisInstance) )
	{	
		ErrorExit(TEXT("Could not register WinGHCiWindowClass"));
		return FALSE;
	}

	hWndMain = CreateWindowEx(WS_EX_ACCEPTFILES,WinGHCiWindowClass, WinGHCiWindowTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hThisInstance, NULL);



	if (!hWndMain)
	{	
		ErrorExit(TEXT("CreateWinGHCiMainWindow"));
		return FALSE;
	}

    ShowWindow(hWndMain, nCmdShow);
    UpdateWindow(hWndMain);

	// Setup the icons
	SendMessage(hWndMain, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hThisInstance, MAKEINTRESOURCE(ID_GHCi_ICON)));	
	SendMessage(hWndMain, WM_SETICON, ICON_BIG,	(LPARAM) LoadIcon(hThisInstance, MAKEINTRESOURCE(ID_WinGHCi_ICON)));

	// Create status line
	hWndStatus = CreateWindowEx(
		0,                       
		STATUSCLASSNAME,        
		(LPCTSTR) TEXT(""),          
		WS_CHILD | SBARS_SIZEGRIP | WS_VISIBLE,               
		0, 0, 0, 0,              
		hWndMain,              
		(HMENU) IDC_Statusbar,      
		hThisInstance,                   
		NULL);                   


	// create rich edit control
	hWndRtf = CreateWindowEx(
		 WS_EX_CLIENTEDGE,
		 RICHEDIT_CLASS,        
		(LPCTSTR) TEXT(""),          
		WS_CHILD  | WS_VISIBLE | WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_DISABLENOSCROLL | ES_WANTRETURN,               
		0, 0, 0, 0,              
		hWndMain,              
		(HMENU) IDC_Rtf,      
		hThisInstance,                   
		NULL);   

	RtfWindowInit();
	SetFocus(hWndRtf);

	CreateToolbar();
	InitMruFiles();
	InitHistory();

	RegistryReadWindowPos(hWndMain);


	return TRUE;
}