2025-11-27 16:46:48 +09:00

106 lines
12 KiB
Plaintext

{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f38\froman\fcharset238\fprq2 Times New Roman CE;}
{\f39\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f41\froman\fcharset161\fprq2 Times New Roman Greek;}{\f42\froman\fcharset162\fprq2 Times New Roman Tur;}{\f43\froman\fcharset177\fprq2 Times New Roman (Hebrew);}
{\f44\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f45\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f46\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive \ssemihidden
Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid1966847\rsid7412567}
{\*\generator Microsoft Word 11.0.5604;}{\info{\author TvmServer}{\operator TvmServer}{\creatim\yr2005\mo1\dy17\hr18}{\revtim\yr2005\mo1\dy17\hr18}{\version3}{\edmins0}{\nofpages4}{\nofwords1122}{\nofchars6397}{\*\company Dundas India}{\nofcharsws7504}
{\vern24689}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale116\viewzk2\nolnhtadjtbl\rsidroot7412567
\fet0\sectd \linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4
\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}
{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\fs48\cf2\insrsid1966847 COXTabViewContainer}{\b\fs48\insrsid1966847
\par }{\b\fs16\insrsid1966847 Copyright \'a9 }{\b\fs16\insrsid7412567 The Code Project}{\b\fs16\insrsid1966847 1997}{\b\fs16\insrsid7412567 -}{\b\fs16\insrsid1966847 }{\b\fs16\insrsid1966847 2005}{\b\fs16\insrsid1966847 , All Rights Reserved
\par }{\insrsid1966847
\par For most applications it's not enough to use only one window to provide all output. There are different solutions for this problem like splitters or docking windows. But t
hey usually have common inconvenience: all windows are shown at the same time. They take a precious screen space while they may be rarely used.
\par
\par COXShortcutBar control can be used in order to show a number of child windows while keeping only one active (f
ully displayed) at a time. But COXShortcutBar was primarily designed to show icons and have a set of notifications that make sense only while using such controls as treeview or listview.
\par
\par Very good example of how the problem could be resolved can be found
in Developer Studio IDE. For instance "Output" window (with "Build", "Debug", "Find in Files..." panes) or "Result List" window (with "Search", "Lookup", "See Also" and "History" panes). We call them TabViews.
\par
\par TabViews can be a good alternative for splitter window when you need to have more than one view per document. Also TabViews can be used within docking window and used as a container for associated windows that are usually implemented as dialog bars.
\par
\par So we designed new class that implements TabViews: COXTabViewContainer.
\par
\par COXTabViewContainer is easy to use. If you previously worked with splitter windows, the implementation of TabViews will be familiar to you.
\par Here is the list of steps that should be taken in order to deploy TabViews in your application:
\par
\par First Case: COXTabViewContainer will be used as a container for document view(s).
\par }\pard \ql \fi-360\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 {\insrsid1966847 1.\tab Embed a COXTabViewContainer member variable in the parent frame (main frame window for SDI application, MDIChild window for MDI application).
\par 2.\tab Override the parent frame's CFrameWnd::OnCreateClient member function.
\par 3.\tab From within the overridden OnCreateClient, call the Create member function of COXTabViewContainer. In this function you have to specify the parent window and optionally you can specify the initial rectangle, window styles and window ID.
\par 4.\tab After COXTabViewContainer window was successfully created you can populate it with window objects using AddPage or InsertPage
function. If you are inserting view object you have to specify runtime class and context information in order not to break documentview architecture. If you are adding window object that is not a document view then you have to create it before adding to
COXTabViewContainer window. In AddPage or InsertPage functions you can specify text that will be used as page title in tab button.
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid1966847
\par
\par Second Case: COXTabViewContainer will be used as a container for windows within control bar.
\par }\pard \ql \fi-360\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 {\insrsid1966847 1.\tab Create your own CControlBar-derived class (you can use our COXSizeControlBar as parent class if you need sizable docking windows). Let's call CMyControlBar.
\par 2.\tab Embed a COXTabViewContainer member variable in this class.
\par 3.\tab Override CMyControlBar::OnCreate member function.
\par 4.\tab From within the overridden OnCreate, call the Create member function of COXTabViewContainer. In this function you have to specify the parent window and optionally you can specify the initial rectangle, window styles and window ID.
\par 5.\tab After COXTabViewContainer win
dow was successfully created you can populate it with window objects using AddPage or InsertPage function. You have to create window object before adding it to COXTabViewContainer. In AddPage or InsertPage functions you can specify text that will be used
as page title in tab button.
\par 6.\tab Override CMyControlBar::OnSize member function and resize in it COXTabViewContainer object as appropriate
\par
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\b\insrsid1966847
\par }{\insrsid1966847 \tab \tab \tab
\par The most challenging problem was to support scrolling functionality for windows that would be used as COXTabViewC
ontainer pages. Unfortunately, different windows object that support scrolling (CEdit, CTreeCtrl, CListBox, CListCtrl, CRichEditCtrl, CEditView, CTreeView, CListView, CScrollView to name just the standrad ones) implement it in a different way and the hand
l
ing of scrolling happens internally in these objects. So in order to control it we should have provided derivations for all of above mentioned classes. Luckily we managed to resolve this problem in different way so it doesn't require any efforts from prog
rammer's side.
\par
\par Actually, the only thing you have to do is to declare the class of window object that is going to be used as COXTabViewContainer page in a specific way.
\par If you declare you class as follows:
\par }{\b\insrsid1966847 \tab class CMyView : public CEditView}{\insrsid1966847
\par now you have to do that in the following way:
\par }{\b\insrsid1966847 \tab class CMyView : public COXTabViewPage<CEditView>}{\insrsid1966847
\par
\par or if you don't derive your own class and just use an object of existing one, e.g.:
\par }{\b\insrsid1966847 \tab CEdit m_edit; }{\insrsid1966847
\par instead you have to define it as:
\par }{\b\insrsid1966847 \tab COXTabViewPage<CEdit> m_edit;
\par }{\insrsid1966847
\par COXTabViewPage is internal template based Ultimate Toolbox class that was designed specifically to provide smooth integration of scrolling functionality for any
\par window within COXTabViewContainer object. All the details of implementation is hidden for different type of windows is hidden. There is no any public functions that you should specifically use.
\par
\par But there is one limitation. The base class that is used for derivation has to have default constructor. Some classes doesn't have it (e.g. CFormV
iew). You can resolve this problem through using intermediate class that will be derived from the one that doesn't have default constructor and implement it. Then you just derive your window object class that will be used as COXTabViewContainer page from
this intermediate class. Out of standard only CFormView doesn't have default constructor.
\par
\par Below you will find the steps that should be taken in order to derive classes from CFormView class.
\par }\pard \ql \fi-360\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 {\insrsid1966847 1.\tab Use Class Wizard to build CFormView derived class on the base of dialog template as you usually do (let's call it CMyFormView)
\par 2.\tab CMyFormView will have default constructor which uses CFormView constructor with dialog ID specified.
\par 3.\tab define another class that will be used as view in your application:
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid1966847
\par The steps that
should be taken in order to implement COXTabViewContainer in CControlBar derived window can be applied to the general case as well. We just decided to show it using CControlBar derived window because we feel it is going to be used as parent window for COX
TabViewContainer in most cases.
\par Above we described the process of creating and populating of COXTabViewContainer object. In most cases that would be all the code you need. For those who need to change dynamically the contents of COXTabViewContainer object
we provide a set of the following functions.
\par
\par In order to remove any page at run time you have to use }{\ul\cf2\insrsid1966847 DeletePage}{\insrsid1966847 function.
\par
\par To access scroll bar objects that we use internally in order to provide scrolling functionality for COXTabViewContainer pages you have to call }{\ul\cf2\insrsid1966847 GetHorzScrollBar}{\insrsid1966847 and }{\ul\cf2\insrsid1966847 GetVertScrollBar}{
\insrsid1966847 functions.
\par
\par To set/retrieve the page title that is displayed in corresponding tab button use }{\ul\cf2\insrsid1966847 GetPageTitle}{\insrsid1966847 and }{\ul\cf2\insrsid1966847 SetPageTitle}{\insrsid1966847 functions.
\par
\par To set/retrive active page index call }{\ul\cf2\insrsid1966847 GetActivePageIndex}{\insrsid1966847 and }{\ul\cf2\insrsid1966847 SetActivepageIndex}{\insrsid1966847 functions.
\par
\par Refer to the }{\ul\cf2\insrsid1966847 class reference}{\insrsid1966847 for list and description of all public functions.
\par
\par
\par Also take look at the following }{\ul\cf2\insrsid1966847 samples}{\insrsid1966847 that can be found in .\\samples\\gui subdirectory of your ultimate Toolbox directory:
\par \tab TabViews\tab \tab - text editor with three panes: text editor, hex viewer, list view with statistics on number of unique symbols found in text.
\par \tab Dynamic TabViews \tab - MDI application that shows how to addremove pages dynamically
\par \~
\par }{\fs20\insrsid1966847
\par }}