void Button::MouseExited(const MouseEvent& lEvent) { if(IsDisabled()) { return; } if(IsSelected() && m_Callback_Released) { // If we have pressed the button, but not released when we move outside of the button m_Callback_Released(m_pCallbackData_Released); } SetHover(false); // Call the callback function if(m_ExitCallback) { m_ExitCallback(m_pExitCallbackData); } // If we are selected when we exit, reposition back the offset if(IsSelected() && m_offsetApplied) { for(unsigned int i = 0; i < m_vpAddedComponentList.size(); i++) { m_vpAddedComponentList[i]->SetLocation(m_vpAddedComponentList[i]->GetLocation().m_x - m_pressedOffsetX, m_vpAddedComponentList[i]->GetLocation().m_y - m_pressedOffsetY); } m_label.SetLocation(m_label.GetLocation().m_x - m_pressedOffsetX, m_label.GetLocation().m_y - m_pressedOffsetY); m_offsetApplied = false; } if(m_bChangeLabelText) { for(unsigned int i = 0; i < m_vpAddedComponentList.size(); i++) { if(m_vpAddedComponentList[i]->GetComponentType() == EComponentType_Label) { ((Label*)m_vpAddedComponentList[i])->SetColour(m_normalLabelColour); } } m_label.SetColour(m_normalLabelColour); } // Also removed the button selection if we exit it's dimensions SetSelected(false); OnMouseExit(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamRoundTimer::ClientThink() { if ( IsDisabled() || m_bTimerPaused || IsInCommentaryMode() ) return; if ( IsStopWatchTimer() == true && IsWatchingTimeStamps() == true ) return; float flTime = GetTimeRemaining(); if ( flTime <= 61.0 && m_bFire1MinRemain ) { m_bFire1MinRemain = false; SendTimeWarning( RT_WARNING_60SECS ); } else if ( flTime <= 31.0 && m_bFire30SecRemain ) { m_bFire30SecRemain = false; SendTimeWarning( RT_WARNING_30SECS ); } else if ( flTime <= 11.0 && m_bFire10SecRemain ) { m_bFire10SecRemain = false; SendTimeWarning( RT_WARNING_10SECS ); } else if ( flTime <= 6.0 && m_bFire5SecRemain ) { m_bFire5SecRemain = false; SendTimeWarning( RT_WARNING_5SECS ); } else if ( flTime <= 5.0 && m_bFire4SecRemain ) { m_bFire4SecRemain = false; SendTimeWarning( RT_WARNING_4SECS ); } else if ( flTime <= 4.0 && m_bFire3SecRemain ) { m_bFire3SecRemain = false; SendTimeWarning( RT_WARNING_3SECS ); } else if ( flTime <= 3.0 && m_bFire2SecRemain ) { m_bFire2SecRemain = false; SendTimeWarning( RT_WARNING_2SECS ); } else if ( flTime <= 2.0 && m_bFire1SecRemain ) { m_bFire1SecRemain = false; SendTimeWarning( RT_WARNING_1SECS ); } }
bool nuiContainer::DispatchMouseUnclick(const nglMouseInfo& rInfo) { CheckValid(); nuiAutoRef; if (!mMouseEventEnabled || mTrashed) return false; bool hasgrab = HasGrab(rInfo.TouchId); if (IsDisabled() && !hasgrab) return false; nglMouseInfo info(rInfo); GlobalToLocal(info.X, info.Y); // Get a chance to preempt the mouse event before the children get it: if (PreMouseUnclicked(info)) return true; if (IsInsideFromRoot(rInfo.X, rInfo.Y) || hasgrab) { if (!hasgrab) { IteratorPtr pIt; for (pIt = GetLastChild(false); pIt && pIt->IsValid(); GetPreviousChild(pIt)) { nuiWidgetPtr pItem = pIt->GetWidget(); if (pItem) { if (IsEnabled()) { if ((pItem)->DispatchMouseUnclick(rInfo)) { delete pIt; return true; } } } } delete pIt; } bool res = PreUnclicked(info); if (!res) { res = MouseUnclicked(info); res |= Unclicked(info); } return res | (!mClickThru); } return false; }
void C3Slider::MouseRGrabInside( aui_MouseEvent *mouseData ) { if (IsDisabled()) return; if ( !m_thumb ) return; if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this ) { return; } else MouseRGrabOutside( mouseData ); }
/* Undo_Fnodes() *========================================================================== * Deselects any Slits visible. Also, it goes down the slit ptr passed in, * and undo's any changes made to the filename. * * IN: FNODE *ptr: Head Node pointer to the linked list. * BOOLEAN flag: Defines which linked list to clear out. */ void Undo_Fnodes( FON_PTR ptr ) { FON_PTR curptr; int i; GRECT rect; int tobject; /* Here we restore whatever the previous state was */ if( !IsChanged( ptr ) ) return; curptr = ptr; while( curptr ) { AFLAG( curptr ) = SFLAG( curptr ) = FALSE; curptr = FNEXT( curptr ); } for( i = 0; i < MAX_SLITS; i++ ) deselect( tree, First_Obj + i ); if( IsActiveTree( ad_inactive ) ) tobject = XTRANSFR; if( IsActiveTree( ad_active ) ) tobject = REMOVE; #if 1 /* ONLY for inactive fonts tree */ if( IsActiveTree( ad_inactive ) || IsActiveTree( ad_active ) ) { if( !IsDisabled( tobject ) ) { NoExit( tobject ); Disable( tobject ); rect = ObRect( tobject ); objc_offset( tree, tobject, &rect.g_x, &rect.g_y ); rect.g_x -= 3; rect.g_y -= 3; rect.g_w += 6; rect.g_h += 6; Objc_draw( tree, ROOT, MAX_DEPTH, &rect ); } } #endif }
void ctp2_Button::ResetCurrentRenderFlags() { aui_Button::ResetCurrentRenderFlags(); if(!IsDisabled()) if(!m_isToggle || !m_toggleState) { AddRenderFlags(k_CTP2_BUTTON_LAYER_FLAG_UP); RemoveRenderFlags(k_CTP2_BUTTON_LAYER_FLAG_UP_ON); } else { AddRenderFlags(k_CTP2_BUTTON_LAYER_FLAG_UP_ON); RemoveRenderFlags(k_CTP2_BUTTON_LAYER_FLAG_UP); } }
void Unit::Order_NukeGround() { unk_move_waypoint = order_target_pos; int sight_range = GetSightRange(false) * 32; int dist = Distance(exact_position, Point32(order_target_pos) * 256 + Point32(128, 128)) / 256; if (ai && dist <= sight_range * 3) Ai_Cloak(); if (dist > sight_range) { if (move_target_update_timer == 0) ChangeMovementTarget(order_target_pos); // What, it is not moving? } else { StopMoving(this); if (position != unk_move_waypoint) { int diff = facing_direction - GetFacingDirection(sprite->position.x, sprite->position.y, unk_move_waypoint.x, unk_move_waypoint.y); if (diff < -1 || diff > 1) return; } Unit *silo = nullptr; for (Unit *unit : bw::first_player_unit[player]) { if (unit->unit_id == NuclearSilo && unit->silo.has_nuke) { silo = unit; break; } } if (!silo) { OrderDone(); return; } Unit *nuke = silo->silo.nuke; silo->silo.nuke = nullptr; silo->silo.has_nuke = 0; PlaySound(Sound::NukeLaser, this, 1, 0); IssueOrderTargetingGround(nuke, Order::NukeLaunch, order_target_pos.x, order_target_pos.y); related = nuke; nuke->related = this; nuke->sprite->SetDirection32(0); ShowUnit(nuke); IssueOrderTargetingGround(this, Order::NukeTrack, sprite->position.x, sprite->position.y); if (!IsDisabled() || units_dat_flags[unit_id] & UnitFlags::Building) // Huh? buttons = 0xed; RefreshUi(); } }
void aui_Button::MouseRDropInside( aui_MouseEvent *mouseData ) { if (IsDisabled()) return; if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this ) { SetWhichSeesMouse( this ); HandleGameSpecificRightClick((void *)this); m_mouseCode = AUI_ERRCODE_HANDLED; } else { MouseRDropOutside( mouseData ); } }
void Button::MousePressed(const MouseEvent& lEvent) { if(IsDisabled()) { return; } // If our parent is a GUIWindow, then makew this window have focus in the GUI, used to make it's depth the highest if(GetParent() != NULL && GetParent()->GetComponentType() == EComponentType_GUIWindow) { GUIWindow* lpParentWindow = (GUIWindow *)GetParent(); lpParentWindow->SetFocusWindow(); } SetSelected(true); OnMousePressed(); // Colour change if(m_bChangeLabelText) { for(unsigned int i = 0; i < m_vpAddedComponentList.size(); i++) { if(m_vpAddedComponentList[i]->GetComponentType() == EComponentType_Label) { ((Label*)m_vpAddedComponentList[i])->SetColour(m_PressedLabelColour); } } m_label.SetColour(m_PressedLabelColour); } // Position change if(m_offsetApplied == false) { for(unsigned int i = 0; i < m_vpAddedComponentList.size(); i++) { m_vpAddedComponentList[i]->SetLocation(m_vpAddedComponentList[i]->GetLocation().m_x + m_pressedOffsetX, m_vpAddedComponentList[i]->GetLocation().m_y + m_pressedOffsetY); } m_label.SetLocation(m_label.GetLocation().m_x + m_pressedOffsetX, m_label.GetLocation().m_y + m_pressedOffsetY); m_offsetApplied = true; } if(m_Callback_Pressed) { m_Callback_Pressed(m_pCallbackData_Pressed); } }
void Disabled() { while(IsDisabled()) { LEDLight->Set(Relay::kForward); rpi->Read(); lcd->Clear(); lcd->Printf(DriverStationLCD::kUser_Line3, 1, "R: %i", rpi->GetMissingPacketcount()); lcd->Printf(DriverStationLCD::kUser_Line1, 1, "x: %i", rpi->GetXPos()); lcd->Printf(DriverStationLCD::kUser_Line2, 1, "y: %i", rpi->GetYPos()); lcd->UpdateLCD(); } }
void CGUIRadioButtonControl::Render() { CGUIButtonControl::Render(); if ( IsSelected() && !IsDisabled() ) { if (HasFocus()) m_imgRadioOnFocus.Render(); else m_imgRadioOnNoFocus.Render(); } else if ( !IsSelected() && !IsDisabled() ) { if (HasFocus()) m_imgRadioOffFocus.Render(); else m_imgRadioOffNoFocus.Render(); } else if ( IsSelected() && IsDisabled() ) m_imgRadioOnDisabled.Render(); else m_imgRadioOffDisabled.Render(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponSpawner::Materialize( void ) { BaseClass::Materialize(); if ( !IsDisabled() ) { EmitSound( "Item.Materialize" ); CPVSFilter filter( GetAbsOrigin() ); //TE_TFParticleEffect( filter, 0.0f, RESPAWN_PARTICLE, GetAbsOrigin(), QAngle( 0,0,0 ) ); AddEffects( EF_ITEM_BLINK ); m_nRenderFX = kRenderFxNone; SetRenderColor( 255, 255, 255, 255 ); } }
bool HTMLTextAreaElement::IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) { if (nsGenericHTMLFormElementWithState::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) { return true; } // disabled textareas are not focusable *aIsFocusable = !IsDisabled(); return false; }
/** * Start a competition. * This code needs to track the order of the field starting to ensure that everything happens * in the right order. Repeatedly run the correct method, either Autonomous or OperatorControl * when the robot is enabled. After running the correct method, wait for some state to change, * either the other mode starts or the robot is disabled. Then go back and wait for the robot * to be enabled again. */ void SimpleRobot::StartCompetition() { nUsageReporting::report(nUsageReporting::kResourceType_Framework, nUsageReporting::kFramework_Simple); RobotMain(); if (!m_robotMainOverridden) { // first and one-time initialization RobotInit(); while (true) { if (IsDisabled()) { m_ds->InDisabled(true); Disabled(); m_ds->InDisabled(false); while (IsDisabled()) m_ds->WaitForData(); } else if (IsAutonomous()) { m_ds->InAutonomous(true); Autonomous(); m_ds->InAutonomous(false); while (IsAutonomous() && IsEnabled()) m_ds->WaitForData(); } else { m_ds->InOperatorControl(true); OperatorControl(); m_ds->InOperatorControl(false); while (IsOperatorControl() && IsEnabled()) m_ds->WaitForData(); } } } }
void MenuItem::DrawSelf() { // Reset visibility m_pSelectedIcon->SetVisible(false); m_pHoverIcon->SetVisible(false); m_pDisabledIcon->SetVisible(false); m_pDefaultIcon->SetVisible(false); if(!IsParentMenuOpen()) { m_label.SetVisible(false); return; } if(m_bOnlyShowSelectedItems) { if(IsSelected()) { m_pSelectedIcon->SetVisible(true); } else if(IsHover()) { m_pHoverIcon->SetVisible(true); } } else { if(IsSelected()) { m_pSelectedIcon->SetVisible(true); } else if(IsHover()) { m_pHoverIcon->SetVisible(true); } else if(IsDisabled()) { m_pDisabledIcon->SetVisible(true); } else { m_pDefaultIcon->SetVisible(true); } } // Set the label visibility m_label.SetVisible(true); }
void CTeamTrainWatcher::InternalSetNumTrainCappers( int iNumCappers, CBaseEntity *pTrigger ) { if ( IsDisabled() ) return; m_nNumCappers = iNumCappers; // inputdata.pCaller is hopefully an area capture // lets see if its blocked, and not start receding if it is CTriggerAreaCapture *pAreaCap = dynamic_cast<CTriggerAreaCapture *>( pTrigger ); if ( pAreaCap ) { m_bCapBlocked = pAreaCap->IsBlocked(); m_hAreaCap = pAreaCap; } if ( iNumCappers <= 0 && !m_bCapBlocked && m_bTrainCanRecede ) { if ( !m_bWaitingToRecede ) { // start receding in [tf_escort_cart_recede_time] seconds m_bWaitingToRecede = true; if ( TeamplayRoundBasedRules() && TeamplayRoundBasedRules()->InOvertime() ) { m_flRecedeTotalTime = tf_escort_recede_time_overtime.GetFloat(); } else { m_flRecedeTotalTime = tf_escort_recede_time.GetFloat(); if ( m_nTrainRecedeTime > 0 ) { m_flRecedeTotalTime = m_nTrainRecedeTime; } } m_flRecedeStartTime = gpGlobals->curtime; m_flRecedeTime = m_flRecedeStartTime + m_flRecedeTotalTime; } } else { // cancel receding m_bWaitingToRecede = false; m_flRecedeTime = 0; } HandleTrainMovement(); }
void aui_Button::MouseLDropOutside( aui_MouseEvent *mouseData ) { if (IsDisabled()) return; if ( GetMouseOwnership() == this ) { ReleaseMouseOwnership(); if ( m_mouseCode == AUI_ERRCODE_UNHANDLED ) m_mouseCode = AUI_ERRCODE_HANDLED; m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELDROPOUTSIDE; } }
void GUIWindowMinimizeButton::OnMouseClicked() { if(IsDisabled()) { return; } // Dont allow minizing the window if we have disabled this if(m_pParentGUIWindow->m_bAllowMinimizing == false) { return; } m_pParentGUIWindow->SetMinimized(!m_pParentGUIWindow->GetMinimized()); }
bool HTMLButtonElement::IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) { if (nsGenericHTMLFormElementWithState::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) { return true; } *aIsFocusable = #ifdef XP_MACOSX (!aWithMouse || nsFocusManager::sMouseFocusesFormControl) && #endif !IsDisabled(); return false; }
//----------------------------------------------------------------------------- // Purpose: Timer is paused at round end, stops the countdown //----------------------------------------------------------------------------- void CTeamRoundTimer::PauseTimer( void ) { if ( IsDisabled() ) return; if ( m_bTimerPaused == false ) { m_bTimerPaused = true; m_flTimeRemaining = m_flTimerEndTime - gpGlobals->curtime; } // Clear pause on win flag, because we've been set by the mapmaker m_bPauseDueToWin = false; }
void CGUIProgressControl::UpdateInfo(const CGUIListItem *item) { if (!IsDisabled()) { if (m_iInfoCode) { int value; if (g_infoManager.GetInt(value, m_iInfoCode, m_parentID, item)) m_fPercent = (float)value; if (m_fPercent < 0.0f) m_fPercent = 0.0f; if (m_fPercent > 100.0f) m_fPercent = 100.0f; } } }
/* SymButton() * ==================================================================== * Handles the routine when the Symbol Text button or Hebrew Text button * is pressed. A file selector is brought up to allow the user to select * a new Symbol font or Hebrew font. */ BOOLEAN SymButton( char *filename, int Title, int Text, char *title_field, BOOLEAN *flag ) { int out; long i; if( !IsDisabled( Text ) ) { Deselect( Text ); strcpy( newpath, dirpath ); for( i = strlen( newpath ); i && ( newpath[i] != '\\'); newpath[ i-- ] = '\0' ); if( strlen( filename ) ) { strcat( newpath, filename ); strcat( newpath, ".QFM" ); } out = fsel_name( FALSE, newpath, "*.QFM", title_field ); if( ( ( out == A_OK ) || ( out == A_CANCEL )) && ( newpath[0] != '\0' ) ) { if( out == A_OK ) { for( i = strlen( newpath ); i && ( newpath[i] != '.'); newpath[ i-- ] = '\0' ); newpath[i--] = '\0'; for( i = strlen( newpath ); i && ( newpath[i] != '\\'); i-- ); strcpy( filename, &newpath[ i + 1 ] ); ObString( Text ) = filename; } else { /* Clicked on OK with no filename, so we'll put none there */ filename[0] = '\0'; ObString( Text ) = &none_text[0]; out = A_OK; } Objc_draw( tree, Text, MAX_DEPTH, NULL ); Change_Flag = TRUE; } } if( !(*filename) ) { Disable( Title ); Disable( Text ); *flag = FALSE; Objc_draw( tree, Title, MAX_DEPTH, NULL ); Objc_draw( tree, Text, MAX_DEPTH, NULL ); Change_Flag = TRUE; } return( out == A_OK ); }
LRESULT SItemPanel::DoFrameEvent(UINT uMsg,WPARAM wParam,LPARAM lParam) { AddRef(); if(!IsDisabled()) { switch(uMsg) { case WM_MOUSEHOVER: { ModifyState(WndState_Hover,0,TRUE); EventItemPanelHover evt(this); FireEvent(evt); break; } case WM_MOUSELEAVE: { ModifyState(0,WndState_Hover,TRUE); EventItemPanelLeave evt(this); FireEvent(evt); break; } case WM_LBUTTONDOWN: { EventItemPanelClick evt(this); FireEvent(evt); break; } case WM_RBUTTONDOWN: { EventItemPanelRclick evt(this); FireEvent(evt); break; } case WM_LBUTTONDBLCLK: { EventItemPanelDbclick evt(this); FireEvent(evt); break; } } } SetMsgHandled(FALSE); LRESULT lRet=__super::DoFrameEvent(uMsg,wParam,lParam); Release(); return lRet; }
// Received Mouse events: bool nuiToggleButton::MouseClicked (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button) { if (IsDisabled()) return false; if (Button & nglMouseInfo::ButtonLeft) { mClicked = true; mWasPressed = IsPressed(); SetPressed(!mWasPressed); Grab(); Invalidate(); return true; } return false; }
void Background::MouseMoveAway(aui_MouseEvent *data) { if (IsDisabled()) return; Assert(data); if (data->movecount==0) { ProcessLastMouseMoveThisFrame(data); } g_cursorManager->SaveCursor(); g_cursorManager->SetCursor(CURSORINDEX_DEFAULT); m_lbutton_isdown = FALSE; }
void CTeamTrainWatcher::InternalSetSpeedForwardModifier( float flModifier ) { if ( IsDisabled() || !m_bHandleTrainMovement ) return; // store the passed value float flSpeedForwardModifier = flModifier; flSpeedForwardModifier = fabs( flSpeedForwardModifier ); m_flSpeedForwardModifier = clamp( flSpeedForwardModifier, 0.f, 1.f ); if ( m_hTrain ) { m_hTrain->SetSpeedForwardModifier( m_flSpeedForwardModifier ); } }
void CGUISettingsSliderControl::ProcessText() { bool changed = false; changed |= m_label.SetMaxRect(m_buttonControl.GetXPosition(), m_posY, m_posX - m_buttonControl.GetXPosition(), m_height); changed |= m_label.SetText(CGUISliderControl::GetDescription()); if (IsDisabled()) changed |= m_label.SetColor(CGUILabel::COLOR_DISABLED); else if (HasFocus()) changed |= m_label.SetColor(CGUILabel::COLOR_FOCUSED); else changed |= m_label.SetColor(CGUILabel::COLOR_TEXT); if (changed) MarkDirtyRegion(); }
void aui_Control::Highlight(bool status) { if(IgnoreHighlight()) return; sint32 renderFlags = GetCurrentRenderFlags(); if(status && !IsDisabled()) m_renderFlags |= k_AUI_CONTROL_LAYER_FLAG_HIGHLIGHT; else m_renderFlags &= ~k_AUI_CONTROL_LAYER_FLAG_HIGHLIGHT; if(GetCurrentRenderFlags() != renderFlags) ShouldDraw(); }
//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void CObjectTeleporter::TeleporterTouch( CBaseEntity *pOther ) { if ( IsDisabled() ) { return; } // if it's not a player, ignore if ( !pOther->IsPlayer() ) return; CTFPlayer *pPlayer = ToTFPlayer( pOther ); int bTwoWayTeleporter = 0; CALL_ATTRIB_HOOK_INT_ON_OTHER( pPlayer, bTwoWayTeleporter, bidirectional_teleport ); // is this an entrance and do we have an exit? if ( GetObjectMode() == TELEPORTER_TYPE_ENTRANCE || bTwoWayTeleporter > 0 ) { if ( ( m_iState == TELEPORTER_STATE_READY ) ) { // are we able to teleport? if ( !PlayerCanBeTeleported( pPlayer ) ) { if ( pPlayer->HasTheFlag() ) { // If they have the flag, print a warning that you can't tele with the flag CSingleUserRecipientFilter filter( pPlayer ); TFGameRules()->SendHudNotification( filter, HUD_NOTIFY_NO_TELE_WITH_FLAG ); } return; } // get the velocity of the player touching the teleporter if ( pPlayer->GetAbsVelocity().Length() < 5.0 ) { CObjectTeleporter *pDest = GetMatchingTeleporter(); if ( pDest ) { TeleporterSend( pPlayer ); } } } } }
void CDuiScrollBar::OnPaint(CDCHandle dc) { if(!m_pSkin) return; int nState=IsDisabled(TRUE)?3:0; CRect rcDest; rcDest=GetPartRect(SB_LINEUP); m_pSkin->Draw(dc,rcDest,MAKESBSTATE(SB_LINEUP,nState,m_bVertical),m_byAlpha); rcDest=GetPartRect(SB_PAGEUP); m_pSkin->Draw(dc,rcDest,MAKESBSTATE(SB_PAGEUP,nState,m_bVertical),m_byAlpha); rcDest=GetPartRect(SB_THUMBTRACK); m_pSkin->Draw(dc,rcDest,MAKESBSTATE(SB_THUMBTRACK,nState,m_bVertical),m_byAlpha); rcDest=GetPartRect(SB_PAGEDOWN); m_pSkin->Draw(dc,rcDest,MAKESBSTATE(SB_PAGEDOWN,nState,m_bVertical),m_byAlpha); rcDest=GetPartRect(SB_LINEDOWN); m_pSkin->Draw(dc,rcDest,MAKESBSTATE(SB_LINEDOWN,nState,m_bVertical),m_byAlpha); }