bool CText::MouseMove( CMouse * pMouse, bool ) { CPos Pos = *GetRelPos(); if(GetParent()) Pos = *GetParent()->GetAbsPos() + Pos; SetElementState( SetMouseOver( pMouse->InArea( Pos.GetX(), Pos.GetY(), GetFont()->GetStringWidth( GetFormatted().c_str() ), GetFont()->GetStringHeight() ) )?_UI("MouseOver"):_UI("Norm") ); return 0; }
void CText::Draw() { if(!GetFormatted().c_str()) return; CPos Pos = *GetRelPos(); if(GetParent()) Pos = *GetParent()->GetAbsPos() + Pos; GetFont()->DrawString( Pos.GetX(), Pos.GetY(), 0, pString, GetFormatted().c_str(), GetWidth() ); }
//-------------------------------------------------------------------------------------- bool CProgressBarHorizontal::HandleMouse ( UINT uMsg, CPos pos, WPARAM wParam, LPARAM lParam ) { if ( !CanHaveFocus () ) return false; switch ( uMsg ) { case WM_MOUSEMOVE: { if ( m_bPressed ) { SetValue ( ValueFromPos ( pos.GetX () - m_rProgress.pos.GetX () ) ); return true; } break; } case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: { if ( m_rBoundingBox.InControlArea ( pos ) ) { // Pressed while inside the control m_bPressed = true; if ( m_pParent ) m_pParent->RequestControlFocus ( this ); m_timer.Start ( PROGRESSBAR_ARROWCLICK_START ); if ( pos.GetX () > m_rProgress.pos.GetX () + m_rProgress.size.cx ) { SetValue ( m_fValue + m_fStep ); return true; } if ( pos.GetX () < m_rProgress.pos.GetX () + m_rProgress.size.cx ) { SetValue ( m_fValue - m_fStep ); return true; } return true; } break; } case WM_LBUTTONUP: { if ( m_bPressed ) { m_bPressed = false; if ( m_pParent ) m_pParent->ClearControlFocus (); return true; } break; } } return false; }