⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wtl docking windows.mht

📁 大家知道wtl是window UI库
💻 MHT
📖 第 1 页 / 共 5 页
字号:
        ...
        CRect rcBar(<SPAN class=3Dcpp-literal>0</SPAN>,<SPAN =
class=3Dcpp-literal>0</SPAN>,<SPAN class=3Dcpp-literal>100</SPAN>,<SPAN =
class=3Dcpp-literal>100</SPAN>);
        m_sampleDockWnd.Create(m_hWnd,rcBar,_T(<SPAN =
class=3Dcpp-string>"Sample docking window"</SPAN>));
        ...
}
</PRE>Do not use empty rect even if you dock the window. When window=20
        start dragging it use previously stored floating rect size. =
</LI></UL>
      <H3>Add to generic window support for docking window =
features.</H3>
      <P>To implement a window with docking window features, derive a =
class from=20
      <CODE>dockwins::CDockingSiteImpl</CODE>. In derived class chain =
default=20
      message map to the base class.</P><PRE><SPAN =
class=3Dcpp-keyword>class</SPAN> CDockSiteSampleWnd : <SPAN =
class=3Dcpp-keyword>public</SPAN> dockwins::CDockingSiteImpl &lt; =
CDockSiteSampleWnd &gt;
{
        <SPAN class=3Dcpp-keyword>typedef</SPAN> =
dockwins::CDockingSiteImpl &lt; CDockSiteSampleWnd &gt; baseClass;
<SPAN class=3Dcpp-keyword>public</SPAN>:
        DECLARE_WND_CLASS(_T(<SPAN =
class=3Dcpp-string>"CDockSiteSampleWnd"</SPAN>))
        BEGIN_MSG_MAP(CDockSiteSampleWnd)
                CHAIN_MSG_MAP(baseClass)
        END_MSG_MAP()
};
</PRE>
      <H3>Add support for tabbed docking window.</H3>
      <UL>
        <LI>The tabbed docking window depend on <A=20
        =
href=3D"http://www.codeproject.com/wtl/TabbingFramework.asp">Daniel=20
        Bowen's The Codeproject article "Custom Tab Controls,Tabbed =
Frame and=20
        Tabbed MDI"</A>, Please download the source code for this=20
        article.<BR><BR>
        <LI>Change the base class of your docking window from=20
        <CODE>dockwins::CTitleDockingWindowImpl</CODE> to=20
        <CODE>dockwins::CBoxedDockingWindowImpl</CODE>.<BR><BR>
        <LI>Use the following classes as traits for the=20
        <CODE>dockwins::CBoxedDockingWindowImpl</CODE>:=20
        <CODE>COutlookLikeBoxedDockingWindowTraits</CODE>,=20
        <CODE>COutlookLikeExBoxedDockingWindowTraits</CODE> or=20
        <CODE>CVC6LikeBoxedDockingWindowTraits</CODE>.<BR><BR>
        <LI>To add tabbed docking features support to the previous=20
        <CODE>CSampleDockingWindow</CODE> class, the code should look =
like this:=20
<PRE><SPAN class=3Dcpp-keyword>class</SPAN> CSampleTabDockingWindow :
         <SPAN class=3Dcpp-keyword>public</SPAN> =
dockwins::CBoxedDockingWindowImpl&lt; SampleDockingWindow,
                CWindow, dockwins::COutlookLikeBoxedDockingWindowTraits =
&gt;
{
        <SPAN class=3Dcpp-keyword>typedef</SPAN> CSampleTabDockingWindow =
   thisClass;
        <SPAN class=3Dcpp-keyword>typedef</SPAN> =
dockwins::CBoxedDockingWindowImpl&lt;CSAMPLEDOCKINGWINDOW,CWINDOW,
         dockwins::COutlookLikeBoxedDockingWindowTraits&gt;  baseClass;
<SPAN class=3Dcpp-keyword>public</SPAN>:
        DECLARE_WND_CLASS(_T(<SPAN =
class=3Dcpp-string>"CSampleTabDockingWindow"</SPAN>))
        BEGIN_MSG_MAP(thisClass)
                CHAIN_MSG_MAP(baseClass)
        END_MSG_MAP()
};
</PRE></LI></UL>
      <H3>Add support for auto-hiding features.</H3>
      <P>To add auto-hiding features to your project just include a=20
      <CODE>DWAutoHide.h</CODE> header before any other docking windows=20
      headers.</P>
      <H3>Dock a docking window.</H3>
      <P>Call the <CODE>DockWindow</CODE> methods from your frame window =

      class.</P><PRE><SPAN class=3Dcpp-keyword>template</SPAN>&lt;<SPAN =
class=3Dcpp-keyword>class</SPAN> T&gt;
<SPAN class=3Dcpp-keyword>bool</SPAN> DockWindow(T&amp; =
dockWnd,CDockingSide side,
                <SPAN class=3Dcpp-keyword>unsigned</SPAN> <SPAN =
class=3Dcpp-keyword>long</SPAN> nBar,<SPAN =
class=3Dcpp-keyword>float</SPAN> fPctPos,
                <SPAN class=3Dcpp-keyword>unsigned</SPAN> <SPAN =
class=3Dcpp-keyword>long</SPAN> nWidth, <SPAN =
class=3Dcpp-keyword>unsigned</SPAN> <SPAN =
class=3Dcpp-keyword>long</SPAN> nHeight);
</PRE>
      <DL>
        <DT><I>dockWnd</I>=20
        <DD>Docking window.=20
        <DT><I>side</I>=20
        <DD>Sides of the frame window to dock=20
        to<BR><CODE>CDockingSide::sSingle</CODE> force docking window to =
occupy=20
        the fulll width of the docking bar, combine this style with one =
of the=20
        following:<BR><CODE>CDockingSide::sRight</CODE> Dock to the =
right side=20
        of the frame window.<BR><CODE>CDockingSide::sLeft</CODE> Dock to =
the=20
        left side of the frame =
window.<BR><CODE>CDockingSide::sTop</CODE> Dock=20
        to the top side of the frame=20
        window.<BR><CODE>CDockingSide::sBottom</CODE> Dock to the bottom =
side of=20
        the frame window.=20
        <DT><I>nBar</I>=20
        <DD>Index of dockbar to dock to, it's zero-based.=20
        <DT><I>fPctPos</I>=20
        <DD>The percent of the dock bar=92s width that the docking =
window should=20
        use as top point.=20
        <DT><I>nWidth</I>=20
        <DD>The requested width (in pixels) of the docking window. If =
the=20
        docking window is vertical, this parameter actually represents =
the=20
        control bar height.=20
        <DT><I>nHeight</I>=20
        <DD>The requested height (in pixels) of the docking window. If =
the=20
        docking window is vertical, this parameter actually represents =
the=20
        control bar width. </DD></DL>
      <H3>Dock one tabbed docking window to another.</H3>
      <P>Call the <CODE>DockTo</CODE> method of the tabbed docking =
window.</P><PRE><SPAN class=3Dcpp-keyword>bool</SPAN> DockTo(HWND =
hWnd,<SPAN class=3Dcpp-keyword>int</SPAN> index=3D<SPAN =
class=3Dcpp-literal>0</SPAN>);
</PRE>
      <DL>
        <DT><I>hWnd</I>=20
        <DD>Tabbed docking window to dock to.=20
        <DT><I>index</I>=20
        <DD>Zero-based index. </DD></DL>
      <H3>Float a docking window that is docked.</H3>
      <P>Call the <CODE>Float</CODE> methods from your docking window=20
      class.<BR></P>
      <DL>
        <DD><CODE><SPAN class=3Dcpp-keyword>bool</SPAN> Float()</CODE> - =
restore=20
        previous floating position<BR>
        <DD><CODE><SPAN class=3Dcpp-keyword>bool</SPAN> Float(LPCRECT=20
        =
pRc,&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
        UINT flags=3DSWP_SHOWWINDOW |=20
        =
SWP_NOACTIVATE,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
        HWND hWndInsertAfter=3DHWND_TOP)</CODE> - float docking window =
and move to=20
        a specified location. </DD></DL>
      <H3>Pin-up docking window.</H3>
      <P>Call the one of the <CODE>PinUp</CODE> methods of the tabbed =
docking=20
      window.</P><PRE><SPAN class=3Dcpp-keyword>bool</SPAN> PinUp(<SPAN =
class=3Dcpp-keyword>const</SPAN> CDockingSide&amp; side);
<SPAN class=3Dcpp-keyword>bool</SPAN> PinUp(<SPAN =
class=3Dcpp-keyword>const</SPAN> CDockingSide&amp; side, <SPAN =
class=3Dcpp-keyword>unsigned</SPAN> <SPAN =
class=3Dcpp-keyword>long</SPAN> width, <SPAN =
class=3Dcpp-keyword>bool</SPAN> bVisualize=3D<SPAN =
class=3Dcpp-keyword>false</SPAN>);
</PRE>
      <DL>
        <DT><I>side</I>=20
        <DD>Sides of the frame window to pin-up=20
        to:<BR><CODE>CDockingSide::sRight</CODE> Pin-up to the right =
side of the=20
        frame window.<BR><CODE>CDockingSide::sLeft</CODE> Pin-up to the =
left=20
        side of the frame window.<BR><CODE>CDockingSide::sTop</CODE> =
Pin-up to=20
        the top side of the frame =
window.<BR><CODE>CDockingSide::sBottom</CODE>=20
        Pin-up to the bottom side of the frame window.=20
        <DT><I>width</I>=20
        <DD>The requested width (in pixels) of the docking window.=20
        <DT><I>bVisualize</I>=20
        <DD>Specifies the show state of the docking window after =
pinning.=20
      </DD></DL>
      <H3>Unpin pinned docking window.</H3>
      <P>Call <CODE>Hide</CODE> then <CODE>Show</CODE> methods of the =
pinned=20
      window to emulate the pin button press,<BR>or call =
<CODE>Float</CODE>=20
      method to float a pinned docking window,<BR>or call =
<CODE>Hide</CODE>=20
      method then call any functions that set docking window =
position.</P>
      <H3>Receive notifications when the docked state of a docking =
window=20
      changes.</H3>
      <P>Override the following member functions of your docking window=20
      class</P><CODE><SPAN class=3Dcpp-keyword>void</SPAN> =
OnDocked(HDOCKBAR=20
      hBar,<SPAN class=3Dcpp-keyword>bool</SPAN> bHorizontal)</CODE>=20
      <BR><CODE><SPAN class=3Dcpp-keyword>void</SPAN> =
OnUndocked(HDOCKBAR=20
      hBar)</CODE>=20
      <DL>
        <DT><I>hBar</I>=20
        <DD>Handle to the dockbar to docking to.=20
        <DT><I>bHorizontal</I>=20
        <DD>Docking window orientation. </DD></DL>
      <H3>Hide/Show a docking window.</H3>
      <P>To hide/show a docking window simply call <CODE>Hide()</CODE>/=20
      <CODE>Show()</CODE> or <CODE>Togle()</CODE> methods of the=20
      <CODE>CTitleDockingWindowImpl</CODE> class.</P>
      <H3>Specify minimum docking window size.</H3>
      <P>You can specify minimum docking window size by overriding=20
      <CODE>GetMinMaxInfo</CODE> method of your docking window, like =
this:</P><PRE>  <SPAN class=3Dcpp-keyword>void</SPAN> =
GetMinMaxInfo(LPMINMAXINFO pMinMaxInfo) <SPAN =
class=3Dcpp-keyword>const</SPAN>
  {
     pMinMaxInfo-&gt;ptMinTrackSize.y=3D<SPAN =
class=3Dcpp-literal>100</SPAN>;
     pMinMaxInfo-&gt;ptMinTrackSize.x=3D<SPAN =
class=3Dcpp-literal>100</SPAN>;
  }

</PRE>&nbsp;=20
      <H3>Preserve docking window position.</H3>
      <P>You can use following member functions of the=20
      <CODE>CDockingWindowBaseImpl</CODE> class:</P>
      <DL>
        <DD><CODE><SPAN class=3Dcpp-keyword>bool</SPAN>=20
        GetDockingWindowPlacement(DFDOCKPOSEX* pHdr) <SPAN=20
        class=3Dcpp-keyword>const</SPAN></CODE><BR>
        <DD><CODE><SPAN class=3Dcpp-keyword>bool</SPAN>=20
        SetDockingWindowPlacement(DFDOCKPOSEX* pHdr)</CODE> </DD></DL>
      <H3>Replace splitter bar.</H3>
      <P>If you do not like splitter bar you can make your own. If you =
just want=20
      to change it's appearance probably the best way to derive it from=20
      <CODE>CSimpleSplitterBar</CODE>. And override=20
      <CODE>Draw()</CODE>,<CODE>DrawGhostBar()</CODE> etc. Then define =
your=20
      traits</P><PRE>  <SPAN class=3Dcpp-keyword>typedef</SPAN> =
CDockingFrameTraitsT &lt;CMySplitterBar,
                  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | =
WS_CLIPSIBLINGS,
                  WS_EX_APPWINDOW | WS_EX_WINDOWEDGE&gt;  =
CMyDockingFrameTraits;
</PRE>and apply it to base class of <CODE>CMainFrame</CODE>.=20
      <H3>Make custom caption.</H3>
      <P>Create a new caption class. You can derive it from=20
      <CODE>CCaptionBase</CODE> or from other available Caption classes. =
Then=20
      define DockingWindowTraits</P><PRE> <SPAN =
class=3Dcpp-keyword>typedef</SPAN> CDockingWindowTraits&lt;CMyCaption,
                        WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE |
                        WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                        WS_EX_TOOLWINDOW&gt; =
CMyTitleDockingWindowTraits;
</PRE>and apply it to <CODE>CTitleDockingWindowImpl</CODE>.=20
      <H2><A name=3Dclasses></A>Docking Window classes.</H2>
      <H3>Docking Windows Frame Classes.</H3>
      <DL>
        =
<DT><CODE>CDockingFrameImplBase</CODE><CODE>[DockingFrame.h]</CODE> -=20
        this class provides basic docking window features.=20
        <DT><CODE>CDockingFrameImpl [DockingFrame.h]</CODE> - base class =
for a=20
        single document interface (SDI) frame window.=20
        <DT><CODE>CMDIDockingFrameImpl [DockingFrame.h]</CODE> - base =
class for=20
        a multiple document interface (MDI) frame window.=20
        <DT><CODE>CDockingSiteImpl [DockingFrame.h]</CODE>- base class =
for a=20
        generic window with docking window features.=20
        <DT><CODE>CDockingFrameTraitsT [DockMisc.h]</CODE> - traits of =
docking=20
        frame it's derived from <CODE>CWinTraits</CODE> class and add=20
        <CODE>TSplitterBar</CODE> parameter. </DT></DL>
      <H3>Docking Windows Classes.</H3>
      <DL>
        <DT><CODE>CDockingWindowBaseImpl [DockingWindow.h]</CODE> - base =
class=20
        for docking windows. The <CODE>CDockingWindowBaseImpl</CODE> =
class=20
        derives from <CODE>CWindowImpl</CODE> and has the same =
parameters except=20
        <CODE>TWinTraits</CODE>. Instead, it is uses=20
        <CODE>CDockingWindowTraits</CODE>.=20
        <DT><CODE>CTitleDockingWindowImpl [DockingWindow.h]</CODE> - =
titled=20
        docking window.=20
        <DT><CODE>CBoxedDockingWindowImpl [DockingBox.h]</CODE> - titled =
docking=20
        window which support tabbed docking.=20
        <DT><CODE>CDockingWindowTraits [DockingWindow.h]</CODE> - traits =
of=20
        docking window it's derived from <CODE>CWinTraits</CODE> class =
and add=20
        <CODE>TCaption</CODE> parameter. If you need to customize the =
docking=20
        window caption, make new caption class and use=20
        <CODE>CDockingWindowTraits</CODE> with new class as=20
        <CODE>TCaption</CODE> parameter. </DT></DL>
      <H3>Docking Windows Captions Classes</H3>
      <DL>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -