X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..894d74dcc233b7f9a936767558f3e061593dd062:/src/univ/slider.cpp diff --git a/src/univ/slider.cpp b/src/univ/slider.cpp index 99aee782c7..df73dc6951 100644 --- a/src/univ/slider.cpp +++ b/src/univ/slider.cpp @@ -6,7 +6,7 @@ // Created: 09.02.01 // RCS-ID: $Id$ // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWidgets licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// /* @@ -143,7 +143,7 @@ bool wxSlider::Create(wxWindow *parent, { if ( !wxSliderBase::Create(parent, id, pos, size, style, validator, name) ) - return FALSE; + return false; SetRange(minValue, maxValue); SetValue(value); @@ -154,7 +154,7 @@ bool wxSlider::Create(wxWindow *parent, CreateInputHandler(wxINP_HANDLER_SLIDER); - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -184,11 +184,11 @@ bool wxSlider::ChangeValueBy(int inc) bool wxSlider::ChangeValueTo(int value) { // check if the value is going to change at all - if (value == m_value) return FALSE; + if (value == m_value) return false; // this method is protected and we should only call it with normalized // value! - wxCHECK_MSG( IsInRange(value), FALSE, _T("invalid slider value") ); + wxCHECK_MSG( IsInRange(value), false, _T("invalid slider value") ); m_value = value; @@ -201,7 +201,7 @@ bool wxSlider::ChangeValueTo(int value) (void)GetEventHandler()->ProcessEvent(event); - return TRUE; + return true; } void wxSlider::SetValue(int value) @@ -313,7 +313,7 @@ int wxSlider::GetThumbLength() const { wxSize sz = GetDefaultThumbSize(); int len = (IsVert() ? sz.x : sz.y); - if (m_thumbSize > len) + if (m_thumbSize > len) { return m_thumbSize; } @@ -389,7 +389,7 @@ wxSize wxSlider::DoGetBestClientSize() const if ( HasTicks() ) { wxCoord lenTick = GetRenderer()->GetSliderTickLen(); - if (style & wxSL_BOTH) + if (style & wxSL_BOTH) { lenTick = 2 * lenTick; } @@ -482,25 +482,25 @@ void wxSlider::CalcGeometry() m_rectLabel = wxRect(rectTotal.GetPosition(), sizeLabels); - if (style & wxSL_TOP) + if (style & wxSL_TOP) { // shrink and offset the slider to the bottom m_rectSlider.y += sizeLabels.y + SLIDER_LABEL_MARGIN; m_rectSlider.height -= sizeLabels.y + SLIDER_LABEL_MARGIN; } - else if (style & wxSL_BOTTOM) + else if (style & wxSL_BOTTOM) { // shrink the slider and move the label to the bottom m_rectSlider.height -= sizeLabels.y + SLIDER_LABEL_MARGIN; m_rectLabel.y += m_rectSlider.height + SLIDER_LABEL_MARGIN; } - else if (style & wxSL_LEFT) + else if (style & wxSL_LEFT) { // shrink and offset the slider to the right m_rectSlider.x += sizeLabels.x + SLIDER_LABEL_MARGIN; m_rectSlider.width -= sizeLabels.x + SLIDER_LABEL_MARGIN; } - else if (style & wxSL_RIGHT) + else if (style & wxSL_RIGHT) { // shrink the slider and move the label to the right m_rectSlider.width -= sizeLabels.x + SLIDER_LABEL_MARGIN; @@ -518,7 +518,7 @@ void wxSlider::CalcGeometry() if ( IsVert() ) { - if (style & (wxSL_LEFT|wxSL_BOTH)) + if (style & (wxSL_LEFT|wxSL_BOTH)) { m_rectTicks.x = m_rectSlider.x; } @@ -530,7 +530,7 @@ void wxSlider::CalcGeometry() } else // horizontal { - if (style & (wxSL_TOP|wxSL_BOTH)) + if (style & (wxSL_TOP|wxSL_BOTH)) { m_rectTicks.y = m_rectSlider.y; } @@ -599,8 +599,9 @@ void wxSlider::CalcThumbRect(const wxRect *rectShaftIn, } wxCoord lenShaft, - lenThumb, - *p; + lenThumb; + wxCoord *p; + wxRect rectThumb(rectShaft.GetPosition(), GetThumbSize()); if ( isVertical ) { @@ -708,19 +709,19 @@ void wxSlider::DoDraw(wxControlRenderer *renderer) { // align it to be close to the shaft int align = 0; - if (style & wxSL_TOP) + if (style & wxSL_TOP) { align = wxALIGN_CENTRE_HORIZONTAL|wxALIGN_TOP; } - else if (style & wxSL_BOTTOM) + else if (style & wxSL_BOTTOM) { align = wxALIGN_CENTRE_HORIZONTAL|wxALIGN_BOTTOM; } - else if (style & wxSL_LEFT) + else if (style & wxSL_LEFT) { align = wxALIGN_CENTRE_VERTICAL|wxALIGN_LEFT; } - else if (style & wxSL_RIGHT) + else if (style & wxSL_RIGHT) { align = wxALIGN_CENTRE_VERTICAL|wxALIGN_RIGHT; } @@ -773,7 +774,7 @@ bool wxSlider::PerformAction(const wxControlAction& action, else if ( action == wxACTION_SLIDER_THUMB_DRAG ) { // no special processing for it - return TRUE; + return true; } else if ( action == wxACTION_SLIDER_THUMB_MOVE || action == wxACTION_SLIDER_THUMB_RELEASE ) @@ -785,7 +786,7 @@ bool wxSlider::PerformAction(const wxControlAction& action, return wxControl::PerformAction(action, numArg, strArg); } - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -799,14 +800,14 @@ wxScrollThumb::Shaft wxSlider::HitTest(const wxPoint& pt) const CalcThumbRect(&rectShaft, &rectThumb, NULL); // check for possible shaft or thumb hit - if (!rectShaft.Inside(pt) && !rectThumb.Inside(pt)) + if (!rectShaft.Inside(pt) && !rectThumb.Inside(pt)) { return wxScrollThumb::Shaft_None; } // the position to test and the start and end of the thumb wxCoord x, x1, x2, x3, x4; - if (IsVert()) + if (IsVert()) { x = pt.y; x1 = rectThumb.GetBottom(); @@ -822,7 +823,7 @@ wxScrollThumb::Shaft wxSlider::HitTest(const wxPoint& pt) const x3 = rectThumb.GetRight(); x4 = rectShaft.GetRight(); } - if ((x1 <= x) & (x < x2)) + if ((x1 <= x) & (x < x2)) { // or to the left return wxScrollThumb::Shaft_Above; @@ -896,7 +897,7 @@ void wxSlider::SetShaftPartState(wxScrollThumb::Shaft shaftPart, void wxSlider::OnThumbDragStart(int pos) { - if (IsVert()) + if (IsVert()) { PerformAction(wxACTION_SLIDER_THUMB_DRAG, m_max - pos); } @@ -908,7 +909,7 @@ void wxSlider::OnThumbDragStart(int pos) void wxSlider::OnThumbDrag(int pos) { - if (IsVert()) + if (IsVert()) { PerformAction(wxACTION_SLIDER_THUMB_MOVE, m_max - pos); } @@ -920,7 +921,7 @@ void wxSlider::OnThumbDrag(int pos) void wxSlider::OnThumbDragEnd(int pos) { - if (IsVert()) + if (IsVert()) { PerformAction(wxACTION_SLIDER_THUMB_RELEASE, m_max - pos); } @@ -987,11 +988,11 @@ bool wxStdSliderButtonInputHandler::HandleKey(wxInputConsumer *consumer, break; } - if ( !!action ) + if ( !action.IsEmpty() ) { consumer->PerformAction(action); - return TRUE; + return true; } } @@ -1006,7 +1007,7 @@ bool wxStdSliderButtonInputHandler::HandleMouse(wxInputConsumer *consumer, if ( slider->GetThumb().HandleMouse(event) ) { // processed by the thumb - return FALSE; + return false; } return wxStdInputHandler::HandleMouse(consumer, event); @@ -1020,7 +1021,7 @@ bool wxStdSliderButtonInputHandler::HandleMouseMove(wxInputConsumer *consumer, if ( slider->GetThumb().HandleMouseMove(event) ) { // processed by the thumb - return FALSE; + return false; } return wxStdInputHandler::HandleMouseMove(consumer, event); @@ -1031,7 +1032,7 @@ wxStdSliderButtonInputHandler::HandleFocus(wxInputConsumer * WXUNUSED(consumer), const wxFocusEvent& WXUNUSED(event)) { // slider's appearance changes when it gets/loses focus - return TRUE; + return true; } #endif // wxUSE_SLIDER