void CColumnTreeView::UpdateColumns() { m_cxTotal = 0; HDITEM hditem; hditem.mask = HDI_WIDTH; int nCnt = m_Header.GetItemCount(); if (nCnt > 16) nCnt = 16; // get column widths from the header control for (int i=0; i<nCnt; i++) { if (m_Header.GetItem(i, &hditem)) { m_cxTotal += m_arrColWidths[i] = hditem.cxy; if (i==0) m_Tree.m_cxFirstCol = hditem.cxy; } } m_Tree.m_cxTotal = m_cxTotal; UpdateScroller(); RepositionControls(); }
void CWorldsDlg::OnSize(UINT nType, int cx, int cy) { CMRCSizeDialogBar::OnSize(nType, cx, cy); // Reposition the controls RepositionControls(); }
LRESULT CExportDlg::OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { // // Get the controls // m_cbExportStyle = GetDlgItem (IDC_EXPORT_STYLE); m_statExportStyle = GetDlgItem (IDC_EXPORT_STYLE_STATIC); m_cbDebugStyle = GetDlgItem (IDC_DEBUG_STYLE); m_statDebugStyle = GetDlgItem (IDC_DEBUG_STYLE_STATIC); // // Resize myself so I take up all my parent area // CRect rectMe; GetWindowRect (&rectMe); CRect rectParent; ::GetClientRect (GetParent (), &rectParent); rectMe .right = rectMe .left + rectParent .Width (); // // Set my new size // SetWindowPos (NULL, 0, 0, rectMe .Width (), rectMe .Height (), SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); // // Reposition the controls // RepositionControls (); // // Initialize the combo // CString str; str .LoadString (IDS_EXPORT_STYLE_BIOWARE); m_cbExportStyle .AddString (str); str .LoadString (IDS_EXPORT_STYLE_SW); m_cbExportStyle .AddString (str); m_cbExportStyle .SetCurSel (0); // // Initialize the debug combo // str .LoadString (IDS_DEBUG_STYLE_NONE); m_cbDebugStyle .AddString (str); str .LoadString (IDS_DEBUG_STYLE_PRINT); m_cbDebugStyle .AddString (str); str .LoadString (IDS_DEBUG_STYLE_SPEAK); m_cbDebugStyle .AddString (str); m_cbDebugStyle .SetCurSel (0); return TRUE; }
void CColumnTreeView::OnSize(UINT nType, int cx, int cy) { CView::OnSize(nType, cx, cy); UpdateScroller(); RepositionControls(); }
////////////////////////////////////////////////////////////////////////// // // 다이얼로그 초기화 // ////////////////////////////////////////////////////////////////////////// BOOL CMainDbgDlg::OnInitDialog() { BOOL bRetVal = CDialog::OnInitDialog(); // 함수목록 컬럼헤더 정의 m_ctrlFuncList.InsertColumn(0, _T("Address"), LVCFMT_RIGHT, 100); m_ctrlFuncList.InsertColumn(1, _T("Score"), 0, 100); m_ctrlFuncList.InsertColumn(2, _T("Last Text (Japanese)"), 0, 200); m_ctrlFuncList.InsertColumn(3, _T("Last Text (Korean)"), 0, 200); ListView_SetExtendedListViewStyle( m_ctrlFuncList.GetSafeHwnd(), LVS_EX_FULLROWSELECT ); // 레지스터&스택 컬럼헤더 정의 m_ctrlRegStackList.InsertColumn(0, _T("Storage"), 0, 100); m_ctrlRegStackList.InsertColumn(1, _T("Value"), 0, 100); m_ctrlRegStackList.InsertColumn(2, _T("Text Dump"), 0, 100); m_ctrlRegStackList.InsertColumn(3, _T("Text Dump (Korean)"), 0, 100); ListView_SetExtendedListViewStyle( m_ctrlRegStackList.GetSafeHwnd(), LVS_EX_FULLROWSELECT ); // 컨트롤 위치 & 크기 초기화 m_bInitialized = TRUE; CRect rtClient; this->GetClientRect(rtClient); RepositionControls(rtClient.Width(), rtClient.Height()); return bRetVal; }
////////////////////////////////////////////////////////////////////////// // // 사이즈 변동시 이벤트 핸들러 // ////////////////////////////////////////////////////////////////////////// void CMainDbgDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if(m_bInitialized) { RepositionControls(cx,cy); } }
void CColumnTreeWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar * /* pScrollBar */) { CRect rcClient; GetClientRect(&rcClient); int cx = rcClient.Width(); int xLast = m_xPos; switch (nSBCode) { case SB_LINELEFT: m_xPos -= 15; break; case SB_LINERIGHT: m_xPos += 15; break; case SB_PAGELEFT: m_xPos -= cx; break; case SB_PAGERIGHT: m_xPos += cx; break; case SB_LEFT: m_xPos = 0; break; case SB_RIGHT: m_xPos = m_cxTotal - cx; break; case SB_THUMBTRACK: m_xPos = nPos; break; } if (m_xPos < 0) { m_xPos = 0; } else if (m_xPos > m_cxTotal - cx) { m_xPos = m_cxTotal - cx; } if (xLast == m_xPos) { return; } SetScrollPos(SB_HORZ, m_xPos); RepositionControls(); }
BOOL CIButtonDialog::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString csTitle; csTitle.LoadString(CInteractionButtonDialog::IDD); SetWindowText(csTitle); DWORD dwIds[] = {IDOK, IDCANCEL, -1}; MfcUtils::Localize(this, dwIds); InitChildWin(&m_dlgInside, IDD_INTERACTION_BUTTON); m_dlgInside.ShowWindow( SW_SHOW ); CRect rcOK; m_btnOK.GetWindowRect(&rcOK); int screenY = GetSystemMetrics(SM_CYMAXIMIZED); CRect rcWin; GetWindowRect(&rcWin); //m_iButtonVOffset = rcWin.bottom - rcOK.bottom; m_iButtonVOffset = 15; m_szInitial = rcWin.Size(); if( screenY < rcWin.Height() + 40) { rcWin.top = 20; rcWin.bottom = screenY - 20; } MoveWindow(&rcWin, TRUE); CenterWindow(); m_bIsInitialized = true; RepositionControls(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CColumnTreeView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { UNREFERENCED_PARAMETER( pScrollBar ); CRect rcClient; GetClientRect(&rcClient); int cx = rcClient.Width(); int xLast = m_xPos; switch (nSBCode) { case SB_LINELEFT: m_xPos -= 15; break; case SB_LINERIGHT: m_xPos += 15; break; case SB_PAGELEFT: m_xPos -= cx; break; case SB_PAGERIGHT: m_xPos += cx; break; case SB_LEFT: m_xPos = 0; break; case SB_RIGHT: m_xPos = m_cxTotal - cx; break; case SB_THUMBTRACK: m_xPos = nPos; break; } if (m_xPos < 0) m_xPos = 0; else if (m_xPos > m_cxTotal - cx) m_xPos = m_cxTotal - cx; if (xLast == m_xPos) return; SetScrollPos(SB_HORZ, m_xPos); RepositionControls(); }
void CIButtonDialog::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here if(m_dlgInside.GetSafeHwnd()) { CRect rcWin; GetClientRect(&rcWin); CRect rcIn; m_dlgInside.GetWindowRect(&rcIn); rcIn.bottom = rcIn.top + rcWin.Height() - 40; ScreenToClient(&rcIn); m_dlgInside.SetWindowPos(NULL, rcIn.left, rcIn.top, rcIn.Width(), rcIn.Height(), SWP_NOZORDER | SWP_SHOWWINDOW); RepositionControls(); } }
static int InitializeDialog (HWND window) { TCITEM gui_tab_item; struct reference_data* data; HWND tab_window; HWND ref_syntax_window; HWND ref_plugins_window; HWND ref_templates_window; HICON icon; data = malloc(sizeof(struct reference_data)); if(data == NULL) goto allocate_reference_data_failed; icon = LoadIcon(tside_application_instance, MAKEINTRESOURCE(TSIDE_I_GUI_REFERENCE)); if(icon == NULL) goto load_reference_icon_failed; SendMessage(window, WM_SETICON, ICON_BIG, (LPARAM)icon); tab_window = GetDlgItem(window, TSIDE_C_REFERENCE_TABS); ref_syntax_window = CreateDialog( tside_application_instance, MAKEINTRESOURCE(TSIDE_D_REF_SYNTAX), window, &TSIDE_RefSyntaxMessageProc ); if(ref_syntax_window == NULL) goto create_ref_syntax_window_failed; ref_plugins_window = CreateDialog( tside_application_instance, MAKEINTRESOURCE(TSIDE_D_REF_PLUGINS), window, &TSIDE_RefPluginsMessageProc ); if(ref_plugins_window == NULL) goto create_ref_plugins_window_failed; ref_templates_window = CreateDialog( tside_application_instance, MAKEINTRESOURCE(TSIDE_D_REF_TEMPLATES), window, &TSIDE_RefTemplatesMessageProc ); if(ref_templates_window == NULL) goto create_ref_templates_window_failed; gui_tab_item.mask = TCIF_TEXT; gui_tab_item.pszText = TSIDE_GetResourceText(TSIDE_S_REFERENCE_TAB_SYNTAX); SendMessage(tab_window, TCM_INSERTITEM, TSIDE_REFERENCE_SYNTAX, (LPARAM)&gui_tab_item); gui_tab_item.mask = TCIF_TEXT; gui_tab_item.pszText = TSIDE_GetResourceText(TSIDE_S_REFERENCE_TAB_PLUGINS); SendMessage(tab_window, TCM_INSERTITEM, TSIDE_REFERENCE_PLUGINS, (LPARAM)&gui_tab_item); gui_tab_item.mask = TCIF_TEXT; gui_tab_item.pszText = TSIDE_GetResourceText(TSIDE_S_REFERENCE_TAB_TEMPLATES); SendMessage(tab_window, TCM_INSERTITEM, TSIDE_REFERENCE_TEMPLATES, (LPARAM)&gui_tab_item); data->reference_window = window; data->tab_window = tab_window; data->ref_syntax_window = ref_syntax_window; data->ref_plugins_window = ref_plugins_window; data->ref_templates_window = ref_templates_window; SetWindowLongPtr(window, GWLP_USERDATA, (LONG_PTR)data); RepositionControls(data); SetSelectedTab(TSIDE_REFERENCE_PLUGINS, data); return TSIDE_ERROR_NONE; create_ref_templates_window_failed: DestroyWindow(ref_plugins_window); create_ref_plugins_window_failed: DestroyWindow(ref_syntax_window); create_ref_syntax_window_failed: DestroyIcon(icon); load_reference_icon_failed: free(data); allocate_reference_data_failed: return TSIDE_ERROR_REFERENCE_ERROR; }