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