32f1743179d877cef69b43576d376a36949977c2
[reactos.git] / subsys / system / explorer / Seashell / SeaShellExt / Include / UIFixTB.h
1 ////////////////////////////////////////////////////////////////
2 // Copyright 1998 Paul DiLascia
3 // If this code works, it was written by Paul DiLascia.
4 // If not, I don't know who wrote it.
5 //
6 #ifndef __FIXTB_H
7 #define __FIXTB_H
8
9 //////////////////
10 // This class fixes the sizing bugs in MFC that calculates the
11 // size of toolbars incorrectly for modern toobars (comctl32 version >= 4.71)
12 // It also contains a number of wrappers for function that CToolBar doesn't
13 // have (so you don't have to use GetToolBarCtrl).
14 //
15 // Generally, you should use CFlatToolBar instead of CFixMFCToolBar (even
16 // if you're not using the flat style), but you can use CFixMFCToolBar if
17 // all you want is the sizing fix for MFC tooblars.
18 //
19 class CTRL_EXT_CLASS CFixMFCToolBar : public CToolBar {
20 public:
21         CFixMFCToolBar();
22         virtual ~CFixMFCToolBar();
23
24         static int iVerComCtl32; // version of commctl32.dll (eg 471)
25
26         // There is a bug in comctl32.dll, version 4.71+ that causes it to
27         // draw vertical separators in addition to horizontal ones, when the
28         // toolbar is vertically docked. If the toolbar has no dropdown buttons,
29         // this is not a problem because the separators are ignored when calculating
30         // the width of the toolbar. If, however, you have dropdown buttons, then the
31         // width of a vertically docked toolbar will be too narrow to show the
32         // dropdown arrow. This is in fact what happens in Visual Studio. If you
33         // want to show the dropdown arrow when vertical, set this to TRUE
34         // (default = FALSE)
35         //
36         BOOL m_bShowDropdownArrowWhenVertical;
37
38         virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
39         virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
40
41         CSize CalcLayout(DWORD nMode, int nLength = -1);
42         CSize CalcSize(TBBUTTON* pData, int nCount);
43         int WrapToolBar(TBBUTTON* pData, int nCount, int nWidth);
44         void SizeToolBar(TBBUTTON* pData, int nCount, int nLength,
45                 BOOL bVert = FALSE);
46         virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle);
47
48         virtual CSize GetButtonSize(TBBUTTON* pData, int iButton);
49
50         // MFC has versions of these that are protected--but why?
51         //
52         void GetButton(int nIndex, TBBUTTON* pButton) const;
53         void SetButton(int nIndex, TBBUTTON* pButton);
54
55 protected:
56         LRESULT OnSizeHelper(CSize& sz, LPARAM lp);
57         afx_msg LRESULT OnSetBitmapSize(WPARAM, LPARAM);
58         afx_msg LRESULT OnSetButtonSize(WPARAM, LPARAM);
59         afx_msg LRESULT OnSettingChange(WPARAM, LPARAM);
60         DECLARE_MESSAGE_MAP()
61         DECLARE_DYNAMIC(CFixMFCToolBar)
62 };
63
64 #endif