void C_Slider::SetSubParents(C_Window *) { if(Slider_) { switch(GetType()) { case C_TYPE_VERTICAL: SetSliderRange(0,GetH()-(Slider_->Header->h)); break; case C_TYPE_HORIZONTAL: SetSliderRange(0,GetW()-(Slider_->Header->w)); break; } } }
void SetControlRange ( int iControlID, int iMin, int iMax ) { switch ( g_pControls[iControlID].sType ) { case WINCONTROL_PROGRESS : SetProgressRange ( iControlID, iMin, iMax ); break; case WINCONTROL_SLIDER : SetSliderRange ( iControlID, iMin, iMax ); break; case WINCONTROL_SCROLLBAR : SetScrollBarRange ( iControlID, iMin, iMax ); break; } }
int MakeControlSlider ( int iControlID, int iStyle, int iExtendedStyle, int iMin, int iMax, int iX, int iY, int iWidth, int iHeight ) { // Assign the style DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle ); DWORD dwSelectStyle = TBS_HORZ | TBS_NOTICKS | TBS_BOTH; switch ( iStyle ) { case 1 : dwSelectStyle = TBS_HORZ | TBS_NOTICKS | TBS_BOTH; break; case 2 : dwSelectStyle = TBS_VERT | TBS_NOTICKS | TBS_BOTH; break; case 3 : dwSelectStyle = TBS_HORZ; break; case 4 : dwSelectStyle = TBS_VERT; break; case 5 : dwSelectStyle = TBS_HORZ | TBS_AUTOTICKS; break; case 6 : dwSelectStyle = TBS_VERT | TBS_AUTOTICKS; break; case 7 : dwSelectStyle = TBS_ENABLESELRANGE; break; } // Create control MaintainGlobalHWND(); if ( !CreateControl ( iControlID, g_pGlob->hWnd, TRACKBAR_CLASS, dwExtendedStyle, dwSelectStyle, "", iX, iY, iWidth, iHeight ) ) return 0; // Ticks always represented by a line SendMessage ( g_pControls[iControlID].hWnd, TBM_SETTICFREQ, (WPARAM)1, 0 ); // Setup control SetSliderRange ( iControlID, iMin, iMax ); SetSliderPosition ( iControlID, iMin+((iMax-iMin)/2) ); // Subclass to get access to all control messages directly g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( g_pControls [ iControlID ].hWnd, GWL_WNDPROC, (LONG)SubClassControlWinProc ); // Update safe rects after new addition UpdateSafeRectsArray(); // Success return 1; }