LONG TextViewBase::OnLButtonDblClick(UINT nFlags, int mx, int my) { // remove any existing selection InvalidateRange(m_nSelectionStart, m_nSelectionEnd); ULONG lineno, fileoff; int xpos; // map the mouse-coordinates to a real file-offset-coordinate MouseCoordToFilePos(mx, my, &lineno, &fileoff, &xpos); //m_nAnchorPosX = m_nCaretPosX; // move selection-start to start of word MoveWordStart(); m_nSelectionStart = m_nSelectionEnd;// m_nCursorOffset; // move selection-end to end of word MoveWordEnd(); //m_nSelectionEnd = m_nCursorOffset; // update caret position InvalidateRange(m_nSelectionStart, m_nSelectionEnd); //UpdateCaretOffset(m_nCursorOffset, TRUE, &m_nCaretPosX, &m_nCurrentLine); //m_nAnchorPosX = m_nCaretPosX; RepositionCaret(); NotifyParent(TVN_CURSOR_CHANGE); NotifyParent(TVN_SELECTION_CHANGED); return 0; }
LRESULT COXMaskedEdit::OnSetText(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); if(m_listData.GetCount()==0 || GetStyle()&ES_READONLY) { return CEdit::Default(); } CString csNewString=(LPCTSTR)lParam; if(m_nSetTextSemaphor>0) { LRESULT result=CEdit::Default(); NotifyParent(EN_UPDATE); if(m_bNotifyParent) NotifyParent(EN_CHANGE); return result; } else { ASSERT(m_nSetTextSemaphor==0); m_bNotifyParent=FALSE; csNewString=GetInputData(csNewString); SetInputData(csNewString,0,TRUE); m_bNotifyParent=TRUE; return TRUE; } }
// // WM_LBUTTONDOWN // // Set the item position from the specified client coordinates // LRESULT GridView::OnLButtonDown(int x, int y) { ULONG lineNo, colIdx, portion; GVRow *rowptr; RECT rect; // RelayEvent(m_hWndTooltip, WM_LBUTTONDOWN, x, y); if((rowptr = MouseToItem(x, y, &lineNo, &colIdx, &portion, &rect)) == 0) return 0; if(m_hwndEdit) ExitEditMode(FALSE); if((portion & GHT_TREEBUTTON) && rowptr) { ToggleRow(rowptr, lineNo); NotifyParent(GVN_ITEMEXPANDED, rowptr); } else { // have we clicked again in the already selected item? if(m_nCurrentColumn == colIdx && m_nCurrentLine == lineNo) { if(portion & GHT_TEXT) { EnterEditMode(); return 0; } } else { if(m_nCurrentColumn != colIdx) { RefreshWindow(); m_nCurrentColumn = colIdx; } if(m_nCurrentLine != lineNo) { RedrawLine(m_nCurrentLine); RedrawLine(lineNo); m_nCurrentLine = lineNo; } NotifyParent(GVN_SELCHANGED, rowptr); // make an exception - always edit if the combo is clicked on! if(portion & GHT_COMBO) EnterEditMode(); } m_fMouseDown = TRUE; SetCapture(m_hWnd); } return 0; }
void CTreeOptionsCtrlEx::UpdateCheckBoxGroup(HTREEITEM hItem) { SetRedraw(FALSE); //Iterate through all children and if all the checkboxes are checked, then also //automatically check the item. If no checkboxes are checked, then //also automatically uncheck the item. HTREEITEM hParent = hItem; if (hParent && IsCheckBox(hParent)) { BOOL bNoCheckBoxesChecked = TRUE; BOOL bAllCheckBoxesChecked = TRUE; HTREEITEM hChild = GetNextItem(hParent, TVGN_CHILD); while (hChild) { if (IsCheckBox(hChild)) { BOOL bThisChecked; VERIFY(GetCheckBox(hChild, bThisChecked)); bNoCheckBoxesChecked = bNoCheckBoxesChecked && !bThisChecked; bAllCheckBoxesChecked = bAllCheckBoxesChecked && bThisChecked; } //Move on to the next item hChild = GetNextItem(hChild, TVGN_NEXT); } if (bNoCheckBoxesChecked) { BOOL bOldState; GetCheckBox(hParent, bOldState); SetCheckBox(hParent, FALSE); if (bOldState != FALSE) NotifyParent(BN_CLICKED, hParent); } else if (bAllCheckBoxesChecked) { BOOL bOldState; GetCheckBox(hParent, bOldState); SetCheckBox(hParent, FALSE); //gets rid of the semi state SetCheckBox(hParent, TRUE); if (bOldState != TRUE) NotifyParent(BN_CLICKED, hParent); } else { BOOL bEnable; VERIFY(GetCheckBoxEnable(hParent, bEnable)); SetEnabledSemiCheckBox(hParent, bEnable); } } //Reset the redraw flag SetRedraw(TRUE); }
static void ntb_proc (HWND hwnd, int id, int nc, DWORD add_data) { switch (nc) { case IDC_NTB_SKIME: NotifyParent (GetParent(hwnd), id, MGIN_SKIME); break; case IDC_NTB_HWIME: NotifyParent (GetParent(hwnd), id, MGIN_HWIME); break; default: break; }; }
static void pbarNormalizeParams (const CONTROL* pCtrl, PROGRESSDATA* pData, BOOL fNotify) { if (pData->nPos >= pData->nMax) { if (fNotify) NotifyParent ((HWND)pCtrl, pCtrl->id, PBN_REACHMAX); pData->nPos = pData->nMax; } if (pData->nPos <= pData->nMin) { if (fNotify) NotifyParent ((HWND)pCtrl, pCtrl->id, PBN_REACHMIN); pData->nPos = pData->nMin; } }
// NotifyUpdate ------------------------------------------------------------- void CCodeTipFuncHighlightCtrl::NotifyUpdate( UINT unNotify ) { CM_CODETIPFUNCHIGHLIGHTDATA hdr = {0}; if( NotifyParent( unNotify, (LPNMHDR)&hdr ) ) m_nArgument = hdr.nArgument; }
static int add_new_page_normal_style (HWND hwnd, PCONTROL ctrl, PPROPSHEETDATA propsheet, DLGTEMPLATE *dlg, WNDPROC proc) { PPROPPAGE page; int index; if (!(page = calloc (1, sizeof (PROPPAGE)))) { return PS_ERR; } if (!create_page (hwnd, ctrl->dwStyle, propsheet, page, dlg, proc)) { free (page); return PS_ERR; } index = insert_new_page_normal_style (hwnd, propsheet, page, ctrl->dwStyle); NotifyParent (hwnd, ctrl->id, PSN_ACTIVE_CHANGED); show_hide_page (page, SW_SHOW); InvalidateRect (hwnd, &propsheet->head_rc, TRUE); /* dump_propsheetdata (propsheet); */ return index; }
void CNumEdit::RestoreUndoState(const CUndoState& State) { m_Val = State.m_Val.x.f; SetText(); GetParent()->SetFocus(); // keeps accelerators working NotifyParent(); }
// OnChar ------------------------------------------------------------------- BOOL CCodeListCtrl::OnChar( WPARAM wp, LPARAM lp, LRESULT* ) { // Give the parent the first crack at the message CM_CODELISTKEYDATA hdr = {0}; hdr.wChar = wp; hdr.lKeyData = lp; if( NotifyParent( CMN_CODELISTCHAR, (LPNMHDR)&hdr ) ) return TRUE;// handled by parent // See if it's a character we need to handle switch( wp ) { case VK_RETURN: case VK_TAB: case L' ': { AcceptSelection(); } return TRUE;// handled case VK_ESCAPE: { DestroyWindow(); } return TRUE;// handled } return FALSE;// not handled }
void DockingCont::doClose(void) { INT iItemOff = 0; INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0); for (INT iItem = 0; iItem < iItemCnt; iItem++) { TCITEM tcItem = {0}; /* get item data */ SelectTab(iItemOff); tcItem.mask = TCIF_PARAM; ::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem); /* notify child windows */ if (NotifyParent(DMM_CLOSE) == 0) { /* delete tab */ hideToolbar((tTbData*)tcItem.lParam); } else { iItemOff++; } } if (iItemOff == 0) { /* hide dialog first */ this->doDialog(false); ::SendMessage(_hParent, WM_SIZE, 0, 0); } }
void DockingCont::doClose() { int iItemOff = 0; int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0); for (int iItem = 0; iItem < iItemCnt; ++iItem) { TCITEM tcItem = {0}; // get item data SelectTab(iItemOff); tcItem.mask = TCIF_PARAM; ::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem); if (!tcItem.lParam) continue; // notify child windows if (NotifyParent(DMM_CLOSE) == 0) { // delete tab hideToolbar((tTbData*)tcItem.lParam); } else { ++iItemOff; } } if (iItemOff == 0) { // hide dialog first this->doDialog(false); ::SendMessage(_hParent, WM_SIZE, 0, 0); } }
// // WM_LBUTTONDBLCLK // // Double-click handler - expand tree nodes // LRESULT GridView::OnLButtonDblClick(int x, int y) { ULONG lineNo, colIdx, portion; GVRow *rowptr; GVITEM *gvitem; GVCOLUMN *gvcol; // make sure we clicked a valid row/item if((rowptr = MouseToItem(x, y, &lineNo, &colIdx, &portion, 0, &gvitem)) == 0 || gvitem == 0) return 0; if((gvcol = GetColumn(colIdx, 0)) == 0) return 0; // only collapse/expand on double-clicks if the grid is readonly if((portion & (GHT_TREE|GHT_ICON)) || (gvitem->state & GVIS_READONLY) || (gvcol->uState & GVCS_READONLY) || (m_uState & GVS_READONLY)) { ToggleRow(rowptr, lineNo); if(!(portion & (GHT_TREE|GHT_ICON))) NotifyParent(GVN_DBLCLK, rowptr); } // otherwise a double-click should edit the cell else { EnterEditMode(); } return 0; }
bool CHTMLSection::OnNotify( const CSectionABC *pChild, const int nEventID ) { if( NotifyParent( nEventID, pChild ) ) return true; return true; }
void CNumEdit::AddSpin(float Delta) { GetText(); // freshen value before incrementing it m_Val += Delta; SetText(); NotifyParent(); SetModify(); // otherwise kill focus cancels edit }
void uCheckBox::OnLButtonDown(UINT /* nFlags */, CPoint /* point */) { SetCapture(); State ^= UC_STATE_CHECKED; // SetFocus(); REDRAW; NotifyParent(0, State & UC_STATE_CHECKED); // CWnd::OnLButtonDown(nFlags, point); // drop through to default handler }
static void scroll_tab_right (HWND hwnd, PCONTROL ctrl, PPROPSHEETDATA propsheet) { if (propsheet->active->next == NULL) { return; } show_hide_page (propsheet->active, SW_HIDE); propsheet->active = propsheet->active->next; NotifyParent (hwnd, ctrl->id, PSN_ACTIVE_CHANGED); update_propsheet (propsheet); show_hide_page (propsheet->active, SW_SHOW); }
void CNumEdit::OnKillfocus() { if (!GetModify()) { if (!IsUndoInProgress()) CancelUndoableEdit(0); } else { GetText(); SetText(); NotifyParent(); } }
// DestroyWindow ------------------------------------------------------------ BOOL CCodeListCtrl::DestroyWindow() { // Make sure parent doesn't want to prevent window being destroyed. if( m_bAcceptSel || NotifyParent( CMN_CODELISTCANCEL ) ) return FALSE; // Destroy the tool tip if it exists SetTipText( NULL ); return CDispatchWnd::DestroyWindow(); }
void CShadePickerCtrl::SetMark(CPoint pt) { CRect cr; GetClientRect(cr); pt.y = CLAMP(pt.y, cr.top, cr.bottom); PtToHLS(cr, pt, m_hls); DrawMark(FALSE); m_Mark = pt.y; DrawMark(TRUE); UpdateBuddy(); NotifyParent(); }
BOOL CTreeOptionsCtrlEx::SetRadioButton(HTREEITEM hItem) { //Validate our parameters ASSERT(IsRadioButton(hItem)); //Must be a radio item to check it //Iterate through the sibling items and turn them all off except this one HTREEITEM hParent = GetNextItem(hItem, TVGN_PARENT); ASSERT(IsGroup(hParent)); //Parent item must be a group item //Iterate through the child items and turn on the specified one and turn off all the other ones HTREEITEM hChild = GetNextItem(hParent, TVGN_CHILD); //Turn of redraw to Q all the changes we're going to make here SetRedraw(FALSE); while (hChild) { //if we reach a non radio button then break out of the loop if (!IsRadioButton(hChild)) break; if (hChild == hItem) { //Turn this item on BOOL bOldState; GetRadioButton(hChild, bOldState); BOOL bSuccess = SetItemImage(hChild, 3, 3); ASSERT(bSuccess); if (!bOldState) NotifyParent(BN_CLICKED, hChild); } else { BOOL bEnable; VERIFY(GetRadioButtonEnable(hChild, bEnable)); //Turn this item off if (bEnable) VERIFY(SetItemImage(hChild, 2, 2)); else VERIFY(SetItemImage(hChild, 6, 6)); } //Move on to the next item hChild = GetNextItem(hChild, TVGN_NEXT); } //Reset the redraw flag SetRedraw(TRUE); return TRUE; }
BOOL CTreeOptionsCtrlEx::SetRadioButton(HTREEITEM hParent, int nIndex) { //Validate our parameters ASSERT(IsGroup(hParent)); //Parent item must be a group item //Iterate through the child items and turn on the specified one and turn off all the other ones HTREEITEM hChild = GetNextItem(hParent, TVGN_CHILD); //Turn of redraw to Q all the changes we're going to make here SetRedraw(FALSE); int i=0; BOOL bCheckedSomeItem = FALSE; while (hChild) { //if we reach a non radio button then break out of the loop if (!IsRadioButton(hChild)) break; if (i == nIndex) { //Turn this item on BOOL bOldState; GetRadioButton(hChild, bOldState); VERIFY(SetItemImage(hChild, 3, 3)); bCheckedSomeItem = TRUE; if (!bOldState) NotifyParent(BN_CLICKED, hChild); } else { BOOL bEnable; VERIFY(GetRadioButtonEnable(hChild, bEnable)); //Turn this item off if (bEnable) VERIFY(SetItemImage(hChild, 2, 2)); else VERIFY(SetItemImage(hChild, 4, 4)); } //Move on to the next item hChild = GetNextItem(hChild, TVGN_NEXT); ++i; } ASSERT(bCheckedSomeItem); //You specified an index which does not exist //Reset the redraw flag SetRedraw(TRUE); return TRUE; }
void CHTMLSection::SetCurrentFocus( CFocusControlABC *pFocus, bool bScrollIntoView ) { if( m_pFocus ) { m_pFocus->SetFocus( false ); } m_pFocus = pFocus; if( m_pFocus ) { m_pFocus->SetFocus( true ); if( bScrollIntoView ) { // // Now we need to ensure that our focused section is visible WinHelper::CRect rcBounds; m_pFocus->GetObjectRect( rcBounds ); bool bChanged = false; if( rcBounds.Height() > Height() ) { SetPos( rcBounds.top ); bChanged = true; } else { rcBounds.Offset( GetScrollPosH(), GetScrollPos() ); int nPos = GetScrollPos(); int nBottom = nPos + Height(); if( rcBounds.top < nPos ) { ScrollV( rcBounds.top - nPos ); bChanged = true; } else if( rcBounds.bottom > nBottom ) { ScrollV( rcBounds.bottom - nBottom ); bChanged = true; } } if( bChanged ) { ForceRedraw(); NotifyParent( 1 ); } } } }
LRESULT OnMouseMove(HWND hwnd, LONG x, LONG /*y*/, Slider_Info *pInfo) { // If the control is selected, update the slider position // and notify the owner window. if (pInfo->bThumbDown) { SetSliderPosition(hwnd, PixelToLogical(hwnd, x, pInfo), pInfo); NotifyParent(hwnd, SLIDER_NOTIFY_DRAG, pInfo); } return 0; }
static void OnUpArrow (HWND hWnd, PSPINDATA pData, int id, DWORD dwStyle, DWORD wParam) { if ((dwStyle & SPS_AUTOSCROLL)) { if (pData->spinfo.cur > pData->spinfo.min ) { pData->spinfo.cur --; PostMessage ( pData->hTarget, MSG_KEYDOWN, SCANCODE_CURSORBLOCKUP, (wParam|KS_SPINPOST)); PostMessage ( pData->hTarget, MSG_KEYUP, SCANCODE_CURSORBLOCKUP, (wParam|KS_SPINPOST)); if ( pData->spinfo.cur <= pData->spinfo.min ) { NotifyParent ( hWnd, id, SPN_REACHMIN); } } } else { if (pData->canup) { pData->spinfo.cur --; PostMessage ( pData->hTarget, MSG_KEYDOWN, SCANCODE_CURSORBLOCKUP, wParam|KS_SPINPOST); PostMessage ( pData->hTarget, MSG_KEYUP, SCANCODE_CURSORBLOCKUP, wParam|KS_SPINPOST); if ( pData->spinfo.cur <= pData->spinfo.min ) { NotifyParent ( hWnd, id, SPN_REACHMIN); } } } }
static void OnDownArrow (HWND hWnd, PSPINDATA pData, int id, DWORD dwStyle, DWORD wParam) { if ((dwStyle & SPS_AUTOSCROLL)) { if (pData->spinfo.cur < pData->spinfo.max) { pData->spinfo.cur ++; PostMessage ( pData->hTarget, MSG_KEYDOWN, SCANCODE_CURSORBLOCKDOWN, wParam|KS_SPINPOST); PostMessage ( pData->hTarget, MSG_KEYUP, SCANCODE_CURSORBLOCKDOWN, wParam|KS_SPINPOST); if ( pData->spinfo.cur >= pData->spinfo.max) { NotifyParent ( hWnd, id, SPN_REACHMAX); } } } else { if (pData->candown) { pData->spinfo.cur ++; PostMessage ( pData->hTarget, MSG_KEYDOWN, SCANCODE_CURSORBLOCKDOWN, wParam|KS_SPINPOST); PostMessage ( pData->hTarget, MSG_KEYUP, SCANCODE_CURSORBLOCKDOWN, wParam|KS_SPINPOST); if ( pData->spinfo.cur >= pData->spinfo.max) { NotifyParent ( hWnd, id, SPN_REACHMAX); } } } }
void CTreeOptionsCtrlEx::HandleCheckBox(HTREEITEM hItem, BOOL bCheck) { //Turn of redraw to Q all the changes we're going to make here SetRedraw(FALSE); //Toggle the state BOOL bOldState; GetCheckBox(hItem, bOldState); VERIFY(SetCheckBox(hItem, !bCheck)); if (bOldState != !bCheck) NotifyParent(BN_CLICKED, hItem); //If the item has children, then iterate through them and for all items //which are check boxes set their state to be the same as the parent HTREEITEM hChild = GetNextItem(hItem, TVGN_CHILD); while (hChild) { if (IsCheckBox(hChild)){ BOOL bThisChecked; GetCheckBox(hChild, bThisChecked); SetCheckBox(hChild, !bCheck); if (bThisChecked != !bCheck) NotifyParent(BN_CLICKED, hChild); } //Move on to the next item hChild = GetNextItem(hChild, TVGN_NEXT); } //Get the parent item and if it is a checkbox, then iterate through //all its children and if all the checkboxes are checked, then also //automatically check the parent. If no checkboxes are checked, then //also automatically uncheck the parent. HTREEITEM hParent = GetNextItem(hItem, TVGN_PARENT); UpdateCheckBoxGroup(hParent); //Reset the redraw flag SetRedraw(TRUE); }
LRESULT OnLButtonDown(HWND hwnd, LONG x, LONG /*y*/, Slider_Info *pInfo) { // Move the slider to the mouse position. SetSliderPosition(hwnd, PixelToLogical(hwnd, x, pInfo), pInfo); // Set the thumb-down flag. pInfo->bThumbDown = TRUE; // Start capturing mouse moves so we can update the slider position. SetCapture(hwnd); // Notify the owner window that the control was selected. NotifyParent(hwnd, SLIDER_NOTIFY_SELECT, pInfo); return 0; }
BOOL TextViewBase::Redo() { if(m_nEditMode == MODE_READONLY) return FALSE; if(!m_pTextDoc->Redo(&m_nSelectionStart, &m_nSelectionEnd)) return FALSE; //m_nCursorOffset = m_nSelectionEnd; ResetLineCache(); RefreshWindow(); Smeg(m_nSelectionStart != m_nSelectionEnd); NotifyParent(TVN_CHANGED); return TRUE; }
/////////////////////////////////////////////////////////////////////////////// // OnClicked void CXHyperLink::OnClicked() { m_bOverControl = FALSE; int result = HINSTANCE_ERROR + 1; if (m_bIsURLEnabled) result = (int)(INT_PTR)GotoURL(m_strURL, SW_SHOW, m_bAlwaysOpenNew); m_bVisited = (result > HINSTANCE_ERROR); if (!m_bVisited) { MessageBeep(MB_ICONEXCLAMATION); // Unable to follow link ReportError(result); } else SetVisited(); // Repaint to show visited colour NotifyParent(); }