dockbar.h

Go to the documentation of this file.
00001 // $Id: dockbar.h 1361 2006-06-25 16:43:38Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 #ifndef INC_DOCKBAR
00100 #define INC_DOCKBAR
00101 
00102 #include "list.h"
00103 
00104 
00105 class OILChildBar;
00106 
00108 // DockBar General types
00110 
00111 
00112 // DONT CHANGE THE ORDER OF THIS ENUM !!
00113 typedef enum
00114 {
00115     DOCKBAR_LEFT,
00116     DOCKBAR_RIGHT,
00117     DOCKBAR_TOP,
00118     DOCKBAR_BOTTOM,
00119     DOCKBAR_FLOAT,
00120     NUM_DOCKBARS,
00121     DOCKBAR_INVALID = 4000  
00122 } DockBarType;
00123 
00124 
00125 typedef enum
00126 {
00127     LARGE_CONTROLS=37,
00128     SMALL_CONTROLS=29
00129 } ControlSizes;
00130 
00131 #define MAX_SLOTS 8
00132 
00133 
00134 /********************************************************************************************
00135 
00136 >   class KernelBarPos : public CCObject
00137 
00138     Author:     Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
00139     Created:    29/3/94
00140     Purpose:    To assist in transfer of BarPosition Data between OIL and Kernel Layers   
00141     SeeAlso:    
00142 
00143 
00144 ********************************************************************************************/
00145 
00146 class KernelBarPos : public CCObject
00147 {
00148     public:
00149         KernelBarPos(){Slot=0;Position=0;Dock=DOCKBAR_TOP;};
00150         KernelBarPos( const KernelBarPos &other)
00151         {
00152             Slot=other.Slot;
00153             Position=other.Position;
00154             Dock=other.Dock;
00155         } 
00156         void operator = ( const KernelBarPos &other)
00157         {
00158             Slot=other.Slot;
00159             Position=other.Position;
00160             Dock=other.Dock;
00161         } 
00162     union {
00163         INT32   Slot;       // The slot in which the bar is placed (0..n)
00164         INT32   x;          // X position of floating bar
00165     };
00166     union {
00167         INT32   Position;   // The pixel position in the slot 
00168         INT32   y;          // Y position of floating bar
00169     };
00170     DockBarType Dock;   // Type of dock in which this dialogbar lives
00171 };
00172 
00173 
00174 /********************************************************************************************
00175 
00176 >   class OILDockingBar : public CControlBar
00177 
00178     Author:     Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
00179     Created:    4/3/94
00180     Purpose:    This is the base class for FixedDockBars and FloatingBars, 
00181     SeeAlso:    MFC TechNotes 24 -      
00182 
00183 
00184 ********************************************************************************************/
00185 
00186 PORTNOTE("other","Removed OILDockingBar - CControlBar usage switched for wxToolBar")
00187 class OILDockingBar : public wxToolBar // CControlBar
00188 {
00189 // Construction
00190 public:
00191     OILDockingBar();
00192     
00193 // Attributes
00194 protected:
00195     DockBarType         DockType;       // type of bar - LEFT RIGHT TOP BOTTOM FLOATING
00196     List                ChildBars;      // The list of all child ControlBars
00197     ControlSizes        ControlSize;    // Small or Large Controls
00198     wxWindow           *Parent;         // Parent Window i.e. main frame
00199     BOOL                HasBigControls; // Big Controls Flag
00200 
00201 public: 
00202 private:
00203     
00204 // Implementation
00205 public:
00206     virtual ~OILDockingBar();
00207     virtual BOOL    PlaceBar(wxWindow* hdialogbar ,wxPoint here, wxSize size = wxSize(0,0))=0;
00208     virtual BOOL    PlaceBar(wxWindow* hdialogbar ,KernelBarPos BarPos, wxSize size = wxSize(0,0))=0;
00209     virtual BOOL    ReleaseBar(wxWindow* hdialog,BOOL DoTidy)=0;
00210     KernelBarPos *  GetBarPos(wxWindow* hWnd);
00211     KernelBarPos *  GetBarPos(StringBase * Name);
00212     wxRect          GetBarRect(StringBase * Name);
00213     wxRect          GetBarRect(wxWindow* hWnd);
00214     BOOL            SetNewHWnd(wxWindow* OldHWnd,wxWindow* NewwHWnd);
00215     virtual void    SetBigControlState(BOOL Big);
00216     wxWindow*   IsScreenPointInBar(wxPoint pnt); 
00217     BOOL    IsBigControls();
00218     virtual BOOL  DeleteBars() =0;
00219     virtual wxSize GetBarSize () = 0;
00220 #ifdef _DEBUG
00221     virtual void AssertValid() const;
00222 PORTNOTE("other", "Removed OILDockingBar::Dump" )
00223 #ifndef EXCLUDE_FROM_XARALX
00224     virtual void Dump(CDumpContext& dc) const;
00225 #endif
00226     void Dump_List();
00227 #endif
00228 
00229 protected:
00230     DECLARE_DYNAMIC_CLASS( OILDockingBar )
00231     DECLARE_EVENT_TABLE()
00232 
00233 PORTNOTE("other", "Removed OILDockingBar::OnUpdateCmdUI" )
00234 #ifndef EXCLUDE_FROM_XARALX
00235     void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler) ;
00236 #endif
00237 
00238     //{{AFX_MSG(OILDockingBar)
00239     //}}AFX_MSG
00240     // DECLARE_MESSAGE_MAP()
00241     BOOL    RemoveBar(OILChildBar * ThisBar);
00242     // BOOL InsertBarInList(OILChildBar * ThisBar);
00243     OILChildBar * IsBarInList(wxWindow* hWnd);
00244     OILChildBar * IsBarInList(StringBase * Name); 
00245     static OILDockingBar * ChangedDock;
00246     static BOOL DoRecalc;    
00247 private:
00248 
00249 };
00250 
00251 /********************************************************************************************
00252 
00253 >   class OILFixedDockingBar : public OILDockingBar
00254     Author:     Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
00255     Created:    29/3/94
00256     Purpose:    This class handles the OIL-specific parts of FixedDockingbars.
00257                 They handle the low-level creation/deletion details, 
00258     SeeAlso:    MFC TechNotes 24 -      
00259 
00260 
00261 
00262 ********************************************************************************************/
00263 
00264 PORTNOTE("other","Removed OILFixedDockingBar - OILDockingBar usage")
00265 class OILFixedDockingBar : public OILDockingBar
00266 {
00267 // Construction
00268 public:
00269     OILFixedDockingBar();
00270     BOOL Create( wxWindow* pParentWnd,
00271                 DockBarType ReqType,UINT32 id =0);
00272 
00273 // Attributes
00274 public: 
00275 private:
00276     INT32   NoOfSlots;              // no of Slots in this bar
00277     INT32       SlotSize[MAX_SLOTS];    // Sizes of slots
00278     UINT32  MaxPos;                 // Maximum extent of the dock - ie MaxY if Left or Right else MaxX
00279     wxSize  DockSize;               // record of bar dimensions
00280     wxPoint Position;
00281 
00282     static BOOL allowTidyBars;
00283 
00284 // Implementation
00285 public:
00286 
00287     BOOL    PlaceBar(wxWindow* hdialogbar ,wxPoint here, wxSize size = wxSize(0,0));
00288     BOOL    PlaceBar(wxWindow* hdialogbar ,KernelBarPos BarPos, wxSize size = wxSize(0,0));
00289     BOOL    PlaceBarAt(wxWindow* hdialogbar ,KernelBarPos BarPos);
00290     BOOL    ReleaseBar(wxWindow* hdialog,BOOL DoTidy);
00291     void    AppendToSlot(INT32 SlotNo,wxPoint * here);
00292     BOOL    IsScreenPointInDock(wxPoint here);
00293     BOOL    IsScreenRectInDock(wxRect BarRect);
00294     void    GetDockScreenRect(wxRect * BarRect);
00295     void    SetBigControlState(BOOL Big);
00296     void    BarPosToClient(KernelBarPos Pos,wxPoint * Point);
00297     void    BarPosToScreen(KernelBarPos Pos,wxPoint * Point);
00298     INT32   PointToSlot(wxPoint* ThisPoint);
00299     INT32   PointToPosition(wxPoint* ThisPoint);
00300     void    TidySlots();
00301     void    CheckAndCorrectOverlap();
00302     wxSize  GetBarSize () { return (DockSize); }
00303     BOOL    SetSlotSize(INT32 SlotNo, INT32 NewSize);
00304 
00305     BOOL  DeleteBars();
00306 PORTNOTE("other", "Removed OILDockingBar::RepositionWindow" )
00307 #ifndef EXCLUDE_FROM_XARALX
00308     void    RepositionWindow(AFX_SIZEPARENTPARAMS FAR* lpLayout, 
00309                 wxWindow* wxWindow*, LPCRECT lpRect);
00310 #endif
00311 
00312     static void DoNotTidyBars () { allowTidyBars = FALSE; }
00313     static void AllowTidyBars () { allowTidyBars = TRUE; }
00314 
00315 #ifdef _DEBUG
00316     virtual void AssertValid() const;
00317 PORTNOTE("other", "Removed OILDockingBar::Dump" )
00318 #ifndef EXCLUDE_FROM_XARALX
00319     virtual void Dump(CDumpContext& dc) const;
00320     void Dump_List();
00321 #endif
00322 #endif
00323 protected:
00324     // to erase the background
00325     wxBrush BackBrush;
00326 
00327     virtual void DoPaint(wxDC* pDC);
00328 
00329     DECLARE_DYNAMIC_CLASS( OILFixedDockingBar )
00330     DECLARE_EVENT_TABLE()
00331 
00332     //{{AFX_MSG(OILFixedDockingBar)
00333 //    afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
00334     //afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
00335     //}}AFX_MSG
00336 
00337 private:
00338     INT32       TotalSlotSizes(INT32 Slot = -1);
00339     void    SetSize(wxRect LayoutRect,wxRect * rect);
00340     INT32   GetIntersectPercent(OILChildBar * ThisBar);
00341     void    PutInSlot(wxPoint * position, INT32 Size);
00342     BOOL    ShiftBarPos(wxPoint * position,INT32 amount);
00343     BOOL    ShiftBarSlot(wxPoint * position, INT32 NoSlots);
00344     BOOL    CanShuffleForward(OILChildBar * Start,OILChildBar * End,INT32 amount);
00345     BOOL    DoShuffleForward(OILChildBar * Start,OILChildBar * End,INT32 amount);
00346     BOOL    CanShuffleBackward(OILChildBar * Start,OILChildBar * End,INT32 amount);
00347     BOOL    DoShuffleBackward(OILChildBar * Start,OILChildBar * End,INT32 amount);
00348     void    InsertSlot(INT32 SlotNo, INT32 NewSize = -1);
00349     void    RemoveSlot(INT32 SlotNo);
00350     INT32       CountSlots();
00351     void    PositionBar(OILChildBar * ThisBar);
00352     BOOL    PlaceBarInSlot(OILChildBar * ThisBar,INT32 Slot);
00353     BOOL    PlaceGalleryInSlot(OILChildBar * ThisBar,INT32 Slot);
00354     BOOL    InsertBarInList(OILChildBar * ThisBar); 
00355     OILChildBar * IsPointInBar(wxPoint ThisPoint);
00356     OILChildBar * GetSlotHead(INT32 SlotNo);
00357     OILChildBar * GetOverLap(OILChildBar * ThisBar,INT32 SlotNo,
00358                             INT32 * ForwardOverlap,INT32 * BackwardOverlap);
00359     BOOL GetGalleryOverLap(OILChildBar* ThisBar,INT32 SlotNo,
00360                             INT32 * ForwardOverlap,INT32 * BackwardOverlap,
00361                             OILChildBar** ppPrevious, OILChildBar** ppNext);
00362 };
00363 
00364 /********************************************************************************************
00365 
00366 >   class OILFloaters : public OILDockingBar
00367 
00368     Author:     Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
00369     Created:    30/3/94
00370     Purpose:    This class handles the OIL-specific parts of Floaters.
00371                 They handle the low-level creation/deletion details, 
00372     SeeAlso:    MFC TechNotes 24 -      
00373 
00374 
00375 
00376 ********************************************************************************************/
00377 
00378 PORTNOTE("other","Removed OILFloaters - OILDockingBar usage")
00379 #ifndef EXCLUDE_FROM_XARALX
00380 class OILFloaters : public OILDockingBar
00381 {
00382  DECLARE_DYNAMIC(OILFloaters)
00383 
00384 // Construction
00385 public:
00386     OILFloaters();
00387     BOOL Create(CWnd* pParentWnd);
00388     
00389 // Attributes
00390 public: 
00391 private:
00392     SIZE    DockSize;   // record of bar dimensions (NOT actually used)
00393                         // BUT included so I can get this bastard thing to compile!
00394 
00395 // Implementation
00396 public:
00397     BOOL    PlaceBar(wxWindow* hdialogbar ,wxPoint here, wxSize size = wxSize(0,0));
00398     BOOL    PlaceBar(wxWindow* hdialogbar ,KernelBarPos BarPos, wxSize size = wxSize(0,0));
00399     BOOL    ReleaseBar(wxWindow* hdialog,BOOL DoTidy);
00400     void    SetBigControlState(BOOL Big);
00401     virtual BOOL  DeleteBars();
00402     BOOL    RecreateBarsAfterSettingChange();   // UIC 
00403     SIZE    GetBarSize () { return (DockSize); }
00404 #ifdef _DEBUG
00405         virtual void AssertValid() const;
00406         virtual void Dump(CDumpContext& dc) const;
00407         void Dump_List();
00408     #endif
00409 
00410 protected:
00411 
00412     //afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
00413     //}}AFX_MSG
00414 
00415     DECLARE_MESSAGE_MAP()
00416 
00417 private:
00418     BOOL    InsertBarInList(OILChildBar * ThisBar); 
00419 };
00420 #endif
00421 
00422 #endif

Generated on Sat Nov 10 03:48:24 2007 for Camelot by  doxygen 1.4.4