📄 wtl docking windows.mht
字号:
<TD class=3DsmallText><A=20
href=3D"http://www.codeproject.com/store/"><B>VS.NET =
2003 from=20
$899</B></A></TD></TR>
<TR vAlign=3Dtop>
<TD><IMG height=3D16=20
=
src=3D"http://www.codeproject.com/script/images/support_icon.gif"=20
width=3D16></TD>
<TD class=3DsmallText><A=20
href=3D"http://www.codeproject.com/store/"><B>MSDN =
Univ. from=20
$1950</B></A></TD></TR>
<TR vAlign=3Dtop>
<TD></TD>
<TD></TD></TR>
<TR vAlign=3Dtop>
<TD><IMG height=3D16=20
src=3D"http://www.codeproject.com/images/print.gif" =
width=3D16></TD>
<TD class=3DsmallText><A=20
=
href=3D"http://www.codeproject.com/wtl/wtldockingwindows.asp?print=3Dtrue=
"=20
target=3D_print>Print version</A></TD></TR>
<TR vAlign=3Dtop>
<TD><IMG height=3D16=20
src=3D"http://www.codeproject.com/images/link.gif" =
width=3D16></TD>
<TD class=3DsmallText><A=20
=
href=3D"http://www.codeproject.com/script/profile/add_bookmark.asp?t=3D0&=
amp;ct=3D%2Fwtl%2Fwtldockingwindows%2Easp&guid=3D%2Fwtl%2FWTLDockingW=
indows%2Easp%2D2%2F7%2F2002">Bookmark=20
this</A></TD></TR></TR>
<TR vAlign=3Dtop>
<TD><IMG height=3D16=20
src=3D"http://www.codeproject.com/images/mail.gif" =
width=3D16></TD>
<TD class=3DSmallText><A=20
=
href=3D"http://www.codeproject.com/script/recommend/form.asp?guid=3D%2Fwt=
l%2FWTLDockingWindows%2Easp%2D2%2F7%2F2002">Send=20
to a friend</A></TD></TR>
<TR vAlign=3Dtop>
<TD></TD>
<TD></TD></TR>
<TR vAlign=3Dtop>
<TD></TD>
<TD class=3DInfoBarHeader>My Profile</TD></TR>
<TR>
<TD bgColor=3Dblack colSpan=3D2><IMG height=3D1=20
src=3D"http://www.codeproject.com/images/space.gif"=20
width=3D1></TD></TR>
<TR vAlign=3Dtop>
<TD><IMG height=3D16=20
=
src=3D"http://www.codeproject.com/images/profile_small.gif"=20
width=3D16></TD>
<TD class=3DsmallText><A=20
=
href=3D"http://www.codeproject.com/script/profile/modify.asp?ct=3D/wtl/wt=
ldockingwindows.asp">My=20
Settings</A></TD></TR>
<TR vAlign=3Dtop>
<TD><IMG height=3D16=20
=
src=3D"http://www.codeproject.com/images/submit_small.gif"=20
width=3D16></TD>
<TD class=3DsmallText><A=20
=
href=3D"http://www.codeproject.com/script/articles/list_articles.asp?user=
id=3D273403">My=20
Articles</A></TD></TR>
<TR vAlign=3Dtop>
<TD><IMG height=3D16=20
=
src=3D"http://www.codeproject.com/images/bookmarks.gif"=20
width=3D16></TD>
<TD class=3DsmallText><A=20
=
href=3D"http://www.codeproject.com/script/profile/bookmark_list.asp">My=20
Bookmarks</A></TD></TR>
<TR vAlign=3Dtop>
<TD><IMG height=3D16=20
=
src=3D"http://www.codeproject.com/images/logoff_small.gif"=20
width=3D16></TD>
<TD class=3DsmallText><A=20
=
href=3D"http://www.codeproject.com/script/profile/logoff.asp?ct=3D/wtl/wt=
ldockingwindows.asp">Sign=20
out</A></TD></TR>
<TR>
<TD bgColor=3Dblack colSpan=3D2><IMG height=3D1=20
src=3D"http://www.codeproject.com/images/space.gif"=20
width=3D1></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD> </TD></TR>
<TR>
<TD>
<CENTER><A=20
=
href=3D"http://www.codeproject.com/script/admentor/admentorredir.asp?id=3D=
458&way=3Dban"=20
target=3D_blank><IMG height=3D600 alt=3D""=20
=
src=3D"http://www.codeproject.com/script/admentor/images/ANTS600x120(ani)=
.gif"=20
width=3D120 =
border=3D0></A><BR></CENTER><BR></TD></TR></TBODY></TABLE></TD>
<TD width=3D5 rowSpan=3D2><IMG height=3D1=20
src=3D"http://www.codeproject.com/images/space.gif" width=3D5> =
</TD>
<TD align=3Dright width=3D"100%" bgColor=3Dwhite>
<TABLE width=3D"100%">
<TBODY>
<TR>
<TD class=3DsmallText vAlign=3Dtop noWrap></TD>
<TD noWrap align=3Dright><A name=3D__top></A>
<TABLE>
<TBODY>
<TR>
<TD class=3DsmallText align=3Dright>65 members have =
rated this=20
article. Result:</TD>
<TD>
<TABLE cellSpacing=3D0 cellPadding=3D0 border=3D2>
<TBODY>
<TR>
<TD><IMG height=3D5=20
=
src=3D"http://www.codeproject.com/script/images/red.gif"=20
width=3D20 border=3D0></TD>
<TD><IMG height=3D5=20
=
src=3D"http://www.codeproject.com/script/images/red.gif"=20
width=3D20 border=3D0></TD>
<TD><IMG height=3D5=20
=
src=3D"http://www.codeproject.com/script/images/red.gif"=20
width=3D20 border=3D0></TD>
<TD><IMG height=3D5=20
=
src=3D"http://www.codeproject.com/script/images/red.gif"=20
width=3D20 border=3D0></TD>
<TD><IMG height=3D5=20
=
src=3D"http://www.codeproject.com/script/images/red.gif"=20
width=3D18 border=3D0><IMG height=3D5=20
=
src=3D"http://www.codeproject.com/script/images/white.gif"=20
width=3D2 =
border=3D0></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD class=3DsmallText align=3Dright colSpan=3D2><A=20
title=3D"Calculated as rating x Log10(# votes)"=20
=
href=3D"http://www.codeproject.com/script/articles/top_articles.asp?st=3D=
2">Popularity:=20
8.91</A>. Rating: <B>4.91</B> out of=20
5.</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD vAlign=3Dtop width=3D"100%">
<DIV id=3Dcontentdiv><!-- Article Starts -->
<UL class=3Ddownload>
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/WTLDockingWindows/WTLDockingWindow=
s_src.zip">Download=20
source files - 64 Kb</A>=20
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/WTLDockingWindows/WTLDockingWindow=
s_demo.zip">Download=20
demo project - 626 Kb</A> </LI></UL>
<P><IMG height=3D356 alt=3D"Sample Image - WTLDockingWindows1.png" =
=
src=3D"http://www.codeproject.com/wtl/WTLDockingWindows/WTLDockingWindows=
1.png"=20
width=3D574></P>
<H2><A name=3Dintro></A>Introduction.</H2>
<P>This is an implementation of docking windows for the WTL =
library. The=20
following topics describe how to use docking window classes.</P>
<H3>Pre-Build Set-Up.</H3>
<UL>
<LI>Make sure all header files are placed in the appropriate =
location=20
and compiler can reach it.<BR><BR>
<LI>Add DockImpl.cpp to the project. Probably the best way to do =
it is=20
to add <CODE><SPAN=20
=
class=3Dcpp-preprocessor>#include<DockImpl.cpp></SPAN></CODE> to =
the=20
<CODE>stdafx.cpp</CODE>.<BR><BR>
<LI>Docking Windows use STL so it's requires to enable exception =
handling (<CODE>/GX</CODE> or <CODE>/EH</CODE> compiler options) =
and=20
remove <CODE>_ATL_MIN_CRT</CODE> from the list the preprocessor =
defines=20
in release configuration. If you use standard HP's STL you can =
leave=20
default project setting intact, but I don't think it is a good=20
idea.<BR><BR>
<LI>If you use <A href=3D"http://www.boost.org/">boost</A> =
library define=20
<CODE>USE_BOOST</CODE>.<BR><BR>
<LI>I use some private message in range <CODE>WM_USER</CODE> to=20
<CODE>WM_USER + <SPAN class=3Dcpp-literal>2</SPAN></CODE><BR>
<DL>
<DD><CODE>WMDF_FIRST =3D WM_USER</CODE><BR>
<DD><CODE>WMDF_LAST =3D WM_USER + <SPAN=20
class=3Dcpp-literal>2</SPAN></CODE><BR></DD></DL>So if you =
define your own=20
private messages please use <CODE>WMDF_LAST+<SPAN=20
class=3Dcpp-literal>1</SPAN></CODE> or if it is impossible =
redefine=20
<CODE>WMDF_FIRST</CODE>. </LI></UL>
<H3>Add to main frame support for docking window features.</H3>
<UL>
<LI>Create a new project with ATL/WTL AppWizard (MDI or SDI as =
you=20
like)<BR><BR>
<LI>Add <CODE><SPAN class=3Dcpp-preprocessor>#include</SPAN>=20
<DockingFrame.h></CODE> to <CODE>CMainFrame</CODE> =
header.<BR><BR>
<LI>Change the base of your <CODE>CMainFrame</CODE> class to=20
<CODE>dockwins::CDockingFrameImpl<CMainFrame></CODE> for =
SDI=20
applications or to=20
<CODE>dockwins::CMDIDockingFrameImpl<CMainFrame></CODE> =
for MDI=20
applications. All references to previous base class should be =
replaced=20
by new one.<BR><BR>
<LI>Add to the <CODE>OnCreate</CODE> method of your=20
<CODE>CMainFrame</CODE> class =
<CODE>InitializeDockingFrame()</CODE>;=20
it's the best place to change windows behavior of docking =
window. By=20
default it is depend on system setting (Show window contents =
while=20
dragging) if you for some reason need to change it you should =
use the=20
following =
flags:<BR><CODE>CDockingBarStyle::sUseSysSettings</CODE> -=20
depend on system setting,=20
default.<BR><CODE>CDockingBarStyle::sIgnoreSysSettings |=20
CDockingBarStyle::sFullDrag</CODE> - full=20
drag<BR><CODE>CDockingBarStyle::sIgnoreSysSettings |=20
CDockingBarStyle::sGhostDrag</CODE> - ghost drag.<BR>If you use=20
auto-hiding features you also can use the following=20
flags:<BR><CODE>CDockingBarStyle::sAnimation</CODE> - animate=20
auto-hiding =
windows.<BR><CODE>CDockingBarStyle::sNoAnimation</CODE> - do=20
not animate auto-hiding windows. </LI></UL>
<H3>Implement a docking window.</H3>
<UL>
<LI>Add <CODE><SPAN class=3Dcpp-preprocessor>#include</SPAN>=20
<ExtDockingWindow.h></CODE> to header file of your docking =
window.<BR><BR>
<LI>Create new class <CODE>CSampleDockingWindow</CODE> for =
example.=20
Derive it from =
<CODE>dockwins::CTitleDockingWindowImpl</CODE>.<BR><BR>
<LI>Add message map and <CODE>DECLARE_WND_CLASS</CODE> macro The =
CSampleDockingWindow class should look like this: <PRE><SPAN =
class=3Dcpp-keyword>class</SPAN> CSampleDockingWindow :
<SPAN class=3Dcpp-keyword>public</SPAN> =
dockwins::CTitleDockingWindowImpl< SampleDockingWindow,
CWindow, dockwins::COutlookLikeTitleDockingWindowTraits =
>
{
<SPAN class=3Dcpp-keyword>typedef</SPAN> CSampleDockingWindow =
thisClass;
<SPAN class=3Dcpp-keyword>typedef</SPAN> =
dockwins::CTitleDockingWindowImpl<CSAMPLEDOCKINGWINDOW,CWINDOW,
dockwins::COutlookLikeTitleDockingWindowTraits> baseClass;
<SPAN class=3Dcpp-keyword>public</SPAN>:
DECLARE_WND_CLASS(_T(<SPAN =
class=3Dcpp-string>"CSampleDockingWindow"</SPAN>))
BEGIN_MSG_MAP(thisClass)
CHAIN_MSG_MAP(baseClass)
END_MSG_MAP()
};
</PRE>
<LI>Instantiate an object of the =
<CODE>CSampleDockingWindow</CODE> class=20
as a member of the <CODE>CMainFrame</CODE><BR><BR>
<LI>In the <CODE>CMainFrame::OnCreate(...)</CODE> method, call =
the=20
<CODE>Create(...)</CODE> method of the instantiated docking =
window=20
class. <PRE>LRESULT OnCreate(UINT <SPAN =
class=3Dcpp-comment>/*uMsg*/</SPAN>, WPARAM <SPAN =
class=3Dcpp-comment>/*wParam*/</SPAN>, LPARAM <SPAN =
class=3Dcpp-comment>/*lParam*/</SPAN>,=20
BOOL& <SPAN =
class=3Dcpp-comment>/*bHandled*/</SPAN>)
{
...
InitializeDockingFrame();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -