BOOL CInfoShowDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_anchar.Init(GetSafeHwnd());

	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |
		CBRS_TOOLTIPS | CBRS_ALIGN_TOP, CRect(4, 4, 0, 0)) ||
		!m_wndToolBar.LoadToolBar(IDR_TB_INFO_SHOW))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}
	
	m_wndToolBar.LoadTrueColorToolBar(16, 16, IDB_DEBUG_TOOLBAR, IDB_DEBUG_TOOLBAR);
	
	m_wndToolBar.SetButtonStyle(1, TBBS_CHECKBOX);
	//	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
	CRect rcClientStart;
	CRect rcClientNow;
	GetClientRect(rcClientStart);
	//取得对话框客户区的矩形区域大小存于rcClientStart当中
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNow);
	//上面创建了工具栏所以调整一次工具栏的默认高度就是30(经测量得出的结论),前面已经创建了一个工具栏,
	// 并通过 RepositionBars进行了调整所以客户区rcClientNow矮了30
	
	CPoint ptOffset(rcClientNow.left-rcClientStart.left, rcClientNow.top-rcClientStart.top); 
	CRect rcChild;      //用来保存子窗口的矩形区域大小                          
	CWnd* pwndChild = GetWindow(GW_CHILD);//取得CWnd第一个子窗口的指针
	while (pwndChild)
	{ //循环将所有的子窗口重新调整其位置                             
		pwndChild->GetWindowRect(rcChild);//取得句柄所对应子窗口的矩形坐标(屏幕坐标)存入rcChild
		ScreenToClient(rcChild);//将屏幕坐标转化为窗客户坐标
		rcChild.OffsetRect(ptOffset);//将矩形rcChild按照ptOffset进行偏移计算
		pwndChild->MoveWindow(rcChild, FALSE);//将子窗口移动到rcChild处
		pwndChild = pwndChild->GetNextWindow();//取得下一个子窗口的指针
	}
	///////////////下面将对话框大小重整////////////////////////////////////////////////////////
	CRect rcWindow;
	GetWindowRect(rcWindow);//取得窗口的屏幕矩形坐标,包含标题栏与边框在内
	rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
	rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
	MoveWindow(rcWindow, FALSE);
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);//将控件重排一次,改动了对话框的大小,再调整一次控件的位置,否则控件就不见啦
    CenterWindow();

	// 增加显示日志的控件的锚点,尺寸跟着父窗口的变化而变化
	m_anchar.Add(IDC_LIST_INFO_SHOW_LOG, ANCHOR_ALL);

	return TRUE; // return TRUE unless you set the focus to a control
                     // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 2
0
void DialogBehaviorTreeEditor::OnSize( UINT nType, int cx, int cy )
{
	CRect rcClient;
	GetClientRect(rcClient);

	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposDefault, 0, rcClient);
	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, rcClient, rcClient);

	HDWP hdwp = BeginDeferWindowPos(1);
	DeferWindowPos(hdwp, m_pView->GetSafeHwnd(), nullptr, rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), SWP_NOZORDER);
	EndDeferWindowPos(hdwp);
}
Exemplo n.º 3
0
void COleIPFrameWnd::RecalcLayout(BOOL /*bNotify*/)
{
	ASSERT_VALID(this);

	// better have a parent window (only used for inplace)
	CWnd* pParentWnd = GetParent();
	ASSERT_VALID(pParentWnd);

	// first call reposition bars with arbitarily large rect just to
	//  see how much space the bars will take up
	CRect rectBig(0, 0, INT_MAX/2, INT_MAX/2);
	CRect rectLeft;
	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery,
		&rectLeft, &rectBig);

	// grow the rect by the size of the control bars
	CRect rect = m_rectPos;
	rect.left -= rectLeft.left;
	rect.top -= rectLeft.top;
	rect.right += INT_MAX/2 - rectLeft.right;
	rect.bottom += INT_MAX/2 - rectLeft.bottom;

	// see how much extra space for non-client areas (such as scrollbars)
	//  that the view needs.
	CWnd* pLeftOver = GetDlgItem(AFX_IDW_PANE_FIRST);
	if (pLeftOver != NULL)
	{
		rectBig = m_rectPos;
		pLeftOver->CalcWindowRect(&rectBig, CWnd::adjustOutside);
		rect.left -= m_rectPos.left - rectBig.left;
		rect.top -= m_rectPos.top - rectBig.top;
		rect.right += rectBig.right - m_rectPos.right;
		rect.bottom += rectBig.bottom - m_rectPos.bottom;
	}

	// adjust for non-client area on the frame window
	CalcWindowRect(&rect, CWnd::adjustOutside);

	// the frame window must be clipped to the visible part in the container
	CRect rectVis;
	rectVis.IntersectRect(&rect, &m_rectClip);

	// move the window
	AfxRepositionWindow(NULL, m_hWnd, &rectVis);

	// now resize the control bars relative to the (now moved) frame
	pParentWnd->ClientToScreen(&rect);
	ScreenToClient(&rect);
	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST,
		CWnd::reposDefault, NULL, &rect);
}
Exemplo n.º 4
0
void CMainFrame::OnMenuFullscreen()
{
	// TODO: Add your command handler code here

	if(!m_bFullScreen){
		GetWindowPlacement(&m_OldWndPlacement);
		CRect WindowRect;
		GetWindowRect(&WindowRect);
		CRect ClientRect;
		RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &ClientRect);
		ClientToScreen(&ClientRect);
		//获取屏幕的分辨率
		int nFullWidth=GetSystemMetrics(SM_CXSCREEN);
		int nFullHeight=GetSystemMetrics(SM_CYSCREEN);
		//将除控制条外的客户区全屏显示到从(0,0)到(nFullWidth, nFullHeight)区域, 将(0,0)和(nFullWidth, nFullHeight)两个点外扩充原窗口和除控制条之外的客户区位置间的差值, 就得到全屏显示的窗口位置
		m_FullScreenRect.left=WindowRect.left-ClientRect.left;
		m_FullScreenRect.top=WindowRect.top-ClientRect.top;
		m_FullScreenRect.right=WindowRect.right-ClientRect.right+nFullWidth;
		m_FullScreenRect.bottom=WindowRect.bottom-ClientRect.bottom+nFullHeight;
		m_bFullScreen=TRUE; //设置全屏显示标志为 TRUE
							//进入全屏显示状态
		WINDOWPLACEMENT wndpl;
		wndpl.length=sizeof(WINDOWPLACEMENT);
		wndpl.flags=0;
		wndpl.showCmd=SW_SHOWNORMAL;
		wndpl.rcNormalPosition=m_FullScreenRect;
		SetWindowPlacement(&wndpl);

	}
}
Exemplo n.º 5
0
void WindowSelector::Init( SelectCallback cbSelect,
                           PlotsCallback minPlotsCallback,
                           TilePlotsCallback tilePlotsCallback)
{
    m_cbSelect = cbSelect;
    m_minPlotsCallback = minPlotsCallback;
    m_tilePlotsCallback = tilePlotsCallback;
    VERIFY(m_bmpPinned.LoadBitmap(IDB_PP_PINNED));
    VERIFY(m_bmpUnpinned.LoadBitmap(IDB_PP_UNPINNED));

    LPCTSTR lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
                                            ::LoadCursor(NULL, IDC_ARROW),
                                            HBRUSH(COLOR_BTNFACE+1),
                                            NULL);
    int xScreen = ::GetSystemMetrics(SM_CXFULLSCREEN);
    int yScreen = ::GetSystemMetrics(SM_CYFULLSCREEN);
    CRect rect(xScreen-120, 0, xScreen, 220);

    VERIFY(CWnd::CreateEx(WS_EX_PALETTEWINDOW|WS_EX_TOOLWINDOW,
                          lpszClass,
                          "Window List",
                          WS_POPUPWINDOW|WS_CAPTION|WS_THICKFRAME,
                          rect,
                          NULL,
                          0));

    if (!m_wndToolBar.Create(this)
        //if (!m_wndToolBar.CreateEx(this)
        || !m_wndToolBar.LoadToolBar(IDR_WINDOW_SELECTOR_TOOLBAR))
        {
            TRACE0("Failed to create toolbar\n");
        }
    m_wndToolBar.SetHeight(10);

    m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
                             CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_SIZE_DYNAMIC );
    if (projectUtilities::IsWindows2000()) {
        w2KDll.Load();
        if (!w2KDll.IsLoaded()) {
            m_wndToolBar.GetToolBarCtrl().HideButton(ID_TOGGLE_TRANSPARENCY, true);
        } else {
            if (projectUtilities::GetTransparent()) {
                ToggleTransparency(projectUtilities::GetAlpha());
            }
        }
    } else {
        m_wndToolBar.GetToolBarCtrl().HideButton(ID_TOGGLE_TRANSPARENCY, true);
    }

    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

    VERIFY(m_list.Create(WS_CHILD|WS_VISIBLE|WS_BORDER
                         |LVS_REPORT|LVS_NOCOLUMNHEADER|LVS_SHOWSELALWAYS|LVS_SINGLESEL,
                         rect,
                         this,
                         ID_SELECTION_LIST));
    VERIFY(m_list.InsertColumn(0, "", LVCFMT_LEFT, rect.Width()-4) != -1);
    Redraw();
    m_bInit = true;
}
Exemplo n.º 6
0
void CRemoteCmdDlg::DlgInit()
{
	m_checkRun.SetCheck(BST_CHECKED);

	m_ComboxIcon.InsertString(0, TYPE_ICON_NORMAL);
	m_ComboxIcon.InsertString(1, TYPE_ICON_QUERY);
	m_ComboxIcon.InsertString(2, TYPE_ICON_WARNING);
	m_ComboxIcon.InsertString(3, TYPE_ICON_ERROR);
	m_ComboxIcon.SetCurSel(0);  //设置默认选项

	m_ComboxButton.InsertString(0, TYPE_BTN_1);
	m_ComboxButton.InsertString(1, TYPE_BTN_2);
	m_ComboxButton.InsertString(2, TYPE_BTN_3);
	m_ComboxButton.InsertString(3, TYPE_BTN_4);
	m_ComboxButton.InsertString(4, TYPE_BTN_5);
	m_ComboxButton.InsertString(5, TYPE_BTN_6);
	m_ComboxButton.SetCurSel(0);  //设置默认选项

	m_StatusBar.Create(this);   //状态栏
	m_StatusBar.SetIndicators(idArray, sizeof(idArray) / sizeof(UINT));
	m_StatusBar.SetPaneInfo(0, idArray[0], SBPS_NORMAL, 400);
	m_StatusBar.SetPaneInfo(1, idArray[1], SBPS_NORMAL, 200);
	m_StatusBar.SetPaneText(0 , _T("就绪"));
	m_StatusBar.SetPaneText(1 , _T(""));
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);  //显示工具栏和状态栏(这句话一定要加上, 否则工具栏不显示)
}
Exemplo n.º 7
0
BOOL CCalculationCtrlPage::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    m_currentItemIdx = -1;
    m_voltageRadio.SetCheck(TRUE);
    m_resultListView.SetDataSource(&m_viewItems);

    m_circuitryCombo.AddString(_T("Parallel"));
    m_circuitryCombo.AddString(_T("Series"));
    m_circuitryCombo.SetCurSel(0);

    m_bar.Create(this); //Status bar
    UINT BASED_CODE indicators[] = { ID_STATUS};
    m_bar.SetIndicators(indicators,1); //Anzahl panes
    CRect rect;
    GetClientRect(&rect);
    m_bar.SetPaneInfo(0,ID_STATUS, SBPS_NORMAL,rect.Width());
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, ID_STATUS);

    //m_searchValueEdit.SubclassDlgItem(IDC_CALCULATIONPAGE_LOADVALUE_EDIT, this);
    m_searchValueEdit.DragAcceptFiles(TRUE);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 8
0
void CResizableFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) 
{
	MinMaxInfo(lpMMI);

	CView* pView = GetActiveView();
	if (pView == NULL)
		return;

	// get the extra size from view to frame
	CRect rectClient, rectWnd;
	GetWindowRect(rectWnd);
	RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST, reposQuery, rectClient);
	CSize sizeExtra = rectWnd.Size() - rectClient.Size();

	// ask the view for track size
	MINMAXINFO mmiView = *lpMMI;
	pView->SendMessage(WM_GETMINMAXINFO, 0, (LPARAM)&mmiView);
	mmiView.ptMaxTrackSize = sizeExtra + mmiView.ptMaxTrackSize;
	mmiView.ptMinTrackSize = sizeExtra + mmiView.ptMinTrackSize;

	// min size is the largest
	lpMMI->ptMinTrackSize.x = __max(lpMMI->ptMinTrackSize.x,
		mmiView.ptMinTrackSize.x);
	lpMMI->ptMinTrackSize.y = __max(lpMMI->ptMinTrackSize.y,
		mmiView.ptMinTrackSize.y);

	// max size is the shortest
	lpMMI->ptMaxTrackSize.x = __min(lpMMI->ptMaxTrackSize.x,
		mmiView.ptMaxTrackSize.x);
	lpMMI->ptMaxTrackSize.y = __min(lpMMI->ptMaxTrackSize.y,
		mmiView.ptMaxTrackSize.y);
}
Exemplo n.º 9
0
void CMainFrame::FullScreen()
{
	if(m_bFullScreen)
	{
		return;
	}
 	CRect windowRect;
 	GetWindowRect(&windowRect);
 	m_windowRect=windowRect;
 	CRect ClientRect;
 	//参见相关文档关于RepositionBars的用法
 	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery,&ClientRect);
 	ClientToScreen(ClientRect);
	//获取屏幕尺寸
	int nFullWidth=GetSystemMetrics(SM_CXSCREEN);
	int nFullHeight=GetSystemMetrics(SM_CYSCREEN);

	m_FullScreenRect.left = windowRect.left - ClientRect.left;
	m_FullScreenRect.top = windowRect.top - ClientRect.top;
	m_FullScreenRect.right = nFullWidth;//windowRect.right - ClientRect.right + nFullWidth;
	m_FullScreenRect.bottom = nFullHeight;//windowRect.bottom - ClientRect.bottom + nFullHeight;
	m_bFullScreen = TRUE;
/*
	WINDOWPLACEMENT wndpl;
	wndpl.length=sizeof(WINDOWPLACEMENT);
	wndpl.flags=0;
	wndpl.showCmd=SW_SHOWNORMAL;
	wndpl.rcNormalPosition=m_FullScreenRect;
	//设置窗口的状态及最大、小的位置
	SetWindowPlacement(&wndpl);
*/	
	MoveWindow(&m_FullScreenRect);
	///隐藏工具烂
//	ShowControlBar(&m_wndToolBar,FALSE,FALSE);
}
Exemplo n.º 10
0
void gkToolBarPaneBase::RecalcLayout()
{
	////////////////////////////////////////////////////////////////////////
	// Place the toolbars and move the controls in the dialog to make space
	// for them
	////////////////////////////////////////////////////////////////////////

	CRect rcClientStart;
	CRect rcClientNow;
	CRect rcChild;					
	CRect rcWindow;
	CWnd *pwndChild = GetWindow(GW_CHILD);
	if (pwndChild == NULL)
		return;

	CRect clientRect;
	GetClientRect(clientRect);
	// We need to resize the dialog to make room for control bars.
	// First, figure out how big the control bars are.
	GetClientRect(rcClientStart);
	RepositionBarsInternal(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 
				   0, reposQuery, rcClientNow);

	// Now move all the controls so they are in the same relative
	// position within the remaining client area as they would be
	// with no control bars.
	CPoint ptOffset(rcClientNow.left - rcClientStart.left,
					rcClientNow.top - rcClientStart.top); 

	//CRect rcClient(0, 0, cx, cy);
	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, 0, 0, &rcClientNow);

	// And position the control bars
	RepositionBarsInternal(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
}
Exemplo n.º 11
0
void CProcessManager::CreatStatusBar(void)
{
	RECT	rect;
	GetClientRect(&rect);

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		sizeof(indicators)/sizeof(UINT)))
	{
		return ;      
	}

	m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_STRETCH, NULL);
	
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); //显示状态栏
	

	CRect rc;
	rc.top=rect.bottom-22;
	rc.left=0;
	rc.right=rect.right;
	rc.bottom=rect.bottom;

	m_wndStatusBar.MoveWindow(rc);           

	CString strStatusMsg;
	strStatusMsg.Format(L"进程:%d , 隐藏进程:%d , 应用层不可访问进程:%d",g_ProcessCount,g_HideProcessCount,1);
	m_wndStatusBar.SetPaneText(0,strStatusMsg);  
}
Exemplo n.º 12
0
BOOL CDlgLayerTree::OnInitDialog()
{
	CAcUiDialog::OnInitDialog();
	CAcModuleResourceOverride resourceOverride ;

	// 添加工具条按钮
	LPTBBUTTON btn = new TBBUTTON[4];

	btn[0].iBitmap = 0;
	btn[0].idCommand = ID_BTN_AUTOREAD;
	btn[0].fsState = TBSTATE_ENABLED;
	btn[0].fsStyle = TBSTYLE_BUTTON;
	btn[0].dwData = 0;
	btn[0].iString = 1;

	btn[1].iBitmap = 1;
	btn[1].idCommand = ID_BTN_OPENALL;
	btn[1].fsState = TBSTATE_ENABLED;
	btn[1].fsStyle = TBSTYLE_BUTTON;
	btn[1].dwData = 0;
	btn[1].iString = 1;

	btn[2].iBitmap = 2;
	btn[2].idCommand = ID_BTN_CLOSEALL;
	btn[2].fsState = TBSTATE_ENABLED;
	btn[2].fsStyle = TBSTYLE_BUTTON;
	btn[2].dwData = 0;
	btn[2].iString = 1;

	btn[3].iBitmap = 3;
	btn[3].idCommand = ID_BTN_REFURBISH;
	btn[3].fsState = TBSTATE_ENABLED;
	btn[3].fsStyle = TBSTYLE_BUTTON;
	btn[3].dwData = 0;
	btn[3].iString = 1;

	//创建工具条(并建立关联按钮,图标)
	DWORD dwStyle = TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | WS_CHILD | CCS_NORESIZE | WS_VISIBLE | CCS_NODIVIDER;
	m_wndtoolbarctrl.Create( dwStyle, CRect(4,4,150,32) ,this , IDR_TOOLBAR );
	m_wndtoolbarctrl.ModifyStyle(TBSTYLE_TRANSPARENT, 0, 0);// 由于TBSTYLE_FLAT属性中包含了TBSTYLE_TRANSPARENT,需要在此去掉
	m_wndtoolbarctrl.AddButtons(4, btn);
	m_wndtoolbarctrl.AddBitmap(1, IDR_TOOLBAR);
	m_wndtoolbarctrl.SetButtonSize(CSize(16,15));
	m_wndtoolbarctrl.SetBitmapSize(CSize(16,15));
	m_wndtoolbarctrl.AutoSize();
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

	// 添加树型控件
	m_tree.ModifyStyleEx(0,WS_EX_STATICEDGE);
	m_tree.ModifyStyle(TVS_CHECKBOXES,0);
	m_tree.ModifyStyle(0,TVS_CHECKBOXES);
	m_tree.SetItemHeight(17);

	//初始化控件
	//InitializeTreeControl();

	return TRUE; 
}
Exemplo n.º 13
0
void CMainDlg::SetStatusBar()
{
	if (!m_wndToolBar.CreateEx(this) ||	!m_wndToolBar.LoadToolBar(IDR_TOOLBAR))
	{
		TRACE0("Failed to create toolbar\n");
		return;      // fail to create
	}
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);
}
Exemplo n.º 14
0
// 初始化状态栏
void CLogViewDlg::InitStatusBar()
{
    m_StatusBar.CreateEx(this,SBT_TOOLTIPS,WS_CHILD|WS_VISIBLE|CBRS_BOTTOM,AFX_IDW_STATUS_BAR);
    m_StatusBar.SetIndicators(g_arrStatusBarIndicators, g_nStatusBarIndicatorsCount);

    m_StatusBar.SetPaneInfo(0, ID_SEPARATOR, SBPS_NORMAL | SBPS_STRETCH, 0);

    UpdateStatusBar();

    RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,ID_INDICATOR_NUM);
}
Exemplo n.º 15
0
void CFrameWnd::RecalcLayout( BOOL bNotify )
/******************************************/
{
    UNUSED_ALWAYS( bNotify );
    
    if( !m_bInRecalcLayout ) {
        m_bInRecalcLayout = TRUE;
        if( GetStyle() & FWS_SNAPTOBARS ) {
            CRect rect;
            RepositionBars( 0, 0xFFFF, AFX_IDW_PANE_FIRST, reposQuery, &rect, NULL,
                            FALSE );
            CalcWindowRect( &rect );
            ::SetWindowPos( m_hWnd, NULL, 0, 0, rect.Width(), rect.Height(),
                            SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
        }
        RepositionBars( 0, 0xFFFF, AFX_IDW_PANE_FIRST );
        ::UpdateWindow( m_hWnd );
        m_bInRecalcLayout = FALSE;
    }
}
//----------------------------------------------------------------------------------//
void CBCGPAutoHideDockBar::DockControlBar (CBCGPControlBar* pControlBar, BCGP_DOCK_METHOD /*dockMethod*/, 
								    LPCRECT lpRect)
{
	ASSERT_VALID (this);
	ASSERT_VALID (pControlBar);

	BOOL bVertDock = !IsHorizontal ();
	CSize szBarSize = pControlBar->CalcFixedLayout (FALSE, !bVertDock);

	// the control bar doesn't take up all space of the row
	int nRowHeight = bVertDock ? szBarSize.cx + m_nExtraSpace 
							   : szBarSize.cy + m_nExtraSpace;

	if (!m_lstControlBars.Find (pControlBar))
	{
		CBCGPDockBarRow* pRowToDock = NULL;

		if (m_lstDockBarRows.IsEmpty ())
		{
			pRowToDock = AddRow (NULL, nRowHeight);
			if (GetCurrentAlignment () & CBRS_ALIGN_LEFT || 
				GetCurrentAlignment () & CBRS_ALIGN_TOP)
			{
				pRowToDock->SetExtra (m_nExtraSpace, BCGP_ROW_ALIGN_TOP);
			}
			else
			{
				pRowToDock->SetExtra (m_nExtraSpace, BCGP_ROW_ALIGN_BOTTOM);
			}
		}
		else
		{
			pRowToDock = (CBCGPDockBarRow*) m_lstDockBarRows.GetHead ();
		}
		
		ASSERT_VALID (pRowToDock);
		// the bar should be placed on the existing row or new row
		pRowToDock->AddControlBar (pControlBar, BCGP_DM_RECT, lpRect, TRUE);

		ShowWindow (SW_SHOW);

		m_lstControlBars.AddTail (pControlBar);
		AdjustDockingLayout ();
		CRect rectClient;
		GetClientRect (rectClient);
		RepositionBars (rectClient);
		
	}
}
Exemplo n.º 17
0
void CMainFrame::RecalcLayout(BOOL bNotify)
{
    if (m_bInitSplit)
    {
        CRect rcClient;
        RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, &rcClient);

        int cy0, cy1, cyMin;

        m_wndSplitter1.GetRowInfo(0, cy0, cyMin);
        m_wndSplitter1.GetRowInfo(1, cy1, cyMin);

        if (cy0 >= 0 && cy1 >= 0)
        {
            if ((cy1 > m_sizeBottomView.cy) && (rcClient.Height() < cy0 + cy1 + (CY_SPLITTER + CY_MARGIN * 2)))
            {
                cy1 = max(m_sizeBottomView.cy, (rcClient.Height() - (CY_SPLITTER + CY_MARGIN * 2)) - cy0);
            }

            cy0 = (rcClient.Height() - (CY_SPLITTER + CY_MARGIN * 2)) - cy1;

            m_wndSplitter1.SetRowInfo(0, cy0, 0);
            m_wndSplitter1.RecalcLayout();
        }

        int cx0, cx1, cxMin;

        m_wndSplitter2.GetColumnInfo(0, cx0, cxMin);
        m_wndSplitter2.GetColumnInfo(1, cx1, cxMin);

        if (cx0 >= 0 && cx1 >= 0)
        {
            if ((cx1 > m_sizeRightView.cx) && (rcClient.Width() < cx0 + cx1 + (CX_SPLITTER + CX_MARGIN * 2)))
            {
                cx1 = max(m_sizeRightView.cx, (rcClient.Width() - (CX_SPLITTER + CX_MARGIN * 2)) - cx0);
            }

            cx0 = (rcClient.Width() - (CX_SPLITTER + CX_MARGIN * 2)) - cx1;

            m_wndSplitter2.SetColumnInfo(0, cx0, 0);
            m_wndSplitter2.RecalcLayout();
        }
    }

    CFrameWnd::RecalcLayout(bNotify);
}
Exemplo n.º 18
0
BOOL CLayerSelect::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
#ifdef MYDEBUG
	m_Grid.SetDoubleBuffering(0);
#else
	m_Grid.SetDoubleBuffering(1);
#endif
	m_Grid.SetImageList(GetImageList());
	
	//начальные параметры таблицы
	m_Grid.EnableDragAndDrop(false);
	m_Grid.SetGridLineColor(RGB(255,255,255));
	
	m_Grid.SetFixedColumnSelection(0);
	m_Grid.SetFixedRowSelection(0);
	m_Grid.SetDefCellHeight(16);
	m_Grid.SetSingleRowSelection(0);
	m_Grid.EnableSelection(0);
	
	m_Grid.SetGridBkColor(RGB(255,255,255));
	m_Grid.m_NotUseMyExtEdit=TRUE;

	//m_Grid.SetRowCount(1+aListName.GetSize());
	m_Grid.SetColumnCount(3);
	m_Grid.SetFixedRowCount(0);
	m_Grid.SetFixedColumnCount(0);
	m_Grid.SetEditable(0);
	m_Grid.SetColumnWidth(0,20);
	m_Grid.SetColumnWidth(1,20);
	m_Grid.SetColumnWidth(2,220);

	ReLoadGrid();
	
	m_ToolBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS |
		CBRS_FLYBY | CBRS_BORDER_BOTTOM|TBSTYLE_DROPDOWN,AFX_IDW_TOOLBAR);//надо изменить AFX_IDW_TOOLBAR
	m_ToolBar.LoadToolBar(IDR_LAYER);

	
	// Положение панелей
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

	return FALSE;
}
Exemplo n.º 19
0
void CDisplayDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
    int h = 10;
    SCROLLINFO si;
    si.cbSize = sizeof(SCROLLINFO);
    si.fMask = SIF_ALL;
    GetScrollInfo(SB_VERT, &si);
    int nOldPos = si.nPos;

    switch (nSBCode)
    {
    case SB_LINEDOWN:
        si.nPos = min(si.nPos + h, si.nMax);
        break;
    case SB_PAGEDOWN:
        si.nPos = min(si.nPos + h * 10, si.nMax);
        break;
    case SB_LINEUP:
        si.nPos = max(si.nPos - h, si.nMin);
        break;
    case SB_PAGEUP:
        si.nPos = max(si.nPos - h * 10, si.nMin);
        break;
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        si.nPos = si.nTrackPos;
        break;
    case SB_TOP:
        si.nPos = si.nMin;
        break;
    case SB_BOTTOM:
        si.nPos = si.nMax;
        break;
    }

    SetScrollInfo(SB_VERT, &si);
    GetScrollInfo(SB_VERT, &si); //重新获取新的位置


    ScrollWindowEx(0, nOldPos - si.nPos,NULL, NULL, NULL, NULL, SW_ERASE|SW_SCROLLCHILDREN);
    UpdateWindow();
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);
    //m_ScreenDisplayer->ReflashDC();
    CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}
Exemplo n.º 20
0
BOOL CNewText::OnInitDialog() 
{
	CDialog::OnInitDialog();
	if (!bar.CreateEx(this,TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!bar.LoadToolBar(IDR_TEXT))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;
	}	// TODO: Add your specialized creation code here
	
	bar.ShowWindow(SW_SHOW);
//    bar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);


	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 21
0
void CRegDlg::CreatStatusBar()
{
	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return ;      // fail to create
	}
	m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_STRETCH, 120);
	
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); //显示状态栏		
	CRect rc;
	::GetWindowRect(this->m_hWnd,rc);
	//rc.top=rc.bottom-30;
	m_wndStatusBar.MoveWindow(rc);
	
	CString str;
	m_wndStatusBar.SetPaneText(0,str);
}
Exemplo n.º 22
0
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
    static BOOL bRestore = FALSE; // 最小化からの復元時は処理しない

    if (IsWindow(m_wndSplitter1.m_hWnd) && ! bRestore)
    {
        CRect rcWindow;
        GetWindowRect(&rcWindow);

        CRect rcClient;
        RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, &rcClient);

        lpMMI->ptMinTrackSize.y = m_sizeRightView.cy + m_sizeBottomView.cy + CX_SPLITTER + CX_MARGIN * 2 + (rcWindow.Height() - rcClient.Height());
        lpMMI->ptMinTrackSize.x = m_sizeBottomView.cx + CY_MARGIN * 2 + (rcWindow.Width() - rcClient.Width());
    }

    bRestore = IsIconic();

    CFrameWnd::OnGetMinMaxInfo(lpMMI);
}
Exemplo n.º 23
0
void CLogViewDlg::OnSize(UINT nType, int cx, int cy)
{
    __super::OnSize(nType, cx, cy);

    int nLeft = 0;
    RECT rcDoFilterRect;
    HWND hWndBtnDoFilter = ::GetDlgItem(GetSafeHwnd(), IDC_BTN_DO_FILTER);
    if(hWndBtnDoFilter != NULL)
    {
        ::GetWindowRect(hWndBtnDoFilter, &rcDoFilterRect);
        ScreenToClient(&rcDoFilterRect);
        nLeft = cx - (rcDoFilterRect.right - rcDoFilterRect.left) - 10;
        ::SetWindowPos(hWndBtnDoFilter, NULL,
            nLeft, rcDoFilterRect.top,
            0, 0,
            SWP_NOZORDER | SWP_NOSIZE);
    }

    RECT rcTextFilterRect;
    HWND hWndEditTextFilter = ::GetDlgItem(GetSafeHwnd(), IDC_EDIT_TEXT_FILTER);
    if(hWndEditTextFilter != NULL)
    {
        ::GetWindowRect(hWndEditTextFilter, &rcTextFilterRect);
        ScreenToClient(&rcTextFilterRect);
        ::SetWindowPos(hWndEditTextFilter, NULL,
            0, 0,
            nLeft - rcTextFilterRect.left - 10, rcTextFilterRect.bottom - rcTextFilterRect.top,
            SWP_NOZORDER | SWP_NOMOVE);
    }

    if(m_LogList.GetSafeHwnd() != NULL)
    {
        m_LogList.MoveWindow(0, 26, cx - 0, cy - 26 - 20);
    }

    RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,ID_INDICATOR_NUM);
}
Exemplo n.º 24
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	thinkingDotNum = -1;

	stBar.Create(this);
	stBar.SetIndicators(indicators,6);

	CRect rect;
	GetClientRect(&rect);

	stBar.SetPaneInfo(0,ID_ST_GAME_ST, SBPS_NORMAL,60);   
	stBar.SetPaneInfo(1,ID_ST_AI_PERC, SBPS_NORMAL,50);   
	stBar.SetPaneInfo(2,ID_ST_PLAYER_SCR, SBPS_NORMAL,100);   
	stBar.SetPaneInfo(3,ID_ST_DRAW_SCR, SBPS_NORMAL,100);   
	stBar.SetPaneInfo(4,ID_ST_AI_SCR, SBPS_NORMAL,100);   
	stBar.SetPaneInfo(5,ID_ST_MOVE_NUM, SBPS_STRETCH,1);   

	RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST, ID_ST_AI_SCR);

	return 0;
}
Exemplo n.º 25
0
BOOL CModelessMain::OnInitDialog()
{
	CModelessDialog::OnInitDialog();

	// Create status bar at the bottom of the dialog window
	if (m_statusBar.Create(this))
	{
		m_statusBar.SetIndicators(m_lpaIDStatusBar, m_cIDStatusBar);
		OnSetMessageString(AFX_IDS_IDLEMESSAGE);

		// Make a sunken or recessed border around the first pane
		m_statusBar.SetPaneInfo(0, m_statusBar.GetItemID(0),
			SBPS_STRETCH, NULL );
	}

	// Create toolbar at the top of the dialog window
	if (m_toolBar.Create(this))
	{
		m_toolBar.LoadBitmap(m_nIDBitmap);
		m_toolBar.SetButtons(m_lpaIDToolBar, m_cIDToolBar);
	}

	m_toolBar.SetBarStyle(m_toolBar.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	// We need to resize the dialog to make room for control bars.
	// First, figure out how big the control bars are.
	CRect rcClientStart;
	CRect rcClientNow;
	GetClientRect(rcClientStart);
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
				   0, reposQuery, rcClientNow);

	// Now move all the controls so they are in the same relative
	// position within the remaining client area as they would be
	// with no control bars.
	CPoint ptOffset(rcClientNow.left - rcClientStart.left,
					rcClientNow.top - rcClientStart.top);

	CRect  rcChild;
	CWnd* pwndChild = GetWindow(GW_CHILD);
	while (pwndChild)
	{
		pwndChild->GetWindowRect(rcChild);
		ScreenToClient(rcChild);
		rcChild.OffsetRect(ptOffset);
		pwndChild->MoveWindow(rcChild, FALSE);
		pwndChild = pwndChild->GetNextWindow();
	}

	// Adjust the dialog window dimensions
	CRect rcWindow;
	GetWindowRect(rcWindow);
	rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
	rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
	MoveWindow(rcWindow, FALSE);

	// And position the control bars
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);         // Set big icon
	SetIcon(m_hIcon, FALSE);        // Set small icon

	// Finally, center the dialog on the screen
	CenterWindow();
	return TRUE;
}
Exemplo n.º 26
0
///////////////////////////////////////////////////
// full screen
void CBSWndContainer::SetFullScreen(BOOL bFlag)
{
    if(bFlag==m_bFullScreen) return;

    if( bFlag )
    {   //全屏
// 		//得到显示器分辨率
// 		int cx=GetSystemMetrics(SM_CXSCREEN);
// 		int cy=GetSystemMetrics(SM_CYSCREEN);
//
// 		//保存位置信息
// 		GetWindowPlacement(&_temppl);
// 		//修改风格
// 		ModifyStyle(WS_CHILD,WS_POPUP);
// 		//修改父窗口
// 		_tempparent=SetParent(NULL);
// 		_tempparent->ShowWindow(SW_HIDE);


        //移动窗口
        /*		MoveWindow(0,0,cx,cy);*/

        ModifyStyle(WS_CHILD,WS_POPUP);
        //修改父窗口
//  		_tempparent=SetParent(NULL);
//  		_tempparent->ShowWindow(SW_HIDE);
        GetWindowPlacement(&m_OldWndPlacement);
        CRect WindowRect;
        GetWindowRect(&WindowRect);
        CRect ClientRect;
        RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &ClientRect);
        ClientToScreen(&ClientRect);
        // 获取屏幕的分辨率
        CRect screenRect;
        GetCurrentScreenMonitorRect(m_hWnd, screenRect);
        int nFullWidth = screenRect.Width(); //GetSystemMetrics(SM_CXSCREEN);
        int nFullHeight = screenRect.Height(); //GetSystemMetrics(SM_CYSCREEN);
        //将除控制条外的客户区全屏显示到从(0,0)到(nFullWidth, nFullHeight)区域, 将(0,0)和(nFullWidth, nFullHeight)两个点外扩充原窗口和除控制条之外的 客户区位置间的差值, 就得到全屏显示的窗口位置
        m_FullScreenRect.left= WindowRect.left - ClientRect.left + screenRect.left;
        m_FullScreenRect.top = WindowRect.top - ClientRect.top + screenRect.top;
        m_FullScreenRect.right = m_FullScreenRect.left + WindowRect.right - ClientRect.right + nFullWidth;//::GetSystemMetrics(SM_CXSCREEN);
        m_FullScreenRect.bottom = m_FullScreenRect.top + WindowRect.bottom - ClientRect.bottom + nFullHeight;//::GetSystemMetrics(SM_CYSCREEN);

        m_bFullScreen=TRUE; // 设置全屏显示标志为 TRUE
        // 进入全屏显示状态
        WINDOWPLACEMENT wndpl;
        wndpl.length=sizeof(WINDOWPLACEMENT);
        wndpl.flags=0;
        wndpl.showCmd=SW_SHOWNORMAL;
        wndpl.rcNormalPosition= m_FullScreenRect;
        _tempparent=SetParent(NULL);
        _tempparent->ShowWindow(SW_HIDE);
        SetWindowPlacement(&wndpl);
        //	SetWindowPos(&wndTopMost,0,0,cx,cy,NULL);
    }
    else
    {   //还原
        //还原父窗口
// 		_tempparent->ShowWindow(SW_SHOW);
// 		SetParent(_tempparent);
// 		//还原风格
// 		ModifyStyle(WS_POPUP,WS_CHILD);
// 		//还原位置
// 		SetWindowPlacement(&_temppl);
        _tempparent->ShowWindow(SW_SHOW);
        SetParent(_tempparent);
        //还原风格
        ModifyStyle(WS_POPUP,WS_CHILD);
        SetWindowPlacement(&m_OldWndPlacement);
    }

    m_bFullScreen=bFlag;
    Invalidate();
}
Exemplo n.º 27
0
BOOL CTwoOptDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here

	m_search = -1;
	
	hasRun = false;

	// Creates a 9-point-Arial-font
	font.CreatePointFont(90, _T("Arial"));

	// With a member variable associated to the static control
	distText.SetFont(&font);
	iterText.SetFont(&font);


	// Without a member variable
	GetDlgItem(IDC_STATIC_DIST)->SetFont(&font);	

	m_lasttour.TourLenght =0;
	m_besttour.TourLenght =0;
	m_AlSelection = 0;
	m_CAlgSelection.SetCurSel(m_AlSelection);

	//set alpha between 1 - 5
	m_cSliderAlpha.SetRange(1 , 10);
	m_cSliderAlpha.SetPos(1);
	//set beta between 1 - 5
	m_cSliderBeta.SetRange(1 , 10);
	m_cSliderBeta.SetPos(3);
	m_cSliderEvap.SetRange(0,10);
	m_cSliderEvap.SetPos(5);
	m_cProgress.SetRange(0,100);

	m_cSpinXi.SetRange(1 , 10);
	m_cSpinQ0.SetRange(1 , 100);
	m_cSpinR0.SetRange(1 , 10);

	m_cSpinXi.SetPos(1);
	m_cSpinQ0.SetPos(98);
	m_cSpinR0.SetPos(1);

	c_mSpinEliteWeight.SetRange(1,10);
	c_mSpinEliteWeight.SetPos(5);
	
	c_SpinIrrerations.SetRange(1 , 100);
	c_SpinIrrerations.SetPos(5);


	m_bar.Create(this); //We create the status bar

	m_bar.SetIndicators(indicators,2); //Set the number of panes 

	CRect rect;
	GetClientRect(&rect);
	//Size the two panes
	m_bar.SetPaneInfo(0,ID_INDICATOR_NISH, 	SBPS_NORMAL,rect.Width()-100);      
	m_bar.SetPaneInfo(1,ID_INDICATOR_TIME,SBPS_STRETCH ,0);

	//This is where we actually draw it on the screen
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,ID_INDICATOR_TIME);

	CRect progressRect;
	m_bar.GetItemRect(1, &progressRect);
	//m_cProgress.MoveWindow(progressRect);
	//m_cProgress.Create(WS_CHILD | WS_VISIBLE | SBPS_NOBORDERS | PBS_SMOOTH, progressRect, this, -1);
	m_cProgress.SetRange(0, 100);
	m_cProgress.SetPos(0);
	


	return TRUE;  // return TRUE  unless you set the focus to a control
}
Exemplo n.º 28
0
BOOL CDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	hInstResClnt = AfxGetResourceHandle();
	AfxSetResourceHandle(::GetModuleHandle(L"AddBank.dll"));

	CString s,strSql,strSql2;
	s.LoadString(IDS_STRING9014);
	this->SetWindowText(s);


	InitStaticText();

	int iTBCtrlID;
	short i;
	COleVariant vC;

	m_wndToolBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS |
	                        CBRS_FLYBY | CBRS_BORDER_BOTTOM);
	m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);
	iTBCtrlID = m_wndToolBar.CommandToIndex(ID_BUTTON32779);
	if(iTBCtrlID>=0){
		for(int j=iTBCtrlID;j<(iTBCtrlID + 6);j++){
			switch(j){
				case 0:
					m_wndToolBar.SetButtonStyle(j,TBBS_CHECKBOX);
					m_iBtSt =m_wndToolBar.GetToolBarCtrl().GetState(ID_BUTTON32779);
					break;
/*				case 1:
				case 2:
				case 3:
				case 4:
					break;
*/
				default:
					m_wndToolBar.SetButtonStyle(j,TBBS_BUTTON);
					break;
			}
		}
	}
	OnEnableButtonBar(m_iBtSt,&m_wndToolBar);
	m_wndToolBar.SetButtonInfo(5,ID_EDIT_TOOLBAR,TBBS_SEPARATOR,130);
	// определяем координаты области, занимаемой разделителем
	CRect rEdit; 
	m_wndToolBar.GetItemRect(5,&rEdit);
	rEdit.left+=6; rEdit.right-=6; // отступы
	if(!(m_EditTBCh.Create(WS_CHILD|
		ES_AUTOHSCROLL|WS_VISIBLE|WS_TABSTOP|
		WS_BORDER,rEdit,&m_wndToolBar,ID_EDIT_TOOLBAR))) return -1;
	
	CRect rcClientStart;
	CRect rcClientNow;
	GetClientRect(rcClientStart);
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
				   IDR_TOOLBAR1, reposQuery , rcClientNow);
	CPoint ptOffset(rcClientNow.left - rcClientStart.left,
										rcClientNow.top - rcClientStart.top);

/*	CRect rcChild;
	CWnd* pwndChild = GetWindow(GW_CHILD);
//	Это для смещения всех контрлов
	while (pwndChild)
	{
		pwndChild->GetWindowRect(rcChild);
		ScreenToClient(rcChild);
		rcChild.OffsetRect(ptOffset);
		pwndChild->MoveWindow(rcChild, FALSE);
		pwndChild = pwndChild->GetNextWindow();
	}

	CRect rcWindow;
	GetWindowRect(rcWindow);
	rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
	rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
	MoveWindow(rcWindow, FALSE);	
*/
	// Положение панелей
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
				 IDR_TOOLBAR1, reposDefault , rcClientNow);

/*	if(m_EditTB.GetSafeHwnd()!=NULL){
		AfxMessageBox("not NULL");
		if(m_EditTBSChar.SubclassWindow(m_EditTB.GetSafeHwnd())){
			AfxMessageBox("ok");
		}
	}
*/
	m_vNULL.vt = VT_ERROR;
	m_vNULL.scode = DISP_E_PARAMNOTFOUND;

	ptrCmd1 = NULL;
	ptrRs1 = NULL;

	ptrCmd1.CreateInstance(__uuidof(Command));
	ptrCmd1->ActiveConnection = ptrCnn;
	ptrCmd1->CommandType = adCmdText;

	ptrRs1.CreateInstance(__uuidof(Recordset));
	ptrRs1->CursorLocation = adUseClient;
	ptrRs1->PutRefSource(ptrCmd1);
	strSql = _T("QT48");
	OnShowGrid(strSql, ptrRs1,ptrCmd1,m_DataGrid1,InitDataGrid1);

	m_CurCol = m_DataGrid1.get_Col();
	if(m_CurCol==-1 || m_CurCol==0){
		m_CurCol=1;
	}
	m_iCurType = GetTypeCol(ptrRs1,m_CurCol);
	m_EditTBCh.SetTypeCol(m_iCurType);

	if(m_bFndC){
		short fCol=0;
		m_Flg = false;
		OnFindInGrid(m_strFndC,ptrRs1,fCol,m_Flg);
		m_Flg = true;
	}

	ptrCmd2 = NULL;
	ptrRs2 = NULL;

	ptrCmd2.CreateInstance(__uuidof(Command));
	ptrCmd2->ActiveConnection = ptrCnn;
	ptrCmd2->CommandType = adCmdText;

	ptrRs2.CreateInstance(__uuidof(Recordset));
	ptrRs2->CursorLocation = adUseClient;
	ptrRs2->PutRefSource(ptrCmd2);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 29
0
BOOL CPWResizeDialog::OnInitDialog()
{
  CPWDialog::OnInitDialog();

  // MUST add main control ID, button IDs and status bar info first
  // This verify is to warn developers to do this!  No impact
  // for users once set up!
  if (m_iMainCtrl == 0 || m_numbtns < 1 || m_numsbpanes < 0)
    VERIFY(0);

  // Add the status bar
  if (m_statusBar.CreateEx(this, SBARS_SIZEGRIP)) {
    m_statusBar.SetIndicators(m_pstatustext, m_numsbpanes);
    UINT style;
    if (m_bTextVisible)
      style = SBPS_STRETCH;
    else
      style = SBPS_DISABLED | SBPS_NOBORDERS;

    m_statusBar.SetPaneInfo(0, m_statusBar.GetItemID(0), style, NULL);
    m_statusBar.UpdateWindow();

    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
    m_bStatusBarOK = true;
  }

  m_pMainCtrl = GetDlgItem(m_iMainCtrl);

  // Arrange all the controls - needed for resizeable dialog
  CRect sbRect, mainCtrlRect, btnRect, dlgRect;
  int xleft, ytop;

  GetClientRect(&dlgRect);
  m_DialogMinWidth = dlgRect.Width();
  m_DialogMinHeight = dlgRect.Height();

  m_statusBar.GetWindowRect(&sbRect);
  ScreenToClient(&sbRect);

  m_pMainCtrl->GetWindowRect(&mainCtrlRect);
  ScreenToClient(&mainCtrlRect);

  GetDlgItem(m_viBottomButtons[0])->GetWindowRect(&btnRect);
  ScreenToClient(&btnRect);
  m_ybuttondiff = btnRect.top - mainCtrlRect.bottom;

  m_cxBSpace = dlgRect.Size().cx - mainCtrlRect.Size().cx;
  m_cyBSpace = dlgRect.Size().cy - mainCtrlRect.Size().cy;
  m_cySBar = sbRect.Size().cy;

  m_pMainCtrl->SetWindowPos(NULL, NULL, NULL,
                          dlgRect.Size().cx - (2 * mainCtrlRect.TopLeft().x),
                          dlgRect.Size().cy - m_cyBSpace,
                          SWP_NOMOVE | SWP_NOZORDER);

  m_pMainCtrl->GetWindowRect(&mainCtrlRect);
  ScreenToClient(&mainCtrlRect);

  ytop = mainCtrlRect.bottom + m_ybuttondiff;

  CWnd *pwnd;
  for (int i = 1; i <= m_numbtns; i++) {
    pwnd = GetDlgItem(m_viBottomButtons[i - 1]);
    pwnd->GetWindowRect(&btnRect);
    xleft = (i * m_DialogMinWidth / (m_numbtns + 1)) - (btnRect.Width() / 2);
    pwnd->SetWindowPos(NULL, xleft, ytop, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER);
  }

  GetDlgItem(m_viBottomButtons[m_iFocus])->SetFocus();

  m_bInitDone = true;

  return FALSE;
}
Exemplo n.º 30
0
xpr_bool_t HistoryDlg::OnInitDialog(void) 
{
    super::OnInitDialog();

    SetIcon(mIcon, XPR_TRUE);

    HICON sIconHandle;
    sIconHandle = AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDI_NOT));
    mTreeImgList.Create(16, 16, ILC_COLOR32 | ILC_MASK, -1, -1);
    mTreeImgList.Add(sIconHandle);
    ::DestroyIcon(sIconHandle);

    mTreeCtrl.SetImageList(&mTreeImgList, TVSIL_NORMAL);

    //-----------------------------------------------------------------------------

    if (mToolBar.Create(this) == XPR_FALSE)
    {
        XPR_TRACE(XPR_STRING_LITERAL("Failed to create toolbar\n"));
        return -1;
    }

    mToolBarImgList.Create(IDB_TB_DRIVEDLG, 16, 1, RGB(255,0,255));
    mToolBar.GetToolBarCtrl().SetImageList(&mToolBarImgList);
    mToolBar.GetToolBarCtrl().SetBitmapSize(CSize(16,16));

    mToolBar.ModifyStyle(0, TBSTYLE_LIST | TBSTYLE_FLAT);
    mToolBar.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_MIXEDBUTTONS);

    mToolBar.SetBorders(0, 0, 0, 0);

    DWORD sStyle = mToolBar.GetBarStyle();
    sStyle &= ~CBRS_BORDER_TOP;
    sStyle |= CBRS_FLYBY;
    mToolBar.SetBarStyle(sStyle);

    //-----------------------------------------------------------------------------

    TBBUTTON sTbButton = {0};
    sTbButton.idCommand = ID_HISTORY_REFRESH;
    sTbButton.iBitmap = 0;
    sTbButton.fsState = TBSTATE_ENABLED;
    sTbButton.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE | BTNS_SHOWTEXT;
    sTbButton.iString = mToolBar.GetToolBarCtrl().AddStrings(gApp.loadString(XPR_STRING_LITERAL("popup.history.toolbar.refresh")));

    mToolBar.GetToolBarCtrl().AddButtons(1, &sTbButton);

    //-----------------------------------------------------------------------------
    // ControlBar Reposition

    CRect sClientStartRect;
    CRect sClientNowRect;
    GetClientRect(sClientStartRect);
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, sClientNowRect);

    CPoint sOffsetPoint(sClientNowRect.left - sClientStartRect.left, sClientNowRect.top - sClientStartRect.top); 
    CRect sChildRect;
    CWnd *sChildWnd = GetWindow(GW_CHILD);
    while (XPR_IS_NOT_NULL(sChildWnd))
    {
        sChildWnd->GetWindowRect(sChildRect);
        ScreenToClient(sChildRect);
        sChildRect.OffsetRect(sOffsetPoint);
        sChildWnd->MoveWindow(sChildRect, XPR_FALSE);
        sChildWnd = sChildWnd->GetNextWindow();
    }
    CRect sWindowRect;
    GetWindowRect(sWindowRect);
    sWindowRect.right += sClientStartRect.Width() - sClientNowRect.Width();
    sWindowRect.bottom += sClientStartRect.Height() - sClientNowRect.Height();
    MoveWindow(sWindowRect, XPR_FALSE);

    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

    //----------------------------------------------------------------------

    if (mHistoryDispDeque.size() == 1)
    {
        mTabCtrl.ShowWindow(SW_HIDE);

        CRect sTabRect;
        mTabCtrl.GetWindowRect(&sTabRect);
        ScreenToClient(&sTabRect);

        CRect sTreeRect;
        mTreeCtrl.GetWindowRect(&sTreeRect);
        ScreenToClient(&sTreeRect);

        sTreeRect.top = sTabRect.top;
        mTreeCtrl.MoveWindow(&sTreeRect);
    }

    // CResizingDialog -------------------------------------------
    HideSizeIcon();

    //sizeNone:     Don't resize at all  
    //sizeResize:   The control will be stretched in the appropriate direction 
    //sizeRepos:    The control will be moved in the appropriate direction 
    //sizeRelative: The control will be moved proportionally in the appropriate direction 
    AddControl(IDC_HISTORY_TREE,   sizeResize, sizeResize);
    AddControl(IDC_HISTORY_STATUS, sizeResize, sizeRepos);
    //------------------------------------------------------------

    HistoryDisp *sHistoryDisp;
    HistoryDispDeque::iterator sIterator;

    sIterator = mHistoryDispDeque.begin();
    for (; sIterator != mHistoryDispDeque.end(); ++sIterator)
    {
        sHistoryDisp = *sIterator;
        if (sHistoryDisp == XPR_NULL)
            continue;

        mTabCtrl.InsertItem(mTabCtrl.GetItemCount(), sHistoryDisp->mTabText);
    }

    mTabCtrl.SetCurSel((xpr_sint_t)mCurHistoryDisp);
    showTab(mCurHistoryDisp);

    mDlgState = DlgStateManager::instance().getDlgState(XPR_STRING_LITERAL("History"));
    if (XPR_IS_NOT_NULL(mDlgState))
    {
        mDlgState->setDialog(this, XPR_TRUE);
        mDlgState->load();
    }

    return XPR_TRUE;
}