Download demo project - 71 Kb
Download source files - 28 Kb
<!-- Article Starts -->
This is yet another control inspired from the Outlook shortcut-bar. The
CWndSliderView control is pretty much (to put it simply) a child window manager, with fancy looking buttons and a cool sliding window animation effect. The control was created to be rather simple and self explanatory. I have done my best to heavily comment
CWndSliderView's source code. Hopefully everyone who views my code will find it useful and or educational. Have fun!
Setting up and using the CWndSliderView control
First create an instance of
CWndSliderView in the Main Frame of your application. On
CMainFrame::OnCreate, get a pointer to the context information and the
CWndSliderView. To create a new child view, call
CWndSliderView::Create with the new child views title,
RUNTIME_CLASS pointer, and create context parameters.
CWndSliderView::Create returns SOB_ERROR on error; otherwise the index of newly created view. Use
CWndSlider::ModifyViewStyle to make child views animate vertically or horizontally. That's pretty much it. It's all simple.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
CCreateContext* pContext = (CCreateContext*)lpCreateStruct->lpCreateParams;
CWndSliderView *pObar = STATIC_DOWNCAST( CWndSliderView, m_wndSplitter.GetPane(0,0) );
if( NULL != pObar )
pObar->ModifyBarStyle( SOB_BAR_HORZ, SOB_BAR_VERT, FALSE );
nID = pObar->CreateView( _T("0 CMyListView 0"), RUNTIME_CLASS(CMyListView), pContext );
ASSERT( SOB_ERROR != nID );
nID = pObar->CreateView( _T("1 CEditView 1"), RUNTIME_CLASS(CEditView), pContext );
ASSERT( SOB_ERROR != nID );
SOB_VIEW_DEFAULT_BTN_HEIGHT : Increase or decrease to change default button height (VALUE = 24 pixels).
SOB_VIEW_DEFAULT_ANIMATION_SPEED :Increase or decrease to change animation step speed (VALUE = 10 ms).
SOB_VIEW_DEFAULT_ANIMATION_LIMIT : Increase or decrease value to to limit the total amount of time spent animating (VALUE = 200 ms).
SOB_VIEW_HORZ : Set view style bit to have child windows animate horizontally (DEFAULT).
SOB_VIEW_VERT : Set view style bit to have child windows animate vertically.
SOB_VIEW_ANIMATE : Set view style bit to turn on child window animation (DEFAULT).
Set button style bit to turn on animation (DEFAULT) - used to turn off animation per child window.
SOB_BTN_FANCYFACE : Set button style bit to turn on 3D fancy face surface (DEFAULT).
Comments, suggestions, and notes
CWndSliderView is just the sliding / animating component of a "Outlook Bar." Perhaps someday in the future when I have some free time, I'll work on a real "Outlook Bar" looking control. Until then... If anyone has comments, suggestions, or questions please feel free to send me a quick message.