Definition at line 219 of file Slider.h. References mHorizontal, mMaxVal, mMinVal, OglGui::OglWindow::mOglWnd, mSliderListener, mSliderListenerData, mThumbH, mThumbW, and mVal. Referenced by MouseFunc(). 00220 { 00221 float nVal; 00222 00223 if (mHorizontal) 00224 { 00225 x -= mThumbW/2; 00226 00227 nVal = mMinVal + (x / (float) (mOglWnd->width-mThumbW)) 00228 * (mMaxVal-mMinVal); 00229 if (nVal > mMaxVal) nVal = mMaxVal; 00230 if (nVal < mMinVal) nVal = mMinVal; 00231 if (nVal == mVal) 00232 return; 00233 } 00234 else 00235 { 00236 y -= mThumbH/2; 00237 00238 nVal = mMinVal + (y / (float) (mOglWnd->height-mThumbH)) 00239 * (mMaxVal-mMinVal); 00240 if (nVal > mMaxVal) nVal = mMaxVal; 00241 if (nVal < mMinVal) nVal = mMinVal; 00242 if (nVal == mVal) 00243 return; 00244 } 00245 mVal = (int) nVal; 00246 if (mSliderListener) 00247 mSliderListener->SliderChangedEvent(this, mSliderListenerData); 00248 }
|