void CvSqlQueryRichEditView::SetColor (LONG nStart, LONG nEnd, COLORREF crColor) { CRichEditCtrl& ctrl = GetRichEditCtrl(); CdSqlQueryRichEditDoc* pDoc = (CdSqlQueryRichEditDoc*)GetDocument(); ASSERT (pDoc); if (!pDoc) return; pDoc->m_nStart = nStart; pDoc->m_nEnd = nEnd; LONG oldEventMask = ctrl.SetEventMask(ENM_NONE); if (nStart == -1) { ctrl.SetSel (0, -1); OnColorPick (crColor); SetHighlight (FALSE); ctrl.SetSel (-1, 0); } else { ctrl.SetSel (-1, 0); ctrl.SetSel (nStart, nEnd); OnColorPick (crColor); SetHighlight (TRUE); ctrl.SetSel (-1, 0); } ctrl.SetEventMask(oldEventMask); }
BOOL obj_DroppedItem::Update() { parent::Update(); r3dPoint3D pos = GetBBoxWorld().Center(); const ClientGameLogic& CGL = gClientLogic(); if(CGL.localPlayer_ && (CGL.localPlayer_->GetPosition() - pos).Length() < 10.0f) SetHighlight(true); else SetHighlight(false); return TRUE; }
GXBOOL ScalingAxis::HitTest(GXCanvas3D* pCanvas, GXBOOL bHighlight, GXLPCPOINT ptHit) { if(m_bTracking) { return FALSE; } NODERAYTRACE nrt; GXBOOL result = FALSE; GVNode* pNode = Hit(pCanvas, ptHit, &nrt); if(pNode == NULL) { m_eHit = HT_NONE; } else if(pNode == this) { ASSERT(nrt.nFaceIndex >= 0 && nrt.nFaceIndex < 24); if(nrt.nFaceIndex < 8) { m_eHit = HT_PLANE_YZ; } else if(nrt.nFaceIndex < 16) { m_eHit = HT_PLANE_ZX; } else { m_eHit = HT_PLANE_XY; } result = TRUE; } else { GXLPCSTR szName = pNode->GetName(); switch(szName[0]) { case 'X': m_eHit = HT_AXIS_X; break; case 'Y': m_eHit = HT_AXIS_Y; break; case 'Z': m_eHit = HT_AXIS_Z; break; case 'E': m_eHit = HT_ENTIRETY; break; } result = TRUE; } if(bHighlight) { if(m_pHighlight) { SetHighlight(FALSE); } m_eHighlight = m_eHit; m_pHighlight = static_cast<GVGeometry*>(pNode); if(m_pHighlight) { SetHighlight(TRUE); } } return result; }
void CShareBox::dragEnterEvent(QDragEnterEvent * event) { /* We only accept URLs being dragged on to the box and only if we are not already involved in transferring a file. */ if(event->mimeData()->hasUrls() && m_progress == CFileSender::ProgressNone) { SetHighlight(true); event->accept(); } }
void CShareBox::dropEvent(QDropEvent * event) { qDebug("Files were dropped on the share box."); /* Technically we should never receive anything that we don't support because we rejected everything else above. But once can never be too careful... */ if(event->mimeData()->hasUrls() && m_progress == CFileSender::ProgressNone) { /* Convert the list of URLs to filenames. */ QStringList filenames; foreach(QUrl url, event->mimeData()->urls()) filenames.append(url.toLocalFile()); /* Emit the signal that files were dropped and accept the drop. */ emit FilesDropped(filenames, m_id); event->accept(); } else qDebug("MIME type of dropped content cannot be converted to a URL."); SetHighlight(false); }
/*! Processes input for the widget. * Default processing includes mouse-over highlighting * * @param pInput Pointer to current input object * @returns ICRESULT Success/failure of widget input processing **/ ICRESULT icWidget::ProcessInput(icInput* pInput) { if (!pInput) return IC_FAIL_GEN; short x,y; pInput->GetPos(&x,&y); icVector2 mouse_pos((icReal)x,(icReal)y); // update the input state ic2DAABB box; box.extents.x = m_v2Size.x/2.0f; box.extents.y = m_v2Size.y/2.0f; box.pos = m_v2Pos; m_bMouseOver = ic2DPointAABB(mouse_pos,box); if (m_bHighlightEnabled && !Sticky) SetHighlight(m_bMouseOver); return IC_OK; }// END FUNCTION ProcessInput( icInput* pInput )
void CNB_Horiz_List::OnSliderMoved( int position ) { InvalidateLayout(); Repaint(); // figure out which item is in the middle and highlight it int nChildOffset = m_nEntryWide - m_pHorizScrollBar->GetValue(); int nClosestEntry = -1; int nClosestDist = INT_MAX; vgui::PHandle hClosestPanel; for ( int i = 0; i < m_Entries.Count(); i++ ) { int x, y; m_Entries[i]->GetPos( x, y ); int nDist = abs( ( ( GetWide() * 0.5f - m_Entries[i]->GetWide() * 0.5f ) - nChildOffset ) - x ); if ( nDist < nClosestDist ) { nClosestDist = nDist; nClosestEntry = i; hClosestPanel = m_Entries[i]; } } if ( nClosestEntry != -1 ) { if ( !m_bAutoScrollChange ) { SetHighlight( nClosestEntry ); CNB_Select_Weapon_Entry *pWeaponEntry = dynamic_cast<CNB_Select_Weapon_Entry*>( hClosestPanel.Get() ); if ( pWeaponEntry && pWeaponEntry->m_bCanEquip ) { pWeaponEntry->m_pWeaponImage->NavigateTo(); } } } m_bAutoScrollChange = false; }
void ModelLoader::RenderDoorObjectUI(PDOOR door, bool target) { auto model = m_modelData[door->ID]; if (model) { bool visible = model->IsVisible(); ImGui::Checkbox("Render", &visible); ImGui::SameLine(); model->SetVisible(visible); bool highlight = model->IsHighlighted(); ImGui::Checkbox("Highlight", &highlight); model->SetHighlight(highlight); } else { ImGui::TextColored(ImColor(255, 0, 0), "No Model Data"); } if (target) { if (ImGui::TreeNode("Door Data")) { DumpDataUI(door, sizeof(_DOOR)); ImGui::TreePop(); } if (ImGui::TreeNode("Switch Data")) { DumpDataUI(door->pSwitch, sizeof(EQSWITCH)); ImGui::TreePop(); } } ImGui::Separator(); ImGui::Text("ID: %d Type: %d State: %d", door->ID, door->Type, door->State); if (door->ZonePoint != -1) { const char* zone = GetTeleportName(door->ZonePoint); ImGui::TextColored(ImColor(255, 255, 0), "Zone Point: %s (%d)", zone, door->ZonePoint); } ImGui::DragFloat3("Position", &door->Y); ImGui::DragFloat("Heading", &door->Heading); ImGui::DragFloat("Angle", &door->DoorAngle); ImGui::LabelText("Scale", "%.2f", GetDoorScale(door)); ImGui::DragFloat2("Top Speed 1", &door->TopSpeed1); ImGui::DragFloat3("Default Position", &door->DefaultY); ImGui::DragFloat("Default Heading", &door->DefaultHeading); ImGui::DragFloat("Default Angle", &door->DefaultDoorAngle); if (ImGui::Button("Target")) { CHAR temp[256]; sprintf_s(temp, "/doortarget id %d", door->ID); // would be nice if there was an easier way to do this. EzCommand(temp); } ImGui::SameLine(); if (ImGui::Button("Reset Position")) { door->X = door->DefaultX; door->Y = door->DefaultY; door->Z = door->DefaultZ; door->Heading = door->DefaultHeading; } ImGui::SameLine(); if (ImGui::Button("Click")) { ClickDoor(door); } }
void CNB_Select_Marine_Panel::OnThink() { BaseClass::OnThink(); for ( int i = 0; i < m_Entries.Count(); i++ ) { if ( m_Entries[i]->IsCursorOver() ) { vgui::Panel *pPanel = m_Entries[i]; CNB_Select_Marine_Entry *pCursorOver = dynamic_cast<CNB_Select_Marine_Entry*>( pPanel ); if ( pCursorOver && pCursorOver->m_pPortraitImage->IsCursorOver() ) { SetHighlight( i ); break; } } } bool bShowSpareSkillPoints = false; CNB_Select_Marine_Entry *pHighlighted = dynamic_cast<CNB_Select_Marine_Entry*>( GetHighlightedEntry() ); if ( pHighlighted ) { int nProfileIndex = pHighlighted->GetProfileIndex(); CASW_Marine_Profile *pProfile = Briefing()->GetMarineProfileByProfileIndex( nProfileIndex ); if ( pProfile ) { m_pMarineNameLabel->SetText( pProfile->GetShortName() ); m_pBioLabel->SetText( pProfile->m_Bio ); m_pSkillPanel0->SetSkillDetails( nProfileIndex, 0, Briefing()->GetProfileSkillPoints( nProfileIndex, 0 ) ); m_pSkillPanel1->SetSkillDetails( nProfileIndex, 1, Briefing()->GetProfileSkillPoints( nProfileIndex, 1 ) ); m_pSkillPanel2->SetSkillDetails( nProfileIndex, 2, Briefing()->GetProfileSkillPoints( nProfileIndex, 2 ) ); m_pSkillPanel3->SetSkillDetails( nProfileIndex, 3, Briefing()->GetProfileSkillPoints( nProfileIndex, 3 ) ); m_pSkillPanel4->SetSkillDetails( nProfileIndex, 4, Briefing()->GetProfileSkillPoints( nProfileIndex, 4 ) ); if ( ASWGameRules() && ASWGameRules()->IsCampaignGame() && ASWGameRules()->GetCampaignSave() && !ASWGameRules()->GetCampaignSave()->UsingFixedSkillPoints() ) { int nSkillPoints = Briefing()->GetProfileSkillPoints( nProfileIndex, ASW_SKILL_SLOT_SPARE ); if ( nSkillPoints > 0 ) { wchar_t buffer[128]; char sparebuffer[8]; Q_snprintf(sparebuffer, sizeof(sparebuffer), "%d", nSkillPoints); wchar_t wsparebuffer[8]; g_pVGuiLocalize->ConvertANSIToUnicode(sparebuffer, wsparebuffer, sizeof( wsparebuffer )); g_pVGuiLocalize->ConstructString( buffer, sizeof(buffer), g_pVGuiLocalize->Find("#asw_unspent_points"), 1, wsparebuffer); m_pSkillPointsLabel->SetText( buffer ); bShowSpareSkillPoints = true; } } } m_pAcceptButton->SetEnabled( !Briefing()->IsProfileSelectedBySomeoneElse( nProfileIndex ) ); } else { } m_pSkillPointsLabel->SetVisible( bShowSpareSkillPoints ); }
void PhoneModeAddressBook::MouseMoved(int x, int y) { if (x > BLUE_HEADER_POS_X && x < BLUE_HEADER_POS_X + MASK_WIDTH && y > BLUE_HEADER_POS_Y + BLUE_HEADER_HEIGHT) SetHighlight((y - (BLUE_HEADER_POS_Y + BLUE_HEADER_HEIGHT)) / 20); }
void CNB_Horiz_List::OnThink() { BaseClass::OnThink(); if ( MouseOverScrollbar() ) { // No slidy auto scroll while using the scrollbar m_fScrollVelocity = 0.0f; m_fScrollChange = 0.0f; } else { int nMouseX, nMouseY; ASWInput()->GetFullscreenMousePos( &nMouseX, &nMouseY ); ScreenToLocal( nMouseX, nMouseY ); float fVelocityMax = 1200.0f; const float fAccelerationMax = 3000.0f; float fScrollAcceleration = 0.0f; if ( nMouseX > 0 && nMouseX < GetWide() && nMouseY > 0 && nMouseY < GetTall() ) { const float fDeadZoneSize = 0.55f; float fMouseXInterp = static_cast<float>( nMouseX ) / GetWide(); if ( fMouseXInterp > 0.5f + fDeadZoneSize * 0.5f ) { fMouseXInterp = 0.25f + ( fMouseXInterp - ( 0.5f + fDeadZoneSize * 0.5f ) ) / ( ( 1.0f - fDeadZoneSize ) * 0.666666666f ); } else if ( fMouseXInterp < 0.5f - fDeadZoneSize * 0.5f ) { fMouseXInterp = -0.25f - ( ( 0.5f - fDeadZoneSize * 0.5f ) - fMouseXInterp ) / ( ( 1.0f - fDeadZoneSize ) * 0.666666666f ); } else { fMouseXInterp = 0.0f; } fScrollAcceleration = fMouseXInterp * fAccelerationMax; fVelocityMax *= fabsf( fMouseXInterp ); } if ( fScrollAcceleration == 0.0f ) { // Dampen velocity in the dead zone m_fScrollVelocity = Approach( 0.0f, m_fScrollVelocity, gpGlobals->frametime * fAccelerationMax * 0.75f ); } else { // Apply acceleration to the velocity m_fScrollVelocity = clamp( m_fScrollVelocity + fScrollAcceleration * gpGlobals->frametime, -fVelocityMax, fVelocityMax ); } // Accumulate into a float for smaller than 1 changes m_fScrollChange += m_fScrollVelocity * gpGlobals->frametime; // Apply the integer amount int nScrollChange = m_fScrollChange; if ( nScrollChange <= -1 || nScrollChange >= 1 ) { bool bChanged = ChangeScrollValue( nScrollChange ); if ( bChanged ) { m_fScrollChange -= nScrollChange; } else { // Hit the end m_fScrollVelocity = 0.0f; m_fScrollChange = 0.0f; } } } if ( m_bHighlightOnMouseOver ) { for ( int i = 0; i < m_Entries.Count(); i++ ) { if ( m_Entries[i]->IsCursorOver() ) { SetHighlight( i ); break; } } } vgui::Panel *pHighlighted = GetHighlightedEntry(); if ( !pHighlighted ) return; int x, y; pHighlighted->GetPos( x, y ); m_flContainerTargetPos = YRES( 154 ) - x; if ( m_bInitialPlacement ) { m_bInitialPlacement = false; m_flContainerPos = m_flContainerTargetPos; } else { if ( m_flContainerPos < m_flContainerTargetPos ) { m_flContainerPos = MIN( m_flContainerPos + gpGlobals->frametime * SCROLL_SPEED, m_flContainerTargetPos ); } else if ( m_flContainerPos > m_flContainerTargetPos ) { m_flContainerPos = MAX( m_flContainerPos - gpGlobals->frametime * SCROLL_SPEED, m_flContainerTargetPos ); } } //Msg( "m_flContainerPos = %f target = %f\n", m_flContainerPos, m_flContainerTargetPos ); if ( !m_bShowScrollBar ) { m_pChildContainer->SetPos( m_flContainerPos, 0 ); } m_pLeftArrowButton->SetEnabled( m_nHighlightedEntry > 0 ); m_pRightArrowButton->SetEnabled( m_nHighlightedEntry < m_Entries.Count() - 1 ); }
bool GUIFCCharacterItem::OnEvent(const SEvent& event) { bool bHandled = false; switch ( event.EventType ) { case EET_GUI_EVENT: { s32 elemID = event.GUIEvent.Caller->getID(); switch ( event.GUIEvent.EventType ) { case EGET_ELEMENT_HOVERED: { if ( event.GUIEvent.Caller == this ) { SetHighlight(true); bHandled = true; } } break; case EGET_ELEMENT_LEFT: { if ( event.GUIEvent.Caller == this ) { SetHighlight(false); bHandled = true; } } break; default: break; } } break; case EET_MOUSE_INPUT_EVENT: { switch ( event.MouseInput.Event ) { case EMIE_LMOUSE_LEFT_UP: { if ( isPointInside( core::position2d<s32>( event.MouseInput.X, event.MouseInput.Y ) ) ) { Character* pChar = GetCharacter(); if ( m_pContainer && pChar ) { FCViewEvent e( VE_CharacterSelected, pChar->GetID() ); m_pContainer->GetController()->OnViewEvent(e); bHandled = true; } } } break; default: break; } } break; default: break; } return bHandled; }
void CShareBox::dragLeaveEvent(QDragLeaveEvent * event) { SetHighlight(false); event->accept(); }