// --------------------------------------------------------------------------- // // ------------ void bvDefScaleRef::wd_init(WindowRef wd){ _idx=1; read(); ControlRef c; if(_set==1){ c=get_control(kvDefScaleRefViewSignature,kvDefScaleRefTypeNameLegendID); HideControl(c); c=get_control(kvDefScaleRefViewSignature,kvDefScaleRefTypeNameID); HideControl(c); } else{ c=get_control(kvDefScaleRefViewSignature,kvDefScaleRefTypeNameID); char name[256]; if(_tp){ _tp->name(name); } else{ message_string(kMsgVirtual,name,1); } SetTextControlValue(c,name); } c=get_control(kvDefScaleRefViewSignature,kvDefScaleRefPopupID); PopulatePopupControlWithScales(_gapp,c,_idx); }
void CTDLFindTaskExpressionListCtrl::OnKillFocus(CWnd* pNewWnd) { CInputListCtrl::OnKillFocus(pNewWnd); if (pNewWnd != &m_dtDate) HideControl(m_dtDate); if (pNewWnd != &m_eTime) HideControl(m_eTime); }
/* OnInitDone * ---------------------------------------------------------------------------- */ void CFolderDialog::OnInitDone() { HideControl(stc2); HideControl(cmb1); CWnd* pFD = GetParent(); LCID lcid = GetSystemDefaultLCID(); switch(PRIMARYLANGID(LANGIDFROMLCID(lcid))) { default: case LANG_ENGLISH: SetControlText(stc3, "Folder:"); SetControlText(IDOK, "&Select"); pFD->SetWindowText("Select Folder"); break; case LANG_GERMAN: SetControlText(stc3, "Verzeichnis:"); SetControlText(IDOK, "&Auswahl"); pFD->SetWindowText("Verzeichnis auswählen"); break; } SetControlText(edt1, m_sSelPath); CRect rStatic; pFD->GetDlgItem(stc3)->GetWindowRect(rStatic); pFD->ScreenToClient(rStatic); rStatic.right -= 10; pFD->GetDlgItem(stc3)->SetWindowPos(0, 0, 0, rStatic.Width(), rStatic.Height(), SWP_NOMOVE | SWP_NOZORDER); CRect rectCancel; pFD->GetDlgItem(IDCANCEL)->GetWindowRect(rectCancel); pFD->ScreenToClient(rectCancel); CRect rectOK; pFD->GetDlgItem(IDOK)->GetWindowRect(rectOK); pFD->ScreenToClient(rectOK); pFD->GetDlgItem(IDOK)->SetWindowPos(0,rectCancel.left - rectOK.Width() - 4, rectCancel.top, 0,0, SWP_NOZORDER | SWP_NOSIZE); CRect rList; pFD->GetDlgItem(lst1)->GetWindowRect(rList); pFD->ScreenToClient(rList); CRect rEdit; pFD->GetDlgItem(edt1)->GetWindowRect(rEdit); pFD->ScreenToClient(rEdit); rEdit.left = rStatic.right + 10; pFD->GetDlgItem(edt1)->SetWindowPos(0, rEdit.left, rEdit.top, rList.right - rEdit.left, rEdit.Height(), SWP_NOZORDER); m_fpWndProcDiag = (WNDPROC)SetWindowLong(pFD->m_hWnd, GWL_WNDPROC, (long)WindowProcDiag); m_fpWndProcEdit = (WNDPROC)SetWindowLong(pFD->GetDlgItem(edt1)->m_hWnd, GWL_WNDPROC, (long)WindowProcEdit); }
// --------------------------------------------------------------------------- // // ----------- void bToolPrintArea::pop_kind_action(WindowRef wd){ ControlRef c; ControlID cid={kPrintAreaSignature,0}; int k; put_area(wd); cid.id=kPrintAreaPopKindID; GetControlByID(wd,&cid,&c); k=GetControl32BitValue(c); switch(k){ case kPrintAreaPopKindMenuGeo: set_as_geo(wd); cid.id=kPrintAreaFrameCustomSizeID; GetControlByID(wd,&cid,&c); ShowControl(c); cid.id=kPrintAreaFrameStandardSizeID; GetControlByID(wd,&cid,&c); HideControl(c); break; case kPrintAreaPopKindMenuPix: set_as_pix(wd); cid.id=kPrintAreaFrameCustomSizeID; GetControlByID(wd,&cid,&c); ShowControl(c); cid.id=kPrintAreaFrameStandardSizeID; GetControlByID(wd,&cid,&c); HideControl(c); break; case kPrintAreaPopKindMenuCustom: set_as_ppsz(wd); cid.id=kPrintAreaFrameCustomSizeID; GetControlByID(wd,&cid,&c); ShowControl(c); cid.id=kPrintAreaFrameStandardSizeID; GetControlByID(wd,&cid,&c); HideControl(c); break; case kPrintAreaPopKindMenuStandard: cid.id=kPrintAreaFrameCustomSizeID; GetControlByID(wd,&cid,&c); HideControl(c); cid.id=kPrintAreaFrameStandardSizeID; GetControlByID(wd,&cid,&c); ShowControl(c); cid.id=kPrintAreaPopSizeID; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_pprkind); break; } _sizekind=k; }
BOOL CTDLFindTaskExpressionListCtrl::OnSelItemChanged(NMHDR* /*pNMHDR*/, LRESULT* pResult) { // NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // int nRow = pNMListView->iItem; // always make sure we hide the datetime ctrl and the time edit HideControl(m_dtDate); HideControl(m_eTime); *pResult = 0; return FALSE; // continue routing }
BOOL CTDLFindTaskExpressionListCtrl::OnSelItemChanged(NMHDR* /*pNMHDR*/, LRESULT* pResult) { // always make sure we hide our non-default controls HideControl(m_dtcDate); HideControl(m_eTime); HideControl(m_cbListValues); HideControl(m_cbPriority); HideControl(m_cbRisk); *pResult = 0; return FALSE; // continue routing }
static void window_adjust_scrollbars(WindowRef windowRef) { IMAGE *img; Rect portRect; img = (IMAGE*)GetWRefCon(windowRef); GetWindowPortBounds(windowRef,&portRect); /* Move the crollbars to the edges of the window */ HideControl(img->scrollbarVertRef); HideControl(img->scrollbarHorizRef); MoveControl(img->scrollbarVertRef,portRect.right - kScrollBarWidth, portRect.top - 1); MoveControl(img->scrollbarHorizRef,portRect.left - 1, portRect.bottom - kScrollBarWidth); SizeControl(img->scrollbarVertRef,kScrollBarWidth + 1, portRect.bottom - portRect.top - kScrollBarWidth + 1); SizeControl(img->scrollbarHorizRef, portRect.right - portRect.left - kScrollBarWidth + 1, kScrollBarWidth + 1); /* Adjust the scroll position showing */ if (img->pixmapHdl) { PixMap *pixmap = *(img->pixmapHdl); int visibleHeight = portRect.bottom - portRect.top - kScrollBarWidth; int visibleWidth = portRect.right - portRect.left - kScrollBarWidth; if (pixmap->bounds.bottom > visibleHeight) { SetControl32BitMaximum(img->scrollbarVertRef, pixmap->bounds.bottom - visibleHeight); SetControlViewSize(img->scrollbarVertRef,visibleHeight); } else SetControlMaximum(img->scrollbarVertRef, 0); if (pixmap->bounds.right > visibleWidth) { SetControl32BitMaximum(img->scrollbarHorizRef, pixmap->bounds.right - visibleWidth); SetControlViewSize(img->scrollbarHorizRef, visibleWidth); } else SetControlMaximum(img->scrollbarHorizRef, 0); } ShowControl(img->scrollbarVertRef); ShowControl(img->scrollbarHorizRef); }
void CTDLFindTaskExpressionListCtrl::OnAttribEditOK() { HideControl(m_cbAttributes); // update item text and keep data store synched int nRow = GetCurSel(); if (nRow != CB_ERR) { SEARCHPARAM& sp = m_aSearchParams[nRow]; SEARCHPARAM spNew(sp); if (m_cbAttributes.GetSelectedAttribute(spNew)) { sp = spNew; // update list text CString sAttrib = m_cbAttributes.GetSelectedAttributeText(); SetItemText(nRow, ATTRIB, sAttrib); // clear the operator cell text if the operator was no longer valid if (sp.OperatorIs(FOP_NONE)) SetItemText(nRow, OPERATOR, _T("")); UpdateValueColumnText(nRow); ValidateListData(); } } }
void CTDLFindTaskExpressionListCtrl::OnOperatorEditOK() { HideControl(m_cbOperators); // update operator type int nSel = m_cbOperators.GetCurSel(); if (nSel != CB_ERR) { CString sSel; m_cbOperators.GetLBText(nSel, sSel); int nRow = GetCurSel(); SetItemText(nRow, OPERATOR, sSel); // keep data store synched SEARCHPARAM& rule = m_aSearchParams[nRow]; FIND_OPERATOR nNewOp = (FIND_OPERATOR)m_cbOperators.GetItemData(nSel); rule.SetOperator(nNewOp); // if the op is set/notset then clear the field if (nNewOp == FOP_SET || nNewOp == FOP_NOT_SET) { rule.ClearValue(); } UpdateValueColumnText(nRow); ValidateListData(); } }
void CTDLFindTaskExpressionListCtrl::OnDateCloseUp(NMHDR* /*pNMHDR*/, LRESULT* pResult) { // LPNMDATETIMECHANGE pDTHDR = (LPNMDATETIMECHANGE)pNMHDR; HideControl(m_dtDate); *pResult = 0; }
void CTDLFindTaskExpressionListCtrl::HideAllControls(const CWnd* pWndIgnore) { if (!pWndIgnore || ((pWndIgnore != &m_dtcDate) && (pWndIgnore != m_dtcDate.GetMonthCalCtrl()))) HideControl(m_dtcDate); if (!pWndIgnore || (pWndIgnore != &m_eTime)) HideControl(m_eTime); if (!pWndIgnore || (pWndIgnore != &m_cbListValues)) HideControl(m_cbListValues); if (!pWndIgnore || (pWndIgnore != &m_cbPriority)) HideControl(m_cbPriority); if (!pWndIgnore || (pWndIgnore != &m_cbRisk)) HideControl(m_cbRisk); }
//----------------------------------------------------------------------------- // Function Name: RFolderDialog::OnInitDialog() // // Description: Initialize Dialog // // Returns: Always TRUE. //----------------------------------------------------------------------------- BOOL RFolderDialog::OnInitDialog() { CFileDialog::OnInitDialog(); // Hide Controls we don't want HideControl(1136); HideControl(1040); HideControl(1152); HideControl(1089); HideControl(1090); HideControl(1); // Open HideControl(2); // Cancel CString strDir; strDir.LoadString(STRING_SELECT_DIRECTORY); GetParent()->SetWindowText( (LPCTSTR)strDir ); m_ctlPageSize.AddString( "100%" ); m_ctlPageSize.AddString( "90%" ); m_ctlPageSize.AddString( "80%" ); m_ctlPageSize.AddString( "70%" ); m_ctlPageSize.AddString( "60%" ); m_ctlPageSize.AddString( "50%" ); m_ctlPageSize.SetCurSel( 0 ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
// Function name : CFolderDialog::OnInitDone // Description : For update the wiew of CFileDialog // Return type : void void CFolderDialog::OnInitDone() { HideControl(edt1); HideControl(stc3); HideControl(cmb1); HideControl(stc2); CWnd* pFD = GetParent(); CRect rectCancel; pFD->GetDlgItem(IDCANCEL)->GetWindowRect(rectCancel); pFD->ScreenToClient(rectCancel); CRect rectOK; pFD->GetDlgItem(IDOK)->GetWindowRect(rectOK); pFD->ScreenToClient(rectOK); pFD->GetDlgItem(IDOK)->SetWindowPos(0,rectCancel.left - rectOK.Width() - 4, rectCancel.top, 0,0, SWP_NOZORDER | SWP_NOSIZE); CRect rectList2; pFD->GetDlgItem(lst1)->GetWindowRect(rectList2); pFD->ScreenToClient(rectList2); pFD->GetDlgItem(lst1)->SetWindowPos(0,0,0,rectList2.Width(), abs(rectList2.top - (rectCancel.top - 4)), SWP_NOMOVE | SWP_NOZORDER); SetControlText(IDOK, _T("Select")); pFD->SetWindowText(_T("Choose folder")); m_wndProc = (WNDPROC)SetWindowLong(pFD->m_hWnd, GWL_WNDPROC, (long)WindowProcNew); }
void CTDLFindTaskExpressionListCtrl::OnRiskEditOK() { HideControl(m_cbRisk); // update value int nRow = GetCurSel(); int nRisk = m_cbRisk.GetSelectedRisk(); // keep data store synched m_aSearchParams[nRow].SetValue(nRisk); UpdateValueColumnText(nRow); }
void CTDLFindTaskExpressionListCtrl::OnListValuesEditOK() { HideControl(m_cbListValues); // update rule and cell text int nRow = GetCurSel(); CStringArray aSel; m_cbListValues.GetChecked(aSel); m_aSearchParams[nRow].SetValue(Misc::FormatArray(aSel)); UpdateValueColumnText(nRow); }
void HideMediaPanel( struct my_button *media ) { INDEX idx; struct media_control_panel *panel; LIST_FORALL( l.controls, idx, struct media_control_panel *, panel ) { if( panel->media == media ) break; } if( panel ) { HideControl( panel->panel ); } }
void DFUFileDialog::OnInitDone() { CWnd *parent = GetParent(); // Hide the filter combo control and label HideControl(stc2); HideControl(cmb1); // Set the OK control text CString ok; ok.Format(m_bOpenFileDialog ? IDS_FILE_OK_OPEN : IDS_FILE_OK_SAVE); parent->GetDlgItem(IDOK)->SetWindowText(ok); // Restore the dialog to its original size RECT rect; parent->GetWindowRect(&rect); parent->MoveWindow(rect.left, rect.top, rect.right - rect.left, (rect.bottom - rect.top) - extraHeight, true); }
/* Update procedure for textedit window */ short NATEupdatep(na_win *winp, Boolean newsize) { TEHandle hTE = teinfo->hTE; WindowPtr window = winp->pwin; Rect prect, vrect, hrect, drect; prect = window->portRect; prect.top += teinfo->topoff; EraseRect(&prect); hrect = vrect = prect; vrect.top--; hrect.left--; vrect.left = ++vrect.right - 16; hrect.top = ++hrect.bottom - 16; vrect.bottom -= 14; hrect.right -= 14; InsetRect(&prect, 4, 4); prect.right -= 15; if (!(winp->flags & NATE_NOHSCROLL)) prect.bottom -= 15; prect.bottom -= (prect.bottom - prect.top) % teinfo->lheight; if (newsize) { drect = (*hTE)->viewRect = prect; drect.right = drect.left + (short) teinfo->docwidth; (*hTE)->destRect = drect; RectRgn(winp->cursorRgn, &prect); OffsetRgn(winp->cursorRgn, -window->portBits.bounds.left, -window->portBits.bounds.top); TECalText(hTE); TESelView(hTE); if (teinfo->hctrl != (ControlHandle) NULL) HideControl(teinfo->hctrl); if (teinfo->vctrl != (ControlHandle) NULL) HideControl(teinfo->vctrl); } TEUpdate(&prect, hTE); if (newsize) NATEsetscroll(winp, true, &hrect, &vrect); return (NA_NOTPROCESSED); }
// Also here some of the size calculations should go to the back end, and their actual application to a front-end routine void ResizeWindowControls( int mode ) { HWND hDlg = engineOutputDialog; // [HGM] used to be parameter, but routine is called from back-end RECT rc; int headerHeight = GetHeaderHeight(); // int labelHeight = GetControlHeight( hDlg, IDC_EngineLabel1 ); // int labelOffset = H_MARGIN + ICON_SIZE + H_MARGIN; // int labelDeltaY = ICON_SIZE - labelHeight; int clientWidth; int clientHeight; int maxControlWidth; int npsWidth; /* Initialize variables */ GetClientRect( hDlg, &rc ); clientWidth = rc.right - rc.left; clientHeight = rc.bottom - rc.top; maxControlWidth = clientWidth - 2*H_MARGIN; npsWidth = GetControlWidth( hDlg, IDC_Engine1_NPS ); /* Resize controls */ if( mode == 0 ) { /* One engine */ PositionControlSet( hDlg, H_MARGIN, V_MARGIN, clientWidth, clientHeight - V_MARGIN - LABEL_V_DISTANCE - headerHeight- V_MARGIN, IDC_Color1, IDC_EngineLabel1, IDC_Engine1_NPS, IDC_EngineMemo1, IDC_StateIcon1, IDC_StateData1 ); /* Hide controls for the second engine */ HideControl( hDlg, IDC_Color2 ); HideControl( hDlg, IDC_EngineLabel2 ); HideControl( hDlg, IDC_StateIcon2 ); HideControl( hDlg, IDC_StateData2 ); HideControl( hDlg, IDC_Engine2_NPS ); HideControl( hDlg, IDC_EngineMemo2 ); SendDlgItemMessage( hDlg, IDC_EngineMemo2, WM_SETTEXT, 0, (LPARAM) "" ); /* TODO: we should also hide/disable them!!! what about tab stops?!?! */ } else { /* Two engines */ int memo_h = (clientHeight - headerHeight*2 - V_MARGIN*2 - LABEL_V_DISTANCE*2 - SPLITTER_SIZE) / 2; int header1_y = V_MARGIN; int header2_y = V_MARGIN + headerHeight + LABEL_V_DISTANCE + memo_h + SPLITTER_SIZE; PositionControlSet( hDlg, H_MARGIN, header1_y, clientWidth, memo_h, IDC_Color1, IDC_EngineLabel1, IDC_Engine1_NPS, IDC_EngineMemo1, IDC_StateIcon1, IDC_StateData1 ); PositionControlSet( hDlg, H_MARGIN, header2_y, clientWidth, memo_h, IDC_Color2, IDC_EngineLabel2, IDC_Engine2_NPS, IDC_EngineMemo2, IDC_StateIcon2, IDC_StateData2 ); } InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo1), NULL, FALSE ); InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo2), NULL, FALSE ); }
void CTDLFindTaskExpressionListCtrl::OnAndOrEditOK() { HideControl(m_cbAndOr); // update operator type int nSel = m_cbAndOr.GetCurSel(); if (nSel != CB_ERR) { CString sSel; m_cbAndOr.GetLBText(m_cbAndOr.GetCurSel(), sSel); int nRow = GetCurSel(); SetItemText(nRow, ANDOR, sSel); // keep data store synched m_aSearchParams[nRow].SetAnd(m_cbAndOr.GetItemData(nSel)); ValidateListData(); } }
static void MoveSpotActionProc(ControlRef theControl, ControlPartCode partCode) { Rect bounds; GetControlBounds(theControl, &bounds); Point thePoint; if (partCode == kControlButtonPart) { GetMouse(&thePoint); gUserH = thePoint.h; gUserV = thePoint.v; if (gUserH < bounds.left+4) gUserH = bounds.left+4; if (gUserH > bounds.right-4) gUserH = bounds.right-4; if (gUserV < bounds.top+4) gUserV = bounds.top+4; if (gUserV > bounds.bottom-4) gUserV = bounds.bottom-4; // the erasing/drawing management is very complex to do properly // unless we just Hide and Show. This technique is OK if the control // is not too big on the screen and the machine is fast enough to // prevent flicker. If not then a better tracking would require // clipping management and calling the User Pane Draw Proc. HideControl(theControl); ShowControl(theControl); } }
void CTDLFindTaskExpressionListCtrl::OnRiskEditCancel() { HideControl(m_cbRisk); }
void CTDLFindTaskExpressionListCtrl::OnPriorityEditCancel() { HideControl(m_cbPriority); }
void CTDLFindTaskExpressionListCtrl::OnListValuesEditCancel() { HideControl(m_cbListValues); }
void CTDLFindTaskExpressionListCtrl::OnOperatorEditCancel() { HideControl(m_cbOperators); }
void CTDLFindTaskExpressionListCtrl::OnAttribEditCancel() { HideControl(m_cbAttributes); }
void CTDLFindTaskExpressionListCtrl::OnDateCloseUp(NMHDR* /*pNMHDR*/, LRESULT* pResult) { HideControl(m_dtcDate); *pResult = 0; }
void CTDLFindTaskExpressionListCtrl::OnAndOrEditCancel() { HideControl(m_cbAndOr); }
void HideTheControl ( int iControlID ) { HideControl ( iControlID ); SetFocus ( hwndOriginalParent ); }
void CDirDialog::OnInitDone() { CRect rct; // Used to move/resize controls CWnd *pp; // Parent = the dialog window itself VERIFY(pp = GetParent()); ASSERT(pp->GetDlgItem(stc3) != NULL); pp->GetDlgItem(stc3)->SetWindowText(_T("Folder:")); // Create a new CDlgWnd so we can catch dialog control notifications VERIFY(m_DlgWnd.SubclassWindow(pp->m_hWnd)); // Create a new edit control where edt1 now is ASSERT(pp->GetDlgItem(edt1) != NULL); pp->GetDlgItem(edt1)->GetWindowRect(rct); //Get edt1 rectangle pp->ScreenToClient(rct); VERIFY(m_Edit.Create(WS_TABSTOP | WS_VISIBLE | WS_CHILD, rct, pp, IDC_DIR)); if (m_ofn.lpstrInitialDir != NULL) m_Edit.SetWindowText(m_ofn.lpstrInitialDir); m_Edit.SetFont(pp->GetDlgItem(edt1)->GetFont()); m_Edit.ModifyStyleEx(0, WS_EX_CLIENTEDGE, SWP_DRAWFRAME); m_Edit.SetWindowPos(pp->GetDlgItem(stc3), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); // m_Edit.SetSel(0, strlen(m_ofn.lpstrInitialDir)); CWnd *pCancel = pp->GetDlgItem(IDCANCEL); ASSERT(pCancel != NULL); // Create a new button where the OK button now is ASSERT(pp->GetDlgItem(IDOK) != NULL); pp->GetDlgItem(IDOK)->GetWindowRect(rct); //Get OK button rectangle pp->ScreenToClient(rct); m_Open.Create(_T("Open"), WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, rct, pp, IDC_OPEN); m_Open.SetFont(pp->GetDlgItem(IDOK)->GetFont()); m_Open.SetWindowPos(&m_Edit, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); pCancel->SetWindowPos(&m_Open, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); // Change default push button pp->GetDlgItem(IDOK)->ModifyStyle(BS_DEFPUSHBUTTON, 0); pp->SendMessage(DM_SETDEFID, IDC_OPEN); #ifdef DIRDIALOG_TESTING // Move controls (rather than hide them) for testing // Increase size of dialog pp->GetWindowRect(rct); pp->SetWindowPos(NULL, 0, 0, rct.Width(), rct.Height() + 70, SWP_NOZORDER | SWP_NOMOVE); // Move the replaced controls down ASSERT(pp->GetDlgItem(IDOK) != NULL); pp->GetDlgItem(IDOK)->GetWindowRect(rct); pp->ScreenToClient(rct); pp->GetDlgItem(IDOK)->SetWindowPos(NULL, rct.left, rct.top+70, 0, 0, SWP_NOZORDER | SWP_NOSIZE); ASSERT(pp->GetDlgItem(edt1) != NULL); pp->GetDlgItem(edt1)->GetWindowRect(rct); pp->ScreenToClient(rct); pp->GetDlgItem(edt1)->SetWindowPos(NULL, rct.left, rct.top+70, 0, 0, SWP_NOZORDER | SWP_NOSIZE); #else // Hide the controls we don't want the user to use HideControl(IDOK); HideControl(edt1); #endif CFileDialog::OnInitDone(); }