00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 #if !defined(INC_MGUI_LAYOUT_H) && (defined(X_NATIVE) || defined(WIN32_MFC))
00099 #define INC_MGUI_LAYOUT_H
00100
00101 #if !defined(INC_MI32_STDAFX_H) && defined(WIN32_MFC)
00102 #include <mi32/stdafx.h>
00103 #endif
00104
00105 #ifndef INC_MI32_STDDEFNS_H
00106 #include <mi32/stddefns.h>
00107 #endif
00108
00109 #ifndef INC_MI32_MILIST_H
00110 #include <mi32/milist.h>
00111 #endif
00112
00113 #if !defined(INC_MI32_XDEFNS_H) && defined(X_NATIVE)
00114 #include <mi32/xdefns.h>
00115 #endif
00116
00117 #if !defined(INC_MI32_XMIPANE_H) && defined(X_NATIVE)
00118 #include <mi32/xmipane.h>
00119 #endif
00120
00121 #ifndef INC_MI32_I18N_H
00122 #include <mi32/i18n.h>
00123 #endif
00124
00125 #if !defined(INC_MI32_WINRESID_H) && defined(WIN32_MFC)
00126 #include <mi32/winresid.h>
00127 #endif
00128
00129 #ifndef INC_MI32_SIMPLEAR_H
00130 #include <mi32/simplear.h>
00131 #endif
00132
00133
00134 #ifndef GENERATING_DOXYGEN_OUTPUT
00135
00136 class SML_GUI_INTERFACE_BASE;
00137
00138 #ifdef WIN32_MFC
00139
00140 #include <afxtempl.h>
00141 namespace ETSLayout {
00142
00143
00144 #define _AUTO_SET_ICON
00145
00146
00147 class ETSLayoutPropertySheet;
00148
00149
00150 const int nDefaultBorder = 5;
00151
00152
00153 const int MINCONSTRAIN = 5;
00154
00155 class ETSLayoutMgr {
00156 public:
00157
00158 enum layResizeMode {
00159 GREEDY = 0,
00160 ABSOLUTE_HORZ = 1 << 0,
00161 RELATIVE_HORZ = 1 << 1,
00162 ABSOLUTE_VERT = 1 << 2,
00163 RELATIVE_VERT = 1 << 3,
00164
00165 NORESIZE = ABSOLUTE_HORZ | ABSOLUTE_VERT,
00166
00167 SIZE_MASK = NORESIZE,
00168
00169 ALIGN_LEFT = 1 << 4,
00170 ALIGN_RIGHT = 1 << 5,
00171 ALIGN_TOP = 1 << 6,
00172 ALIGN_BOTTOM = 1 << 7,
00173
00174 ALIGN_HCENTER = ALIGN_LEFT | ALIGN_RIGHT,
00175 ALIGN_VCENTER = ALIGN_TOP | ALIGN_BOTTOM,
00176
00177 ALIGN_CENTER = ALIGN_HCENTER | ALIGN_VCENTER,
00178 ALIGN_MASK = ALIGN_CENTER,
00179
00180 FILL_HORZ = 1 << 8,
00181 FILL_VERT = 1 << 9,
00182 FILL_BOTH = FILL_HORZ | FILL_VERT,
00183
00184 IGNORE_NONVISIBLE = 1 << 14
00185 };
00186
00187 enum layOrientation {
00188 HORIZONTAL,
00189 VERTICAL
00190 };
00191
00192
00193 class PaneBase {
00194 friend class ETSLayoutMgr;
00195 friend class CPaneBase;
00196 friend class CPane;
00197
00198 public:
00199
00200
00201 PaneBase (
00202 ETSLayoutMgr *pMgr
00203 ) { m_pMgr = pMgr; }
00204
00205
00206 virtual ~PaneBase(
00207 ) { }
00208
00209
00210 void addAlignmentModes (
00211 DWORD modeResize
00212 ) { if ((m_modeResize & ALIGN_MASK) == 0) m_modeResize |= (modeResize & ALIGN_MASK); }
00213
00214
00215 virtual int getConstrainHorz (int sizeParent) = 0;
00216
00217
00218 virtual int getConstrainVert (int sizeParent) = 0;
00219
00220
00221
00222
00223
00224
00225
00226 virtual int getMinConstrainHorz () = 0;
00227
00228
00229
00230
00231
00232
00233 virtual int getMaxConstrainHorz () = 0;
00234
00235
00236
00237
00238
00239
00240
00241 virtual int getMinConstrainVert () = 0;
00242
00243
00244
00245
00246
00247
00248 virtual int getMaxConstrainVert () = 0;
00249
00250
00251 virtual bool hasOppositeOrientation (layOrientation orientation) const;
00252
00253
00254 virtual bool isVisible () const = 0;
00255
00256
00257 virtual bool resizeTo (CRect& rcNewArea) = 0;
00258
00259
00260 virtual void setEnabled (bool enabled) = 0;
00261
00262
00263 virtual void setVisible (bool visible) = 0;
00264
00265 virtual void updateSizeSecondary ();
00266
00267
00268
00269
00270 DWORD modeResize() { return m_modeResize; };
00271
00272 protected:
00273
00274 DWORD m_modeResize;
00275 ETSLayoutMgr *m_pMgr;
00276 };
00277
00278
00279
00280
00281
00282
00283
00284 class CPaneBase {
00285 protected:
00286 struct PaneHolder {
00287 PaneHolder (PaneBase* pPane );
00288 ~PaneHolder ();
00289
00290 void AddRef ();
00291 void Release ();
00292
00293 PaneBase *m_pPane;
00294 long m_nRefCount;
00295 };
00296
00297 PaneHolder* m_pPaneHolder;
00298
00299 public:
00300
00301 CPaneBase ();
00302 CPaneBase (PaneBase* pPane);
00303 CPaneBase (const CPaneBase& rhs);
00304
00305 ~CPaneBase ();
00306
00307 void operator= (PaneBase* pPane);
00308 void operator= (const CPaneBase& rhs);
00309 PaneBase* operator-> () const;
00310 PaneBase* GetPaneBase () { return operator->(); }
00311
00312 bool IsValid() const { return (m_pPaneHolder != 0); }
00313 operator !() const { return (m_pPaneHolder == 0); }
00314 };
00315
00316 class Pane;
00317
00318 class CPane : public CPaneBase {
00319 public:
00320
00321 CPane( );
00322 CPane( Pane* pPane );
00323 CPane( const CPane& rhs );
00324
00325 ~CPane();
00326
00327 void operator=( Pane* pPane );
00328 void operator=( const CPane& rhs );
00329 Pane* operator->() const;
00330 Pane* GetPane() { return operator->(); }
00331
00332 CPaneBase ConvertBase() const;
00333
00334 CPane& operator<< ( const CPane pPane );
00335 CPane& operator<< ( const CPaneBase pItem );
00336 };
00337
00338
00339
00340
00341
00342 class PaneItem : public PaneBase {
00343 friend class ETSLayoutMgr;
00344 friend class Pane;
00345 protected:
00346
00347
00348
00349
00350
00351
00352 PaneItem( CWnd* pWnd, ETSLayoutMgr* pMgr, layResizeMode modeResize = GREEDY, int sizeX=0, int sizeY=0, int sizeXMin=0, int sizeYMin=0);
00353
00354
00355
00356
00357
00358
00359 PaneItem( UINT nID, ETSLayoutMgr* pMgr, layResizeMode modeResize = GREEDY, int sizeX=0, int sizeY=0, int sizeXMin=0, int sizeYMin=0);
00360
00361 public:
00362 virtual int getConstrainHorz(int sizeParent);
00363 virtual int getConstrainVert(int sizeParent);
00364 virtual int getMinConstrainHorz();
00365 virtual int getMinConstrainVert();
00366 virtual int getMaxConstrainHorz();
00367 virtual int getMaxConstrainVert();
00368 virtual bool isVisible () const;
00369 virtual bool resizeTo(CRect& rcNewArea);
00370 virtual void setEnabled (bool enabled);
00371 virtual void setVisible (bool visible);
00372
00373 bool isDummy() { return (m_hwndCtrl == 0); }
00374
00375 protected:
00376 friend class ETSLayoutPropertySheet;
00377
00378
00379
00380
00381 int m_sizeX;
00382 int m_sizeXMin;
00383
00384
00385
00386
00387 int m_sizeY;
00388 int m_sizeYMin;
00389
00390
00391
00392
00393 HWND m_hwndCtrl;
00394
00395
00396
00397
00398 bool m_bComboSpecial;
00399
00400 private:
00401 #ifndef GENERATING_DOXYGEN_OUTPUT
00402 void ComputeSizeXY();
00403 #endif // GENERATING_DOXYGEN_OUTPUT
00404 };
00405
00406
00407
00408
00409
00410
00411 class Pane : public PaneBase {
00412 friend class ETSLayoutMgr;
00413 friend class CPaneBase;
00414 friend class CPane;
00415 friend class ETSLayoutPropertySheet;
00416
00417 protected:
00418
00419
00420
00421
00422 Pane (ETSLayoutMgr* pMgr, layOrientation orientation, int sizeBorder = nDefaultBorder, int sizeExtraBorder = 0, bool IgnoreNonVisible = false);
00423
00424 public:
00425
00426
00427
00428
00429
00430 bool addItem( UINT nID, layResizeMode modeResize = GREEDY, int sizeX=0, int sizeY=0, int sizeXMin=-1, int sizeYMin=-1);
00431
00432
00433
00434
00435
00436
00437
00438 bool addItem( CWnd* pWnd, layResizeMode modeResize = GREEDY, int sizeX=0, int sizeY=0, int sizeXMin=-1, int sizeYMin=-1);
00439
00440
00441
00442
00443
00444 bool addItemGrowing();
00445
00446
00447
00448
00449 bool addItemFixed(int size);
00450
00451
00452
00453
00454
00455
00456
00457
00458 bool addItemSpaceBetween( CWnd* pWndFirst, CWnd* pWndSecond );
00459 bool addItemSpaceBetween( UINT nIDFirst, UINT nIDSecond );
00460
00461
00462
00463
00464
00465 bool addItemSpaceLike( CWnd* pWnd );
00466 bool addItemSpaceLike( UINT nID );
00467
00468
00469
00470
00471
00472 bool addPane( CPaneBase pItem );
00473 bool addPane( CPane pSubpane, layResizeMode modeResize, int sizeSecondary );
00474
00475 virtual int getConstrainHorz (int sizeParent);
00476 virtual int getConstrainVert (int sizeParent);
00477 virtual int getMinConstrainHorz ();
00478 virtual int getMinConstrainVert ();
00479 virtual int getMaxConstrainHorz ();
00480 virtual int getMaxConstrainVert ();
00481 virtual bool hasOppositeOrientation (layOrientation orientation) const;
00482 virtual bool isVisible () const;
00483 virtual bool resizeTo (CRect& rcNewArea);
00484 virtual void setEnabled (bool enabled);
00485 virtual void setVisible (bool visible);
00486
00487
00488
00489
00490 virtual ~Pane();
00491
00492
00493
00494
00495 layOrientation getOrientation() { return m_Orientation; };
00496
00497 protected:
00498
00499
00500 virtual void updateSizeSecondary();
00501
00502 layOrientation m_Orientation;
00503
00504
00505
00506
00507 CArray<CPaneBase, CPaneBase> m_paneItems;
00508
00509 int m_sizeSecondary;
00510 int m_sizeBorder;
00511 int m_sizeExtraBorder;
00512
00513 private:
00514 #ifndef GENERATING_DOXYGEN_OUTPUT
00515 int countGreedyItems () const;
00516
00517 bool resizeToAbsolute (int& availSpace, CArray<int,int>& sizePrimary, CArray<int,int>& sizeMin, CArray<int,int>& sizeMax);
00518
00519 bool resizeToRelative (int& availSpace, CArray<int,int>& sizePrimary, CArray<int,int>& sizeMin, CArray<int,int>& sizeMax);
00520
00521 bool resizeToGreedy (int& availSpace, int nGreedy, CArray<int,int>& sizePrimary, CArray<int,int>& sizeMin, CArray<int,int>& sizeMax);
00522 #endif
00523
00524 };
00525
00526
00527
00528
00529
00530
00531
00532 class PaneTab : public Pane {
00533 friend class ETSLayoutMgr;
00534
00535 protected:
00536
00537
00538
00539
00540 PaneTab( CTabCtrl* pTab, ETSLayoutMgr* pMgr, layOrientation orientation, int sizeBorder = nDefaultBorder, int sizeExtraBorder = 0 );
00541
00542 public:
00543 virtual int getConstrainHorz(int sizeParent);
00544 virtual int getConstrainVert(int sizeParent);
00545 virtual int getMinConstrainHorz();
00546 virtual int getMinConstrainVert();
00547 virtual int getMaxConstrainHorz();
00548 virtual int getMaxConstrainVert();
00549 virtual bool isVisible () const;
00550 virtual bool resizeTo(CRect& rcNewArea);
00551 virtual void setEnabled (bool enabled);
00552 virtual void setVisible (bool visible);
00553
00554 private:
00555 #ifndef GENERATING_DOXYGEN_OUTPUT
00556 CTabCtrl* m_pTab;
00557 #endif
00558 };
00559
00560
00561
00562
00563
00564
00565 class PaneCtrl : public Pane {
00566 friend class ETSLayoutMgr;
00567 protected:
00568
00569
00570
00571
00572 PaneCtrl( CWnd* pCtrl, ETSLayoutMgr* pMgr, layOrientation orientation, int sizeBorder = nDefaultBorder, int sizeExtraBorder = 0, int sizeTopExtra = 0);
00573 PaneCtrl( UINT nID, ETSLayoutMgr* pMgr, layOrientation orientation, int sizeBorder = nDefaultBorder, int sizeExtraBorder = 0, int sizeTopExtra = 0 );
00574
00575 public:
00576
00577 virtual int getConstrainHorz(int sizeParent);
00578 virtual int getConstrainVert(int sizeParent);
00579 virtual int getMinConstrainHorz();
00580 virtual int getMinConstrainVert();
00581 virtual int getMaxConstrainHorz();
00582 virtual int getMaxConstrainVert();
00583 virtual bool isVisible () const;
00584 virtual bool resizeTo(CRect& rcNewArea);
00585 virtual void setEnabled (bool enabled);
00586 virtual void setVisible (bool visible);
00587
00588 private:
00589 #ifndef GENERATING_DOXYGEN_OUTPUT
00590 HWND m_hwndCtrl;
00591 int m_sizeTopExtra;
00592 #endif
00593 };
00594
00595
00596 ETSLayoutMgr (CWnd* pWnd) : m_pWnd(pWnd), m_RootBorders(5,5,5,5) { }
00597
00598 virtual ~ETSLayoutMgr();
00599
00600 virtual CRect GetRect() { CRect r; m_pWnd->GetClientRect(r); return r; };
00601 CWnd* m_pWnd;
00602 CWnd* GetWnd() { return m_pWnd; };
00603
00604 void setRootBorders (int left, int top, int right, int bottom) { m_RootBorders.SetRect(left,top,right,bottom); }
00605
00606
00607
00608
00609 static CWnd* paneNull;
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625 bool Load(LPCTSTR lpstrRegKey);
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641 bool Save(LPCTSTR lpstrRegKey);
00642
00643
00644
00645
00646
00647 virtual void UpdateLayout();
00648
00649 virtual void UpdateLayout(CPane p) {
00650 if(m_RootPane.IsValid()) {
00651
00652 m_RootPane = 0;
00653 }
00654 m_RootPane = p;
00655 UpdateLayout();
00656 }
00657
00658
00659
00660
00661
00662 virtual void Layout(CRect& rcClient);
00663
00664
00665
00666
00667
00668
00669 void EraseBkgnd(CDC* pDC);
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684 CPane pane( layOrientation orientation, layResizeMode modeResize = GREEDY, int sizeBorder = nDefaultBorder, int sizeExtraBorder = 0, int sizeSecondary = 0);
00685
00686
00687
00688
00689
00690 CPane paneTab( CTabCtrl* pTab, layOrientation orientation, layResizeMode modeResize = GREEDY, int sizeBorder = nDefaultBorder, int sizeExtraBorder = 0, int sizeSecondary = 0);
00691 CPane paneCtrl( UINT nID, layOrientation orientation, layResizeMode modeResize = GREEDY, int sizeBorder = nDefaultBorder, int sizeExtraBorder = 0, int sizeTopExtra = 0, int sizeSecondary = 0);
00692 CPane paneCtrl( CWnd* pCtrl, layOrientation orientation, layResizeMode modeResize = GREEDY, int sizeBorder = nDefaultBorder, int sizeExtraBorder = 0, int sizeTopExtra = 0, int sizeSecondary = 0);
00693
00694
00695
00696
00697
00698
00699
00700
00701 CPaneBase item(UINT nID, layResizeMode modeResize = GREEDY, int sizeX =0, int sizeY =0, int sizeXMin =-1, int sizeYMin =-1);
00702 CPaneBase item(CWnd* pWnd, layResizeMode modeResize = GREEDY, int sizeX =0, int sizeY =0, int sizeXMin =-1, int sizeYMin =-1);
00703
00704
00705
00706
00707
00708 CPaneBase itemGrowing(layOrientation orientation);
00709
00710
00711
00712
00713 CPaneBase itemFixed(layOrientation orientation, int sizePrimary);
00714
00715
00716
00717
00718
00719
00720
00721
00722 CPaneBase itemSpaceBetween( layOrientation orientation, CWnd* pWndFirst, CWnd* pWndSecond );
00723 CPaneBase itemSpaceBetween( layOrientation orientation, UINT nIDFirst, UINT nIDSecond );
00724
00725
00726
00727
00728
00729 CPaneBase itemSpaceLike( layOrientation orientation, CWnd* pWnd );
00730 CPaneBase itemSpaceLike( layOrientation orientation, UINT nID );
00731
00732 protected:
00733
00734 CPane m_RootPane;
00735 CString m_strRegStore;
00736 CRect m_RootBorders;
00737
00738
00739 CPane CreateRoot (
00740 layOrientation orientation,
00741 int sizeBorder = nDefaultBorder,
00742 int sizeExtraBorder = 0,
00743 bool IgnoreNonVisible = false
00744 ) {
00745 if (m_RootPane.IsValid()) {
00746
00747 m_RootPane = 0;
00748 }
00749 m_RootPane = new Pane(this, orientation, sizeBorder, sizeExtraBorder, IgnoreNonVisible);
00750 return m_RootPane;
00751 }
00752
00753 };
00754
00755
00756 inline ETSLayoutMgr::layResizeMode operator| (
00757 const ETSLayoutMgr::layResizeMode lhs,
00758 const ETSLayoutMgr::layResizeMode rhs
00759 ) {
00760 return (static_cast<ETSLayoutMgr::layResizeMode>((DWORD)lhs | (DWORD)rhs));
00761 }
00762
00763 inline ETSLayoutMgr::layResizeMode& operator|= (
00764 ETSLayoutMgr::layResizeMode& lhs,
00765 const ETSLayoutMgr::layResizeMode rhs
00766 ) {
00767 lhs = static_cast<ETSLayoutMgr::layResizeMode>((DWORD)lhs | (DWORD)rhs);
00768 return (lhs);
00769 }
00770
00771 inline ETSLayoutMgr::layResizeMode operator& (
00772 const ETSLayoutMgr::layResizeMode lhs,
00773 const ETSLayoutMgr::layResizeMode rhs
00774 ) {
00775 return (static_cast<ETSLayoutMgr::layResizeMode>((DWORD)lhs & (DWORD)rhs));
00776 }
00777
00778 inline ETSLayoutMgr::layResizeMode& operator&= (
00779 ETSLayoutMgr::layResizeMode& lhs,
00780 const ETSLayoutMgr::layResizeMode rhs
00781 ) {
00782 lhs = static_cast<ETSLayoutMgr::layResizeMode>((DWORD)lhs & (DWORD)rhs);
00783 return (lhs);
00784 }
00785
00786
00787
00788
00789
00790
00791
00792 class ETSLayoutDialog : public CDialog, protected ETSLayoutMgr {
00793 public:
00794
00795
00796 ETSLayoutDialog(UINT nID, CWnd* pParent = NULL, LPCTSTR strName = NULL, bool bGripper = true);
00797
00798 protected:
00799
00800
00801 afx_msg void OnSize(UINT nType, int cx, int cy);
00802 afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
00803 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00804 virtual BOOL OnInitDialog();
00805 afx_msg void OnDestroy();
00806
00807 DECLARE_MESSAGE_MAP()
00808
00809 virtual CRect GetRect();
00810
00811 bool m_bGripper;
00812 CStatusBar m_StatusBar;
00813 };
00814
00815
00816
00817
00818
00819
00820
00821 class ETSLayoutFormView : public CFormView, public ETSLayoutMgr {
00822 DECLARE_DYNAMIC(ETSLayoutFormView)
00823
00824 public:
00825
00826
00827 ETSLayoutFormView(UINT nID, LPCTSTR strName = NULL);
00828
00829
00830 virtual ~ETSLayoutFormView();
00831
00832 protected:
00833
00834
00835
00836 afx_msg void OnSize(UINT nType, int cx, int cy);
00837 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00838 afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
00839
00840 DECLARE_MESSAGE_MAP()
00841 };
00842
00843
00844
00845
00846
00847
00848
00849
00850 class ETSLayoutDialogBar : public CDialogBar, protected ETSLayoutMgr {
00851 public:
00852
00853
00854 ETSLayoutDialogBar();
00855
00856
00857
00858 virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
00859
00860
00861
00862
00863
00864 virtual BOOL Initialize() { return false; };
00865
00866 virtual void UpdateLayout();
00867
00868 protected:
00869
00870
00871 afx_msg void OnSize(UINT nType, int cx, int cy);
00872 afx_msg void OnDestroy();
00873 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00874
00875 LRESULT OnInitDialog(WPARAM, LPARAM);
00876 DECLARE_MESSAGE_MAP()
00877
00878 virtual CRect GetRect();
00879 bool m_bInitialized;
00880 };
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893 class ETSLayoutPropertySheet : public CPropertySheet, protected ETSLayoutMgr {
00894 DECLARE_DYNAMIC(ETSLayoutPropertySheet)
00895
00896 public:
00897
00898
00899 ETSLayoutPropertySheet();
00900
00901 ETSLayoutPropertySheet(UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0, LPCTSTR strName=NULL, bool bGripper=true);
00902
00903 ETSLayoutPropertySheet(LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0, LPCTSTR strName=NULL, bool bGripper=true);
00904
00905 void SetAutoDestroy() { m_bAutoDestroy = true; }
00906 void SetAutoDestroyPages() { m_bAutoDestroyPages = true; }
00907 void ModelessWithButtons() { m_bModelessButtons = true; }
00908
00909 virtual void AddMainArea(CPane paneRoot, CPaneBase itemTab);
00910 virtual void AddButtons(CPane paneBottom);
00911
00912
00913
00914 public:
00915 virtual BOOL OnInitDialog();
00916 virtual void PostNcDestroy();
00917
00918
00919
00920 public:
00921 virtual ~ETSLayoutPropertySheet();
00922
00923
00924 protected:
00925
00926 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00927 afx_msg void OnSize(UINT nType, int cx, int cy);
00928 afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
00929 afx_msg void OnDestroy();
00930 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00931
00932 DECLARE_MESSAGE_MAP()
00933
00934 void Resize(int cx, int cy);
00935
00936
00937 void Init(LPCTSTR strName, bool bGripper);
00938 CRect m_rcStart;
00939 CRect m_rcPage;
00940 bool m_bGripper;
00941 CStatusBar m_StatusBar;
00942 CPaneBase m_ItemTab;
00943 bool m_bAutoDestroy;
00944 bool m_bAutoDestroyPages;
00945 bool m_bModelessButtons;
00946
00947 friend class ETSLayoutPropertyPage;
00948 };
00949
00950
00951
00952
00953
00954
00955
00956
00957 class ETSLayoutPropertyPage : public CPropertyPage, protected ETSLayoutMgr {
00958 friend class ETSLayoutPropertySheet;
00959
00960 DECLARE_DYNCREATE(ETSLayoutPropertyPage)
00961
00962 public:
00963 ETSLayoutPropertyPage( );
00964 ETSLayoutPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
00965 ETSLayoutPropertyPage( LPCTSTR lpszTemplateName, UINT nIDCaption = 0 );
00966
00967 ~ETSLayoutPropertyPage();
00968
00969
00970
00971
00972 public:
00973 virtual BOOL OnSetActive();
00974
00975
00976
00977 protected:
00978
00979
00980 afx_msg void OnSize(UINT nType, int cx, int cy);
00981 afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
00982 virtual BOOL OnInitDialog();
00983 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00984 afx_msg void OnWindowPosChanging( WINDOWPOS* lpwndpos );
00985 afx_msg void OnDestroy();
00986 afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
00987
00988 DECLARE_MESSAGE_MAP()
00989
00990 virtual CRect GetRect();
00991 bool m_bLockMove;
00992 bool m_bResetBuddyOnNextTimeVisible;
00993 };
00994
00995
00996 }
00997 using namespace ETSLayout;
00998
00999 #endif
01000 #endif
01001
01002
01003 namespace MGUI {
01004
01005
01006 class TOOLTIPCTRL;
01007 class LAYOUT_PANE_ROOT;
01008 class LAYOUT_PANE_MAIN;
01009 class LAYOUT_PAGE;
01010 class CTRL;
01011
01012
01013
01014
01015
01016
01017 class POINT {
01018 public:
01019
01020 INT16 m_x;
01021 INT16 m_y;
01022
01023
01024 POINT (
01025 ): m_x(-32768), m_y(-32768) { }
01026
01027
01028 POINT (
01029 INT16 x,
01030 INT16 y
01031 ): m_x(x), m_y(y) { }
01032 };
01033
01034
01035
01036
01037 enum LAYOUT_ORIENTATION {
01038 LAYOUT_ORIENTATION_Horizontal = 0,
01039 LAYOUT_ORIENTATION_Vertical = 1,
01040 LAYOUT_ORIENTATION_HorizontalLtoR = 2,
01041 LAYOUT_ORIENTATION_HorizontalRtoL = 3,
01042 };
01043
01044 enum LAYOUT_SIZEALIGN {
01045 LAYOUT_SIZEALIGN_Expand = 0x0000,
01046 LAYOUT_SIZEALIGN_FixedWidth = 0x0001,
01047 LAYOUT_SIZEALIGN_RelativeWidth = 0x0002,
01048 LAYOUT_SIZEALIGN_FixedHeight = 0x0004,
01049 LAYOUT_SIZEALIGN_RelativeHeight = 0x0008,
01050 LAYOUT_SIZEALIGN_FixedSize = 0x0005,
01051 LAYOUT_SIZEALIGN_AlignLeft = 0x0010,
01052 LAYOUT_SIZEALIGN_AlignRight = 0x0020,
01053 LAYOUT_SIZEALIGN_AlignTop = 0x0040,
01054 LAYOUT_SIZEALIGN_AlignBottom = 0x0080,
01055 LAYOUT_SIZEALIGN_CenterHorz = 0x0030,
01056 LAYOUT_SIZEALIGN_CenterVert = 0x00C0,
01057 LAYOUT_SIZEALIGN_Center = 0x00F0,
01058 LAYOUT_SIZEALIGN_IgnoreNonVisible = 0x4000,
01059 };
01060 DEFINE_ENUM_OPERATORS(LAYOUT_SIZEALIGN);
01061
01062
01063
01064
01065
01066 class LAYOUT_PANE_BASE {
01067 public:
01068
01069 #ifdef WIN32_MFC
01070
01071 LAYOUT_PANE_BASE (
01072 CWnd *RootWnd = 0
01073 ): m_RootPane(0) { }
01074 #endif
01075
01076 #ifdef X_NATIVE
01077
01078 LAYOUT_PANE_BASE (
01079 ): m_PaneWidget(0) { }
01080 #endif
01081
01082
01083 virtual ~LAYOUT_PANE_BASE (
01084 ) = 0;
01085
01086 #ifdef WIN32_MFC
01087
01088 operator CWnd* (
01089 ) { return (GetRootWnd()); }
01090 #endif
01091
01092 #ifdef WIN32_MFC
01093
01094 void AddItem (
01095 CWnd *ItemWnd,
01096 MGUI::LAYOUT_SIZEALIGN sizealign
01097 );
01098 #endif
01099
01100
01101 void AddSpaceExpanding (
01102 ) {
01103 #ifdef WIN32_MFC
01104 m_Pane->addItemGrowing();
01105 #else
01106 XmiPaneAddSpaceExpanding(m_PaneWidget);
01107 #endif
01108 }
01109
01110
01111 void AddSpaceFixed (
01112 int size
01113 ) {
01114 #ifdef WIN32_MFC
01115 m_Pane->addItemFixed(size);
01116 #else
01117 XmiPaneAddSpaceFixed(m_PaneWidget,size);
01118 #endif
01119 }
01120
01121 #ifdef WIN32_MFC
01122
01123 CRect ComputeRect (
01124 const CString& str,
01125 int xadd = 0,
01126 int yadd = 0
01127 ) const;
01128 #endif
01129
01130 #ifdef WIN32_MFC
01131
01132 CRect ComputeRect (
01133 int width,
01134 int xadd = 0,
01135 int yadd = 0
01136 ) const { return (ComputeRect(CString('M',width),xadd,yadd)); }
01137 #endif
01138
01139
01140 MGUI::POINT ComputeTextSize (
01141 int width
01142 ) const;
01143
01144
01145 MGUI::POINT ComputeTextSize (
01146 const MISTRING& str
01147 ) const;
01148
01149
01150 MGUI::POINT ComputeTextSize (
01151 const UNICODE *str
01152 ) const;
01153
01154 #ifdef WIN32_MFC
01155
01156 CSize ComputeTextSize (
01157 const CString& str
01158 ) const;
01159 #endif
01160
01161
01162 MDLGPARENT GetDlgParent (
01163 ) const {
01164 #ifdef WIN32_MFC
01165 return (GetMainWnd());
01166 #else
01167 return (MxGetShell(m_PaneWidget));
01168 #endif
01169 }
01170
01171 #ifdef WIN32_MFC
01172
01173 inline ETSLayoutMgr* GetLayoutMgr (
01174 ) const;
01175 #endif
01176
01177 #ifdef WIN32_MFC
01178
01179 UINT GetNextControlID (
01180 );
01181 #endif
01182
01183
01184
01185
01186
01187 #ifdef WIN32_MFC
01188
01189 inline CWnd* GetMainWnd (
01190 ) const;
01191 #endif
01192
01193 #ifdef WIN32_MFC
01194
01195 ETSLayoutMgr::CPane& GetPane (
01196 ) { return (m_Pane); }
01197 #endif
01198
01199 #ifdef X_NATIVE
01200
01201 Widget GetWidget (
01202 ) const { return (m_PaneWidget); }
01203 #endif
01204
01205 #ifdef WIN32_MFC
01206
01207 MGUI::LAYOUT_PANE_ROOT* GetRootPane (
01208 ) const { return (m_RootPane); }
01209 #endif
01210
01211 #ifdef WIN32_MFC
01212
01213 inline CWnd* GetRootWnd (
01214 ) const;
01215 #endif
01216
01217
01218 bool IsCreated (
01219 ) const {
01220 #ifdef WIN32_MFC
01221 return (m_Pane.IsValid());
01222 #else
01223 return (m_PaneWidget != 0);
01224 #endif
01225 }
01226
01227 #ifdef WIN32_MFC
01228
01229 inline void PreTransListAddCtrl (
01230 CTRL* ctrl
01231 );
01232 #endif
01233
01234
01235 void SetEnabled (
01236 bool enabled
01237 ) {
01238 #ifdef WIN32_MFC
01239 m_Pane->setEnabled(enabled);
01240 #else
01241 MxSetSensitive(m_PaneWidget,enabled);
01242 #endif
01243 }
01244
01245
01246 void SetVisible (
01247 bool visible
01248 ) {
01249 #ifdef WIN32_MFC
01250 m_Pane->setVisible(visible);
01251 #else
01252 MxShowWidget(m_PaneWidget,visible);
01253 #endif
01254 }
01255
01256
01257
01258 void UpdateLayout (
01259 ) {
01260 #ifdef WIN32_MFC
01261 GetLayoutMgr()->UpdateLayout();
01262 #endif
01263 }
01264
01265 #ifndef GENERATING_DOXYGEN_OUTPUT
01266
01267
01268 virtual SML_GUI_INTERFACE_BASE* GetSMLInterface (
01269 );
01270 #endif
01271
01272 protected:
01273
01274 #ifdef WIN32_MFC
01275 MGUI::LAYOUT_PANE_ROOT *m_RootPane;
01276 ETSLayoutMgr::CPane m_Pane;
01277 #endif
01278
01279 #ifdef X_NATIVE
01280 void SetPaneWidget (Widget PaneWidget);
01281 #endif
01282
01283 private:
01284 #ifndef GENERATING_DOXYGEN_OUTPUT
01285
01286 #ifdef X_NATIVE
01287 Widget m_PaneWidget;
01288 #endif
01289
01290 #ifdef X_NATIVE
01291 static void CB_Destroy (Widget, LAYOUT_PANE_BASE*, void*);
01292 #endif
01293
01294 LAYOUT_PANE_BASE (const LAYOUT_PANE_BASE&);
01295 LAYOUT_PANE_BASE& operator= (const LAYOUT_PANE_BASE&);
01296
01297 #endif // GENERATING_DOXYGEN_OUTPUT
01298 };
01299
01300
01301
01302
01303
01304 class LAYOUT_PANE_ROOT : public MGUI::LAYOUT_PANE_BASE {
01305 public:
01306
01307 #ifdef WIN32_MFC
01308
01309 LAYOUT_PANE_ROOT (
01310 CWnd& RootWnd
01311 );
01312 #endif
01313
01314 #ifdef X_NATIVE
01315
01316 LAYOUT_PANE_ROOT (
01317 ) { }
01318 #endif
01319
01320
01321 virtual ~LAYOUT_PANE_ROOT (
01322 );
01323
01324 #ifdef WIN32_MFC
01325
01326 void AddToolTipItem (
01327 CWnd& item,
01328 LPCTSTR string
01329 );
01330 #endif
01331
01332 #ifdef WIN32_MFC
01333
01334 ETSLayoutMgr* GetLayoutMgr (
01335 ) const { return (m_LayoutMgr); }
01336 #endif
01337
01338 #ifdef WIN32_MFC
01339
01340 MGUI::LAYOUT_PANE_MAIN* GetMainPane (
01341 ) const { return (m_MainPane); }
01342 #endif
01343
01344 #ifdef WIN32_MFC
01345 CWnd& GetWnd (
01346 ) const { return (m_RootWnd); }
01347 #endif
01348
01349 #ifdef WIN32_MFC
01350
01351 void Init (
01352 ETSLayoutMgr *LayoutMgr,
01353 ETSLayoutMgr::CPane RootPane,
01354 TOOLTIPCTRL *ToolTipCtrl
01355 );
01356 #endif
01357
01358 #ifdef X_NATIVE
01359
01360 void Init (
01361 Widget TopPaneWidget
01362 ) { SetPaneWidget(TopPaneWidget); }
01363 #endif
01364
01365 #ifdef WIN32_MFC
01366
01367 void PreTransListAdd (
01368 CTRL* ctrl
01369 );
01370 #endif
01371
01372 #ifdef WIN32_MFC
01373
01374
01375 bool PreTransListProcess (
01376 const CWnd* pFocusWnd,
01377 MSG *pMsg
01378 );
01379 #endif
01380
01381 protected:
01382
01383 #ifdef WIN32_MFC
01384 MGUI::LAYOUT_PANE_MAIN *m_MainPane;
01385 #endif
01386
01387 private:
01388 #ifndef GENERATING_DOXYGEN_OUTPUT
01389
01390 #ifdef WIN32_MFC
01391 CWnd& m_RootWnd;
01392 ETSLayoutMgr *m_LayoutMgr;
01393 TOOLTIPCTRL *m_ToolTipCtrl;
01394 SIMPLE_ARRAY<CTRL*> m_PreTransCtrls;
01395 #endif
01396
01397 LAYOUT_PANE_ROOT (const LAYOUT_PANE_ROOT&);
01398 LAYOUT_PANE_ROOT& operator= (const LAYOUT_PANE_ROOT&);
01399 #endif // GENERATING_DOXYGEN_OUTPUT
01400 };
01401
01402
01403
01404
01405
01406 class LAYOUT_PANE_MAIN : public MGUI::LAYOUT_PANE_ROOT {
01407 public:
01408
01409 #ifdef WIN32_MFC
01410
01411 LAYOUT_PANE_MAIN (
01412 CWnd& RootWnd
01413 ):
01414 LAYOUT_PANE_ROOT(RootWnd),
01415 m_NextControlID(ID_CONTROL_FIRST)
01416 { m_MainPane = this; }
01417 #endif
01418
01419 #ifdef X_NATIVE
01420
01421 LAYOUT_PANE_MAIN (
01422 ) { }
01423 #endif
01424
01425 #ifdef WIN32_MFC
01426
01427 UINT AllocNextControlID (
01428 ) { return (++m_NextControlID); }
01429 #endif
01430
01431 private:
01432 #ifndef GENERATING_DOXYGEN_OUTPUT
01433
01434 #ifdef WIN32_MFC
01435 UINT m_NextControlID;
01436 #endif
01437
01438 LAYOUT_PANE_MAIN (const LAYOUT_PANE_MAIN&);
01439 LAYOUT_PANE_MAIN& operator= (const LAYOUT_PANE_MAIN&);
01440 #endif // GENERATING_DOXYGEN_OUTPUT
01441 };
01442
01443
01444
01445
01446
01447 class LAYOUT_PANE : public MGUI::LAYOUT_PANE_BASE {
01448 public:
01449
01450
01451 LAYOUT_PANE (
01452 ) { }
01453
01454
01455 virtual ~LAYOUT_PANE (
01456 ) { }
01457
01458
01459 void Create (
01460 MGUI::LAYOUT_PANE_BASE& pane,
01461 MGUI::LAYOUT_ORIENTATION orientation,
01462 MGUI::LAYOUT_SIZEALIGN sizealign,
01463 int ChildSpacing = 4,
01464 int ExtraBorder = 0
01465 );
01466
01467 private:
01468 #ifndef GENERATING_DOXYGEN_OUTPUT
01469 LAYOUT_PANE (const LAYOUT_PANE&);
01470 LAYOUT_PANE& operator= (const LAYOUT_PANE&);
01471 #endif // GENERATING_DOXYGEN_OUTPUT
01472 };
01473
01474
01475
01476
01477
01478
01479 class LAYOUT_BOOK : public MGUI::LAYOUT_PANE_BASE {
01480 public:
01481
01482
01483 LAYOUT_BOOK (
01484 );
01485
01486
01487 void Create (
01488 );
01489
01490
01491
01492 int GetActiveIndex (
01493 ) const;
01494
01495
01496 void Initialize (
01497 MGUI::LAYOUT_PANE_BASE& ParentPane,
01498 MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize
01499 );
01500
01501
01502 void SetActiveIndex (
01503 int index
01504 );
01505
01506 private:
01507 #ifndef GENERATING_DOXYGEN_OUTPUT
01508
01509 #ifdef WIN32_MFC
01510 ETSLayoutPropertySheet m_PropSheet;
01511 #endif
01512
01513 #ifdef X_NATIVE
01514 SIMPLE_ARRAY<MxTABPAGEITEM> m_TabPageItems;
01515 Widget m_TabPage;
01516 #endif
01517
01518 MGUI::LAYOUT_PANE_BASE *m_pParentPane;
01519 LAYOUT_SIZEALIGN m_sizealign;
01520
01521 #ifdef X_NATIVE
01522 static void TABCB_Create (Widget, int, void*);
01523 static void TABCB_Activate (Widget, int, void*);
01524 #endif
01525
01526 LAYOUT_BOOK (const LAYOUT_BOOK&);
01527 LAYOUT_BOOK& operator= (const LAYOUT_BOOK&);
01528
01529 friend class LAYOUT_PAGE;
01530 #endif // GENERATING_DOXYGEN_OUTPUT
01531 };
01532
01533
01534
01535
01536
01537 class LAYOUT_PAGE : public MGUI::LAYOUT_PANE_ROOT {
01538 public:
01539
01540
01541 LAYOUT_PAGE (
01542 );
01543
01544
01545 virtual ~LAYOUT_PAGE (
01546 );
01547
01548
01549
01550 int Create (
01551 MGUI::LAYOUT_BOOK& book,
01552 const char *label,
01553 MGUI::LAYOUT_ORIENTATION orientation = MGUI::LAYOUT_ORIENTATION_Vertical
01554 );
01555
01556
01557
01558 int Create (
01559 MGUI::LAYOUT_BOOK& book,
01560 const MISTRING& label,
01561 MGUI::LAYOUT_ORIENTATION orientation = MGUI::LAYOUT_ORIENTATION_Vertical
01562 );
01563
01564
01565 bool IsActive (
01566 ) const;
01567
01568
01569 void SetEnabled (
01570 bool enabled = true
01571 );
01572
01573 protected:
01574
01575
01576
01577
01578
01579 virtual void OnInitPage (
01580 ) = 0;
01581
01582
01583
01584 virtual void OnSetActive (
01585 );
01586
01587
01588
01589 void SetIgnoreNonVisible (
01590 bool IgnoreNonVisible = true
01591 ) { m_IgnoreNonVisible = IgnoreNonVisible; }
01592
01593
01594
01595
01596 void SetNoSpaceExpanding (
01597 bool NoSpaceExpanding = true
01598 ) { m_NoSpaceExpanding = NoSpaceExpanding; }
01599
01600 private:
01601 #ifndef GENERATING_DOXYGEN_OUTPUT
01602
01603 #ifdef WIN32_MFC
01604 class MYPAGE : public ETSLayoutPropertyPage {
01605 public:
01606 MYPAGE (
01607 LAYOUT_PAGE& page
01608 ): m_page(page) { }
01609 virtual ~MYPAGE (
01610 ) { }
01611 protected:
01612 virtual BOOL OnInitDialog ();
01613 virtual BOOL PreTranslateMessage (MSG *pMsg);
01614 virtual BOOL OnSetActive ();
01615 private:
01616 LAYOUT_PAGE& m_page;
01617 MYPAGE (const MYPAGE&);
01618 MYPAGE& operator= (const MYPAGE&);
01619 };
01620 friend class MYPAGE;
01621
01622 MYPAGE m_Page;
01623 TOOLTIPCTRL *m_ToolTipCtrl;
01624 #else
01625 int m_index;
01626 #endif
01627
01628 LAYOUT_BOOK *m_pBook;
01629 MGUI::LAYOUT_ORIENTATION m_Orientation;
01630 bool m_IgnoreNonVisible;
01631 bool m_NoSpaceExpanding;
01632
01633 LAYOUT_PAGE (const LAYOUT_PAGE&);
01634 LAYOUT_PAGE& operator= (const LAYOUT_PAGE&);
01635
01636 friend class LAYOUT_BOOK;
01637 #endif // GENERATING_DOXYGEN_OUTPUT
01638 };
01639
01640
01641
01642
01643 class LAYOUT_EQUALIZER {
01644 public:
01645
01646
01647 enum EQUALIZE {
01648 EQUALIZE_Width = 1,
01649 EQUALIZE_Height = 2,
01650 EQUALIZE_Both = 3
01651 };
01652
01653
01654 LAYOUT_EQUALIZER (
01655 EQUALIZE equalize = EQUALIZE_Width
01656 );
01657
01658
01659 ~LAYOUT_EQUALIZER (
01660 );
01661
01662
01663 void Add (
01664 MGUI::CTRL& control
01665 );
01666
01667 #ifdef WIN32_MFC
01668
01669 void Add (
01670 CWnd& wnd
01671 );
01672 #endif
01673
01674
01675
01676 void Equalize (
01677 );
01678
01679