MyToolBar.cpp
上传用户:cding2008
上传日期:2007-01-03
资源大小:1812k
文件大小:2k
- /////////////////////////////////////////////////////////////////////////////
- // MyToolBar.cpp : implementation of the CMyToolBar floating
- // tool palette class
- //
- // ModelMagic 3D and 'glOOP' (OpenGL Object Oriented Programming library)
- // Copyright (c) Craig Fahrnbach 1997, 1999
- //
- // OpenGL is a registered trademark of Silicon Graphics
- //
- //
- // This program is provided for educational and personal use only and
- // is provided without guarantee or warrantee expressed or implied.
- //
- // Commercial use is strickly prohibited without written permission
- // from ImageWare Development.
- //
- /////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "ModelMagic3D.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyToolBar
- BEGIN_MESSAGE_MAP(CMyToolBar, CToolBar)
- //{{AFX_MSG_MAP(CMyToolBar)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyToolBar construction/destruction
- CMyToolBar::CMyToolBar()
- {
- m_nColumns = 2;
- m_cxLeftBorder = 5;
- m_cxRightBorder = 5;
- m_cyTopBorder = 5;
- m_cyBottomBorder = 5;
- }
- CMyToolBar::~CMyToolBar()
- {
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyToolBar diagnostics
- #ifdef _DEBUG
- void CMyToolBar::AssertValid() const
- {
- CToolBar::AssertValid();
- }
- void CMyToolBar::Dump(CDumpContext& dc) const
- {
- CToolBar::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CMyToolBar message handlers
- void CMyToolBar::SetColumns(UINT nColumns)
- {
- m_nColumns = nColumns;
- int nCount = GetToolBarCtrl().GetButtonCount();
- for(int i = 0; i < nCount; i++)
- {
- UINT nStyle = GetButtonStyle(i);
- BOOL bWrap = (((i + 1) % nColumns) == 0);
- if (bWrap)
- nStyle |= TBBS_WRAPPED;
- else
- nStyle &= ~TBBS_WRAPPED;
-
- SetButtonStyle(i, nStyle);
- }
-
- Invalidate();
- GetParentFrame()->RecalcLayout();
- }