bool MenuBar::EventFocus(bool recv) { if (recv) { if (select<0 || select>=list.count()) SetSelect(0); } else if (!sub.ptr()) SetSelect(-1); return true; }
bool MenuBar::EventMouse(cevent_mouse* pEvent) { int n; if (pEvent->Type() == EV_MOUSE_PRESS) { n = GetPointItem(pEvent->Point()); if (n>=0) { SetSelect(n); OpenSub(); return true; } if (sub.ptr()) { crect rect = ScreenRect(); crect sr = sub->ScreenRect(); pEvent->Point().x += rect.left - sr.left; pEvent->Point().y += rect.top - sr.top; if (sub->EventMouse(pEvent)) return true; SetSelect(-1); if (Parent()) Parent()->Command(CMD_MENU_INFO, SCMD_MENU_CANCEL, this, 0); } return true; } else if (pEvent->Type() == EV_MOUSE_MOVE) { n = GetPointItem(pEvent->Point()); if (n>=0) { if (lastMouseSelect != n) { lastMouseSelect = n; SetSelect(n); } return true; } if (!sub.ptr() && !InFocus()) { lastMouseSelect = -1; SetSelect(-1); return true; } if (sub.ptr()) { crect rect = ScreenRect(); crect sr = sub->ScreenRect(); pEvent->Point().x += rect.left - sr.left; pEvent->Point().y += rect.top - sr.top; return sub->EventMouse(pEvent); } return true; } return false; }
void XGPopMenuView::MoveUp() { fDefault = fLocation; if (fDefault > 0) fDefault--; fScrollFlag = false; SetSelect(fDefault); }
void IconDes::CancelSelect() { ReleaseCapture(); doselection = false; rgbactrl.Mask(false); FinishPaste(); SetSelect(255); SetBar(); }
void XGPopMenuView::MoveDown() { short len = fList->GetNumStrings() - 1; fDefault = fLocation; fDefault++; if (fDefault > len) fDefault = len; fScrollFlag = false; SetSelect(fDefault); }
bool MenuBar::Command(int id, int subId, Win *win, void *d) { if (id == CMD_CHECK) return Parent() ? Parent()->Command(id,subId,this,d) : false; SetSelect(-1); if (IsModal()) EndModal(id); return (Parent()) ? Parent()->Command(id, subId, win, d) : false; }
FX_BOOL CPWL_IconList_Content::OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) { if (m_bMouseDown) { int32_t nItemIndex = FindItemIndex(point); SetSelect(nItemIndex); ScrollToItem(nItemIndex); } return TRUE; }
FX_BOOL CPWL_IconList_Content::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) { switch (nChar) { case FWL_VKEY_Up: if (m_nSelectIndex > 0) { int32_t nItemIndex = m_nSelectIndex - 1; SetSelect(nItemIndex); ScrollToItem(nItemIndex); } return TRUE; case FWL_VKEY_Down: if (m_nSelectIndex < m_nListCount - 1) { int32_t nItemIndex = m_nSelectIndex + 1; SetSelect(nItemIndex); ScrollToItem(nItemIndex); } return TRUE; } return FALSE; }
void CMlsSimpleBitmapButton::OnMouseMove(UINT nFlags, CPoint point) { // The user is moving the mouse around willy-nilly. If the mouse is // moved off the button, pop it up until it's moved back on. if (GetCapture() == this) { CRect crClient; GetClientRect(crClient); SetSelect(crClient.PtInRect(point)); } }
void XGPopMenuView::MoveTo(short len, char *ptr) { char buffer[256]; char cptr[256]; short i,num; short cur = -1; if (len == 0) return; // Huh? /* * Find the smallest bigger than this ptr */ num = fList->GetNumStrings(); for (i = 0; i < num; i++) { fList->GetString(i,buffer); if (-1 < CompareStrings(len,ptr,buffer)) { if (cur == -1) { cur = i; strcpy(cptr,buffer); } else if (-1 < CompareStrings(strlen(buffer),buffer,cptr)) { cur = i; strcpy(cptr,buffer); } } } if (cur == -1) { /* * None were bigger, so find the last in alphabetical order */ for (i = 0; i < num; i++) { fList->GetString(i,buffer); if (cur == -1) { cur = i; strcpy(cptr,buffer); } else if (-1 < CompareStrings(strlen(cptr),cptr,buffer)) { cur = i; strcpy(ptr,buffer); } } } /* * Now set this as the selection */ fDefault = cur; fScrollFlag = false; SetSelect(fDefault); }
FX_BOOL CPWL_IconList_Content::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { SetFocus(); SetCapture(); m_bMouseDown = TRUE; int32_t nItemIndex = FindItemIndex(point); SetSelect(nItemIndex); ScrollToItem(nItemIndex); return TRUE; }
void IconDes::Select() { if(!IsCurrent()) return; ReleaseCapture(); FinishPaste(); doselection = !doselection; rgbactrl.Mask(doselection); if(doselection && SelectionRect() == GetImageSize()) { SetSelect(0); rgbactrl.MaskSet(255); } Refresh(); SetBar(); }
void CMlsSimpleBitmapButton::OnEnable(BOOL bEnable) { // WM_ENABLE is sent AFTER the WS_DISABLED bit is set. if (bEnable == IsWindowEnabled()) { // If button is being disabled, pop it back out. if (!bEnable) { SetSelect(FALSE); ReleaseCapture(); } Default(); Invalidate(); } }
void IconDes::SyncImage() { ReleaseCapture(); SyncShow(); if(IsCurrent()) { Slot& c = Current(); SyncShow(); c.pastepos = Null; if(c.selection.GetSize() != c.image.GetSize()) SetSelect(255); if(single_mode) info.SetLabel(Format("%d x %d", c.image.GetWidth(), c.image.GetHeight())); } selectrect = false; SetBar(); Refresh(); }
int InsertLabel(const wchar_t* pLabelName,int nIndexInsert) { int labelSize = GetLableSize(); _tagLabel label = CreateNewLabel(labelSize,pLabelName); m_LabelM.insert(m_LabelM.begin()+nIndexInsert,label); if (m_bHorizon) { ReSizeView(labelSize+100); }else { ReSizeView(labelSize+20); } int nIndex = nIndexInsert+1; SetSelect(nIndex); return nIndex; }
int AddLabel(const wchar_t* pLabelName) { int lableSize = GetLableSize(); _tagLabel label = CreateNewLabel(lableSize,pLabelName); m_LabelM.push_back(label); if (m_bHorizon) { ReSizeView(lableSize+100); }else { ReSizeView(lableSize+20); } int nIndex = m_LabelM.size() - 1; SetSelect(nIndex); return nIndex; }
void CMlsSimpleBitmapButton::OnLButtonUp(UINT nFlags, CPoint point) { // Remember the select state before losing it. BOOL fSelect = m_fSelect; // The user finally let go, pop the button back up. SetSelect(FALSE); ReleaseCapture(); if (fSelect) { // Let our owner know that the button was pressed. CWnd* pOwner = GetOwner(); if (pOwner != NULL) { Util::SendWmCommand(pOwner, GetDlgCtrlID(), this, 0); } } }
bool MenuBar::EventKey(cevent_key* pEvent) { if (sub.ptr() && sub->EventKey(pEvent)) return true; if (pEvent->Type() == EV_KEYDOWN) { switch (pEvent->Key()) { case VK_LEFT: Left(); return true; case VK_RIGHT: Right(); return true; case VK_DOWN: case VK_RETURN: case VK_NUMPAD_RETURN: OpenSub(); return true; case VK_ESCAPE: SetSelect(-1); if (Parent()) Parent()->Command(CMD_MENU_INFO, SCMD_MENU_CANCEL, this, 0); return true; } } return false; }
bool CMixereView::FindNext() { if (!GetItemCount()) return(FALSE); bool Found = FALSE; int i = m_CurPos; while (!Found) { if (!m_NewFind) { // first time, don't update position if (!m_FindSearchDown) { if (--i < 0) i = GetItemCount() - 1; } else { if (++i >= GetItemCount()) i = 0; } } CString Title = GetChan(i)->GetTitle(); if (!m_FindMatchCase) // if case-insensitive match Title.MakeLower(); // make title lower case int pos = Title.Find(m_FindStr); if (pos >= 0) { // if title contains find string SetCurPos(i); Deselect(); SetSelect(i, TRUE); EnsureVisible(i); Found = TRUE; } if (!m_NewFind && i == m_CurPos) // if we're back where we started break; // we're done m_NewFind = FALSE; } if (!Found) { CString msg; msg.FormatMessage(IDS_CANT_FIND_STRING, m_FindStr); AfxMessageBox(msg); } return(Found); }
void IconDes::Move() { if(!IsCurrent()) return; Slot& c = Current(); selectrect = false; if(IsPasting()) FinishPaste(); else { doselection = false; rgbactrl.Mask(false); rgbactrl.Hide(); Rect r = SelectionRect(); Image m = Copy(r); Delete(); SetSelect(255); c.base_image = c.image; c.paste_image = m; c.pastepos = r.TopLeft(); MakePaste(); } SetBar(); }
void IconDes::Reset() { SetSelect(255); SyncImage(); }
void CMlsSimpleBitmapButton::OnLButtonDown(UINT nFlags, CPoint point) { // Set the state to selected and capture the mouse until the button is released. SetSelect(TRUE); SetCapture(); }
void MenuBar::EventEnterLeave(cevent *pEvent) { if (pEvent->Type() == EV_LEAVE && !InFocus() && !sub.ptr()) SetSelect(-1); }