bool wxStdScrollBarInputHandler::HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar); if ( m_winCapture ) { if ( (m_htLast == wxHT_SCROLLBAR_THUMB) && event.Dragging() ) { // make the thumb follow the mouse by keeping the same offset // between the mouse position and the top/left of the thumb HandleThumbMove(scrollbar, event); return true; } // no other changes are possible while the mouse is captured return false; } bool isArrow = scrollbar->GetArrows().HandleMouseMove(event); if ( event.Dragging() ) { wxHitTest ht = scrollbar->HitTestBar(event.GetPosition()); if ( ht == m_htLast ) { // nothing changed return false; } #ifdef DEBUG_MOUSE wxLogDebug("Scrollbar::OnMouseMove: ht = %d", ht); #endif // DEBUG_MOUSE Highlight(scrollbar, false); m_htLast = ht; if ( !isArrow ) Highlight(scrollbar, true); //else: already done by wxScrollArrows::HandleMouseMove } else if ( event.Leaving() ) { if ( !isArrow ) Highlight(scrollbar, false); m_htLast = wxHT_NOWHERE; } else // event.Entering() { // we don't process this event return false; } // we did something return true; }
void aui_Control::MouseMoveAway( aui_MouseEvent *mouseData ) { HideTipWindow(); if(IsDisabled()) return; Highlight(false); if(IsActive()) { PlaySound( AUI_SOUNDBASE_SOUND_DEACTIVATE ); if(m_statusText && StatusBar::GetOwner() == this) { StatusBar::SetText("", NULL); } if ( m_mouseCode == AUI_ERRCODE_UNHANDLED ) m_mouseCode = AUI_ERRCODE_HANDLED; m_attributes &= ~k_CONTROL_ATTRIBUTE_ACTIVE; m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSEMOVEAWAY; if ( m_ActionFunc ) m_ActionFunc( this, 0, 0, m_cookie ); else if ( m_action ) m_action->Execute( this, 0, 0 ); } }
void CLibraryTileView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { CSingleLock oLock( &Library.m_pSection ); if ( oLock.Lock( 200 ) ) { if ( _istalnum( TCHAR( nChar ) ) ) { iterator pStart = m_pFocus; for ( int nLoop = 0; nLoop < 2; nLoop++ ) { for ( iterator pChild = begin(); pChild != end(); ++pChild ) { if ( pStart != end() ) { if ( pStart == pChild ) pStart = end(); } else if ( toupper( (*pChild)->GetTitle().GetAt( 0 ) ) == toupper( (int)nChar ) ) { DeselectAll( m_pFocus = pChild ); Select( m_pFocus, TRI_TRUE ); Highlight( m_pFocus ); Invalidate(); return; } } } } } CLibraryView::OnChar( nChar, nRepCnt, nFlags ); }
void SearchContext::poke(int id, const std::string &str, HighlightList &highlights, int highlightOffset, bool finished) { if(!str.empty()) { int additionalOffset = pokeData_->text.length() + highlightOffset; pokeData_->text += str; for(HighlightList::iterator it = highlights.begin(); it != highlights.end(); ++it) { pokeData_->highlights.push_back(Highlight(it->offset + additionalOffset, it->count)); } } if(window_ != INVALID_HANDLE_VALUE) { UINT now = GetTickCount(); if(finished || (now > (lastPoke_ + (1000 / POKES_PER_SECOND)))) { lastPoke_ = now; char buffer[256]; sprintf(buffer, "%d hits, %d dirs, %d files", hits_, directoriesSearched_+directoriesSkipped_, filesSearched_+filesSkipped_); if(!finished) pokeData_->progress = buffer; PostMessage(window_, WM_SEARCHCONTEXT_POKE, id, (LPARAM)pokeData_); pokeData_ = new PokeData; } } }
void ctp2_Button::SetAttract(bool on, uint32 ticksSinceStart) { m_attract = on; m_attractTicks = ticksSinceStart; if(m_attract) { if((m_attractTicks / k_CTP2_BUTTON_ATTRACT_MS) & 1) { Highlight(true); } else { Highlight(false); } } else { Highlight(false); g_attractWindow->RemoveRegion(this); } }
void Menu::Open(Menu* c) { if(c && !child) { // hide the current menu current->setHidden(true); // add the next menu c->parent = this; addChild(c); child = c; c->open = true; c->select = 0; c->Highlight(); c->OnOpen(); c->firstOpen = false; } else { OnOpen(); Highlight(); firstOpen = false; open = true; addChild(cursor); current->setHidden(false); } }
void wxTimeSpinCtrl::OnEditKey(wxKeyEvent &ev) { if (!ev.HasModifiers()) { switch(ev.GetKeyCode()) { case WXK_LEFT: { if (!ev.ShiftDown()) { int tp = GetTimePart() + 1; if (tp < 3 || (hasDay && tp == 3)) { Highlight(tp); return; } } break; } case WXK_RIGHT: { if (!ev.ShiftDown()) { int tp = GetTimePart() - 1; if (tp >= 0) { Highlight(tp); return; } } break; } case WXK_UP: DoSpin(1); return; break; case WXK_DOWN: DoSpin(-1); return; break; default: break; } } ev.Skip(); }
void CTrack::Paint(HDC hDC) { if (m_bIsHighlight) Highlight(true, hDC, m_bHash); if (m_bIsDrawn) Draw(true/*bOn*/, hDC); }
void Polygon_plot_highlights(Patch*p,vector A, vector H, real hl_step, int highlight_type) { glPushAttrib(GL_ENABLE_BIT); glEnable(GL_LIGHTING); Highlight(p->pointCount, p->position, p->normal, A, H, hl_step, highlight_type); glPopAttrib(); }
bool Button::HandleDown(int x, int y) { if (_drawn && IsInButtonArea(x,y)) { Highlight(); DrawText(); return true; } return false; }
void aui_Control::MouseRDragAway( aui_MouseEvent *mouseData ) { if(IsDisabled()) return; if(GetMouseOwnership() == this) Highlight(false); if(!GetMouseOwnership()) MouseMoveAway(mouseData); }
// Drag and Drop interface void DockWindow::StartHighlight(DockCont *dc) { int align = DOCK_NONE; DockCont *target = FindDockTarget(*dc, align); if (align != DOCK_NONE || target) { dc->SyncUserSize(true, true); Highlight(align, *dc, target); } else StopHighlight(IsAnimatedHighlight()); }
void Position::Print() const { const char names[] = "-?PpNnBbRrQqKk"; out("\n"); for (int f = 0; f < 64; f++) { PIECE p = m_board[f]; Highlight (p && GetColor(p) == WHITE); out(" %c", names[p]); Highlight(false); if (Col(f) == 7) out("\n"); } if (m_undoSize) { out("\n "); for (int m = 0; m < m_undoSize; ++m) out("%s ", MoveToStrLong(m_undos[m].m_mv)); out("\n "); } out("\n"); }
void SourceEdit::ShowBetween(int startLine, int endLine) { if (endLine > startLine) { int endLen = CallEdit(SCI_LINELENGTH,endLine); if (endLen <= 1) endLine--; } CallEdit(SCIX_VISIBLEREGION,startLine,endLine); Highlight(startLine,-1,false); }
void MenuItem::Handle (Event& e) { switch (e.eventType) { case OnEvent: Highlight(); break; case OffEvent: UnHighlight(); break; default: /* shouldn't happen */; } }
void PopUpDockWindow::ContainerDragMove(DockCont &dc) { int align = DOCK_NONE; // Is the highlight the same as last time? (Quick escape) if (last_popup && last_popup->IsPopUp() && last_popup->GetRect().Contains(GetMousePos())) return; DockCont *target = GetMouseDockTarget(); int dock = DOCK_NONE; if (target) { dock = GetDockAlign(*target); if (!dc.IsDockAllowed(dock)) target = NULL; } bool target_changed = (target != last_target) && !GetHighlightCtrl().GetParent() && (!target || !IsPaneAnimating(dock)); // Hide show inner popups as necessary if (!target && last_target != NULL) HidePopUps(true, false); else if (target_changed) ShowInnerPopUps(dc, target); ShowOuterPopUps(dc); last_target = target; // Get potential alignment align = PopUpHighlight(inner, 5); if (align == DOCK_NONE) { target = NULL; last_target = NULL; align = PopUpHighlight(outer, 4); } else if (align == 4) align = DOCK_NONE; else if (target) { target = IsTL(align) ? target : dynamic_cast<DockCont*>(target->GetNext()); align = dock; } // Do highlight if (align != DOCK_NONE || target) { if (align == DOCK_NONE) StopHighlight(false); dc.SyncUserSize(true, true); Highlight(align, dc, target); } else { StopHighlight(IsAnimatedHighlight()); last_popup = NULL; } }
bool Button::HandleHeld(int x, int y) { bool inArea = IsInButtonArea(x,y); if (inArea && !_highlighted) { Highlight(); DrawText(); return true; } else if (!inArea && _highlighted) { ClearRect(); DrawText(); return true; } return false; }
bool TextFormatter::SetHighlight(FilePos pos, int len) { if (m_hllen == len && (!len || pos == m_hlstart)) // avoid extra work return false; // remove highlighting for (int i = 0; i < m_lines.GetSize(); ++i) { for (int j = 0; j < m_lines[i].attr.size(); ++j) m_lines[i].attr[j].hibg = false; } m_hlstart = pos; m_hllen = len; Highlight(); return true; }
Region2DLine::Region2DLine( RenderView2D* view ) : Region2D( view ) { m_actorLine = vtkSmartPointer<vtkActor2D>::New(); m_actorLine->GetProperty()->SetOpacity( 0.75 ); m_actorLine->GetProperty()->SetLineWidth( 3 ); // m_actorLine->VisibilityOff(); m_actorText = vtkSmartPointer<vtkTextActor>::New(); m_actorText->SetTextScaleMode( vtkTextActor::TEXT_SCALE_MODE_NONE ); m_actorText->GetTextProperty()->SetColor( 1, 1, 1 ); m_actorText->GetTextProperty()->ShadowOn(); m_actorText->GetTextProperty()->SetShadowOffset( 1, 1 ); m_actorText->GetTextProperty()->SetFontSize( 15 ); Highlight( true ); }
bool TextFormatter::FormatFwd(CFDC& dc, FilePos start) { AdjustPos(start); // just to be safe if (start.para >= m_tf->Length(start.docid)) return false; // at eof m_lines.RemoveAll(); m_top = start; bool header = true; for (int page = 0; page < m_pages; ++page) { int h = 0; int beg = m_lines.GetSize(); while (h < m_height && start.para < m_tf->Length(start.docid)) { Paragraph para(m_tf->GetParagraph(start.docid, start.para)); bool empty = para.len == 0 || para.len == 1 && para.str[0] == _T(' '); if (h == 0 && empty) { start.off = para.len; AdjustPos(start); continue; } if (para.flags & Paragraph::header) { if (!header) break; } else if (!empty && !(para.flags & Paragraph::image)) header = false; int lh = WrapLine(dc, para, start, m_lines, h, m_height - h); if (lh < 0) break; AdjustPos(start); h += lh; } m_pagelen.SetAtGrow(page, m_lines.GetSize() - beg); } m_bot = start; Highlight(); // add one dummy line always Line l; l.pos = m_bot; m_lines.Add(l); return true; }
void wxTimeSpinCtrl::OnNavigate(wxNavigationKeyEvent &ev) { if (wxWindow::FindFocus() == m_txt) { int tp = GetTimePart(); if (ev.GetDirection()) tp++; else tp--; if ((tp >= 0 && tp < 3) || (hasDay && tp == 3)) { Highlight(tp); return; } } ev.Skip(); }
void Menu::Add(Item* i) { // sorted by Y position vector<Item*>::iterator it; for(it=items.begin(); it!=items.end(); it++) { if((*it)->getPosition().y < i->getPosition().y) { items.insert(it, i); i->SetParent(this); current->addChild(i); return; } } items.push_back(i); i->SetParent(this); current->addChild(i); Highlight(); }
void aui_Control::MouseMoveOver( aui_MouseEvent *mouseData ) { if(IsDisabled()) return; if(!GetWhichSeesMouse() || GetWhichSeesMouse() == this) { SetWhichSeesMouse( this ); if(GetWhichSeesMouse() == this) { Highlight(); PlaySound( AUI_SOUNDBASE_SOUND_ACTIVATE ); if(m_statusText) { StatusBar::SetText(m_statusText, this); } else if(m_statusTextCopy) { StatusBar::SetText(m_statusTextCopy, this); } if ( m_mouseCode == AUI_ERRCODE_UNHANDLED ) m_mouseCode = AUI_ERRCODE_HANDLED; m_attributes |= k_CONTROL_ATTRIBUTE_ACTIVE; m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSEMOVEOVER; if ( m_ActionFunc ) m_ActionFunc( this, 0, 0, m_cookie ); else if ( m_action ) m_action->Execute( this, 0, 0 ); } } else { MouseMoveOutside( mouseData ); } }
void wxTimeSpinCtrl::OnKillFocus(wxFocusEvent &ev) { #ifdef __WXGTK__ ev.Skip(); #endif long time = GetTextTime(); if (time < 0) { m_txt->SetValue(wxEmptyString); spinValue = 0; m_spn->SetValue(0); } else { int tp = GetTimePart(); SetValue(wxTimeSpan(0, 0, time)); Highlight(tp); } }
void SourceEdit::Highlight(int line, COLORREF colour, bool centre) { CallEdit(SCI_MARKERDELETEALL,m_marker); if (line < (int)CallEdit(SCI_GETLINECOUNT)) { int pos = (int)CallEdit(SCI_POSITIONFROMLINE,line); if (pos >= 0) { CHARRANGE range = { pos, pos }; Highlight(range,centre); if (colour != -1) { m_markSel.cpMin = pos; m_markSel.cpMax = pos; CallEdit(SCI_MARKERSETBACK,m_marker,colour); CallEdit(SCI_MARKERADD,line,m_marker); } } } }
void Menu::Up() { if(child) { child->Up(); } else if(open && !hidden) { int i = select - 1; while(i >= 0) { if(items[i]->IsEnabled()) { select = i; cursorActive = false; OnHighlight(); break; } i--; } Highlight(); } }
void Menu::Down() { if(child) { child->Down(); } else if(open && !hidden) { int i = select + 1; while(i < items.size()) { if(items[i]->IsEnabled()) { select = i; cursorActive = false; OnHighlight(); break; } i++; } Highlight(); } }
void TTeamMenuItem::SetOverrideSelected(bool selected) { fOverriddenSelected = selected; Highlight(selected); }
bool wxStdScrollBarInputHandler::HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { // is this a click event from an acceptable button? int btn = event.GetButton(); if ( btn == wxMOUSE_BTN_LEFT ) { // determine which part of the window mouse is in wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar); wxHitTest ht = scrollbar->HitTestBar(event.GetPosition()); // when the mouse is pressed on any scrollbar element, we capture it // and hold capture until the same mouse button is released if ( event.ButtonDown() || event.ButtonDClick() ) { if ( !m_winCapture ) { m_btnCapture = btn; m_winCapture = consumer->GetInputWindow(); m_winCapture->CaptureMouse(); // generate the command bool hasAction = true; wxControlAction action; switch ( ht ) { case wxHT_SCROLLBAR_ARROW_LINE_1: action = wxACTION_SCROLL_LINE_UP; break; case wxHT_SCROLLBAR_ARROW_LINE_2: action = wxACTION_SCROLL_LINE_DOWN; break; case wxHT_SCROLLBAR_BAR_1: action = wxACTION_SCROLL_PAGE_UP; m_ptStartScrolling = event.GetPosition(); break; case wxHT_SCROLLBAR_BAR_2: action = wxACTION_SCROLL_PAGE_DOWN; m_ptStartScrolling = event.GetPosition(); break; case wxHT_SCROLLBAR_THUMB: consumer->PerformAction(wxACTION_SCROLL_THUMB_DRAG); m_ofsMouse = GetMouseCoord(scrollbar, event) - scrollbar->ScrollbarToPixel(); // fall through: there is no immediate action default: hasAction = false; } // remove highlighting Highlight(scrollbar, false); m_htLast = ht; // and press the arrow or highlight thumb now instead if ( m_htLast == wxHT_SCROLLBAR_THUMB ) Highlight(scrollbar, true); else Press(scrollbar, true); // start dragging if ( hasAction ) { m_timerScroll = new wxScrollBarTimer(this, action, scrollbar); m_timerScroll->StartAutoScroll(); } //else: no (immediate) action } //else: mouse already captured, nothing to do } // release mouse if the *same* button went up else if ( btn == m_btnCapture ) { if ( m_winCapture ) { StopScrolling(scrollbar); // if we were dragging the thumb, send the last event if ( m_htLast == wxHT_SCROLLBAR_THUMB ) { scrollbar->PerformAction(wxACTION_SCROLL_THUMB_RELEASE); } m_htLast = ht; Highlight(scrollbar, true); } else { // this is not supposed to happen as the button can't go up // without going down previously and then we'd have // m_winCapture by now wxFAIL_MSG( wxT("logic error in mouse capturing code") ); } } } return wxStdInputHandler::HandleMouse(consumer, event); }
void EndScreen::SetHighScores(int first, int second, int third, int current) { p_first->GetComponent<Text>("Score")->AddText("1..." + to_string(first), Highlight(first, current)); p_second->GetComponent<Text>("Score")->AddText("2..." + to_string(second), Highlight(second, current)); p_third->GetComponent<Text>("Score")->AddText("3..." + to_string(third), Highlight(third, current)); }