LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/vcl - layout.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 224 2.2 %
Date: 2013-07-09 Functions: 2 109 1.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #ifndef _VCLLAYOUT_HXX
      11             : #define _VCLLAYOUT_HXX
      12             : 
      13             : #include <vcl/dllapi.h>
      14             : #include <vcl/button.hxx>
      15             : #include <vcl/dialog.hxx>
      16             : #include <vcl/fixed.hxx>
      17             : #include <vcl/scrbar.hxx>
      18             : #include <vcl/vclmedit.hxx>
      19             : #include <vcl/window.hxx>
      20             : #include <boost/multi_array.hpp>
      21             : #include <set>
      22             : 
      23           0 : class VCL_DLLPUBLIC VclContainer : public Window
      24             : {
      25             : public:
      26             :     VclContainer(Window *pParent, WinBits nStyle = WB_HIDE);
      27             : 
      28             :     //These take into account the external margins of the rWindow widget
      29             :     //while GetOptimalSize/get_preferred_size and SetPosSizePixel are
      30             :     //oblivious to them
      31             :     static Size getLayoutRequisition(const Window &rWindow);
      32             :     static void setLayoutPosSize(Window &rWindow, const Point &rPos, const Size &rSize);
      33             : 
      34             :     //applies the allocation pos and size onto rWindow via setLayoutPosSize taking into account
      35             :     //the rWindows alignment desires within that allocation
      36             :     static void setLayoutAllocation(Window &rWindow, const Point &rPos, const Size &rSize);
      37             : 
      38           0 :     void markLayoutDirty()
      39             :     {
      40           0 :         m_bLayoutDirty = true;
      41           0 :     }
      42             : protected:
      43             :     //these are the two that need to be implemented by
      44             :     //containers, figure out how much space you want...
      45             :     virtual Size calculateRequisition() const = 0;
      46             :     //..and decide what to do when set to this size
      47             :     virtual void setAllocation(const Size &rAllocation) = 0;
      48             : 
      49             :     virtual sal_uInt16 getDefaultAccessibleRole() const;
      50             : public:
      51             :     //you don't want to override these
      52             :     virtual Size GetOptimalSize() const;
      53             :     virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize);
      54             :     virtual void SetPosPixel(const Point& rAllocPos);
      55             :     virtual void SetSizePixel(const Size& rAllocation);
      56             : private:
      57             :     bool m_bLayoutDirty;
      58             : };
      59             : 
      60           0 : class VCL_DLLPUBLIC VclBox : public VclContainer
      61             : {
      62             : protected:
      63             :     bool m_bHomogeneous;
      64             :     bool m_bVerticalContainer;
      65             :     int m_nSpacing;
      66             : public:
      67           0 :     VclBox(Window *pParent, bool bHomogeneous, int nSpacing)
      68             :         : VclContainer(pParent)
      69             :         , m_bHomogeneous(bHomogeneous)
      70           0 :         , m_nSpacing(nSpacing)
      71             :     {
      72           0 :     }
      73           0 :     void set_spacing(int nSpacing)
      74             :     {
      75           0 :         m_nSpacing = nSpacing;
      76           0 :     }
      77           0 :     int get_spacing() const
      78             :     {
      79           0 :         return m_nSpacing;
      80             :     }
      81           0 :     void set_homogeneous(bool bHomogeneous)
      82             :     {
      83           0 :         m_bHomogeneous = bHomogeneous;
      84           0 :     }
      85             :     bool get_homogeneous() const
      86             :     {
      87             :         return m_bHomogeneous;
      88             :     }
      89             :     virtual bool set_property(const OString &rKey, const OString &rValue);
      90             : protected:
      91             :     virtual sal_uInt16 getDefaultAccessibleRole() const;
      92             :     void accumulateMaxes(const Size &rChildSize, Size &rSize) const;
      93             :     Size finalizeMaxes(const Size &rSize, sal_uInt16 nVisibleChildren) const;
      94             : 
      95             :     virtual Size calculateRequisition() const;
      96             :     virtual void setAllocation(const Size &rAllocation);
      97             : 
      98             :     virtual long getPrimaryDimension(const Size &rSize) const = 0;
      99             :     virtual void setPrimaryDimension(Size &rSize, long) const = 0;
     100             :     virtual long getPrimaryCoordinate(const Point &rPos) const = 0;
     101             :     virtual void setPrimaryCoordinate(Point &rPos, long) const = 0;
     102             :     virtual long getSecondaryDimension(const Size &rSize) const = 0;
     103             :     virtual void setSecondaryDimension(Size &rSize, long) const = 0;
     104             :     virtual long getSecondaryCoordinate(const Point &rPos) const = 0;
     105             :     virtual void setSecondaryCoordinate(Point &rPos, long) const = 0;
     106             : 
     107             :     virtual bool getPrimaryDimensionChildExpand(const Window &rWindow) const = 0;
     108             : };
     109             : 
     110           0 : class VCL_DLLPUBLIC VclVBox : public VclBox
     111             : {
     112             : public:
     113           0 :     VclVBox(Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
     114           0 :         : VclBox(pParent, bHomogeneous, nSpacing)
     115             :     {
     116           0 :         m_bVerticalContainer = true;
     117           0 :     }
     118             : protected:
     119           0 :     virtual long getPrimaryDimension(const Size &rSize) const
     120             :     {
     121           0 :         return rSize.getHeight();
     122             :     }
     123           0 :     virtual void setPrimaryDimension(Size &rSize, long nHeight) const
     124             :     {
     125           0 :         rSize.setHeight(nHeight);
     126           0 :     }
     127           0 :     virtual long getPrimaryCoordinate(const Point &rPos) const
     128             :     {
     129           0 :         return rPos.getY();
     130             :     }
     131           0 :     virtual void setPrimaryCoordinate(Point &rPos, long nPos) const
     132             :     {
     133           0 :         rPos.setY(nPos);
     134           0 :     }
     135           0 :     virtual long getSecondaryDimension(const Size &rSize) const
     136             :     {
     137           0 :         return rSize.getWidth();
     138             :     }
     139           0 :     virtual void setSecondaryDimension(Size &rSize, long nWidth) const
     140             :     {
     141           0 :         rSize.setWidth(nWidth);
     142           0 :     }
     143           0 :     virtual long getSecondaryCoordinate(const Point &rPos) const
     144             :     {
     145           0 :         return rPos.getX();
     146             :     }
     147           0 :     virtual void setSecondaryCoordinate(Point &rPos, long nPos) const
     148             :     {
     149           0 :         rPos.setX(nPos);
     150           0 :     }
     151           0 :     virtual bool getPrimaryDimensionChildExpand(const Window &rWindow) const
     152             :     {
     153           0 :         return rWindow.get_expand() || rWindow.get_vexpand();
     154             :     }
     155             : };
     156             : 
     157           0 : class VCL_DLLPUBLIC VclHBox : public VclBox
     158             : {
     159             : public:
     160           0 :     VclHBox(Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
     161           0 :         : VclBox(pParent, bHomogeneous, nSpacing)
     162             :     {
     163           0 :         m_bVerticalContainer = false;
     164           0 :     }
     165             : protected:
     166           0 :     virtual long getPrimaryDimension(const Size &rSize) const
     167             :     {
     168           0 :         return rSize.getWidth();
     169             :     }
     170           0 :     virtual void setPrimaryDimension(Size &rSize, long nWidth) const
     171             :     {
     172           0 :         rSize.setWidth(nWidth);
     173           0 :     }
     174           0 :     virtual long getPrimaryCoordinate(const Point &rPos) const
     175             :     {
     176           0 :         return rPos.getX();
     177             :     }
     178           0 :     virtual void setPrimaryCoordinate(Point &rPos, long nPos) const
     179             :     {
     180           0 :         rPos.setX(nPos);
     181           0 :     }
     182           0 :     virtual long getSecondaryDimension(const Size &rSize) const
     183             :     {
     184           0 :         return rSize.getHeight();
     185             :     }
     186           0 :     virtual void setSecondaryDimension(Size &rSize, long nHeight) const
     187             :     {
     188           0 :         rSize.setHeight(nHeight);
     189           0 :     }
     190           0 :     virtual long getSecondaryCoordinate(const Point &rPos) const
     191             :     {
     192           0 :         return rPos.getY();
     193             :     }
     194           0 :     virtual void setSecondaryCoordinate(Point &rPos, long nPos) const
     195             :     {
     196           0 :         rPos.setY(nPos);
     197           0 :     }
     198           0 :     virtual bool getPrimaryDimensionChildExpand(const Window &rWindow) const
     199             :     {
     200           0 :         return rWindow.get_expand() || rWindow.get_hexpand();
     201             :     }
     202             : };
     203             : 
     204             : enum VclButtonBoxStyle
     205             : {
     206             :     VCL_BUTTONBOX_DEFAULT_STYLE,
     207             :     VCL_BUTTONBOX_SPREAD,
     208             :     VCL_BUTTONBOX_EDGE,
     209             :     VCL_BUTTONBOX_START,
     210             :     VCL_BUTTONBOX_END,
     211             :     VCL_BUTTONBOX_CENTER
     212             : };
     213             : 
     214           0 : class VCL_DLLPUBLIC VclButtonBox : public VclBox
     215             : {
     216             : public:
     217           0 :     VclButtonBox(Window *pParent, int nSpacing)
     218             :         : VclBox(pParent, false, nSpacing)
     219           0 :         , m_eLayoutStyle(VCL_BUTTONBOX_DEFAULT_STYLE)
     220             :     {
     221           0 :     }
     222           0 :     void set_layout(VclButtonBoxStyle eStyle)
     223             :     {
     224           0 :         m_eLayoutStyle = eStyle;
     225           0 :     }
     226             :     VclButtonBoxStyle get_layout() const
     227             :     {
     228             :         return m_eLayoutStyle;
     229             :     }
     230             :     virtual bool set_property(const OString &rKey, const OString &rValue);
     231             :     void sort_native_button_order();
     232             : protected:
     233             :     virtual Size calculateRequisition() const;
     234             :     virtual void setAllocation(const Size &rAllocation);
     235             :     Size addSpacing(const Size &rSize, sal_uInt16 nVisibleChildren) const;
     236             : private:
     237             :     VclButtonBoxStyle m_eLayoutStyle;
     238           0 :     struct Requisition
     239             :     {
     240             :         std::vector<long> m_aMainGroupDimensions;
     241             :         std::vector<long> m_aSubGroupDimensions;
     242             :         Size m_aMainGroupSize;
     243             :         Size m_aSubGroupSize;
     244             :     };
     245             :     Requisition calculatePrimarySecondaryRequisitions() const;
     246             :     Size addReqGroups(const VclButtonBox::Requisition &rReq) const;
     247             : };
     248             : 
     249           0 : class VCL_DLLPUBLIC VclVButtonBox : public VclButtonBox
     250             : {
     251             : public:
     252           0 :     VclVButtonBox(Window *pParent, int nSpacing = 0)
     253           0 :         : VclButtonBox(pParent, nSpacing)
     254             :     {
     255           0 :         m_bVerticalContainer = true;
     256           0 :     }
     257             : protected:
     258           0 :     virtual long getPrimaryDimension(const Size &rSize) const
     259             :     {
     260           0 :         return rSize.getHeight();
     261             :     }
     262           0 :     virtual void setPrimaryDimension(Size &rSize, long nHeight) const
     263             :     {
     264           0 :         rSize.setHeight(nHeight);
     265           0 :     }
     266           0 :     virtual long getPrimaryCoordinate(const Point &rPos) const
     267             :     {
     268           0 :         return rPos.getY();
     269             :     }
     270           0 :     virtual void setPrimaryCoordinate(Point &rPos, long nPos) const
     271             :     {
     272           0 :         rPos.setY(nPos);
     273           0 :     }
     274           0 :     virtual long getSecondaryDimension(const Size &rSize) const
     275             :     {
     276           0 :         return rSize.getWidth();
     277             :     }
     278           0 :     virtual void setSecondaryDimension(Size &rSize, long nWidth) const
     279             :     {
     280           0 :         rSize.setWidth(nWidth);
     281           0 :     }
     282           0 :     virtual long getSecondaryCoordinate(const Point &rPos) const
     283             :     {
     284           0 :         return rPos.getX();
     285             :     }
     286           0 :     virtual void setSecondaryCoordinate(Point &rPos, long nPos) const
     287             :     {
     288           0 :         rPos.setX(nPos);
     289           0 :     }
     290           0 :     virtual bool getPrimaryDimensionChildExpand(const Window &rWindow) const
     291             :     {
     292           0 :         return rWindow.get_expand() || rWindow.get_vexpand();
     293             :     }
     294             : };
     295             : 
     296           0 : class VCL_DLLPUBLIC VclHButtonBox : public VclButtonBox
     297             : {
     298             : public:
     299           0 :     VclHButtonBox(Window *pParent, int nSpacing = 0)
     300           0 :         : VclButtonBox(pParent, nSpacing)
     301             :     {
     302           0 :         m_bVerticalContainer = false;
     303           0 :     }
     304             : protected:
     305           0 :     virtual long getPrimaryDimension(const Size &rSize) const
     306             :     {
     307           0 :         return rSize.getWidth();
     308             :     }
     309           0 :     virtual void setPrimaryDimension(Size &rSize, long nWidth) const
     310             :     {
     311           0 :         rSize.setWidth(nWidth);
     312           0 :     }
     313           0 :     virtual long getPrimaryCoordinate(const Point &rPos) const
     314             :     {
     315           0 :         return rPos.getX();
     316             :     }
     317           0 :     virtual void setPrimaryCoordinate(Point &rPos, long nPos) const
     318             :     {
     319           0 :         rPos.setX(nPos);
     320           0 :     }
     321           0 :     virtual long getSecondaryDimension(const Size &rSize) const
     322             :     {
     323           0 :         return rSize.getHeight();
     324             :     }
     325           0 :     virtual void setSecondaryDimension(Size &rSize, long nHeight) const
     326             :     {
     327           0 :         rSize.setHeight(nHeight);
     328           0 :     }
     329           0 :     virtual long getSecondaryCoordinate(const Point &rPos) const
     330             :     {
     331           0 :         return rPos.getY();
     332             :     }
     333           0 :     virtual void setSecondaryCoordinate(Point &rPos, long nPos) const
     334             :     {
     335           0 :         rPos.setY(nPos);
     336           0 :     }
     337           0 :     virtual bool getPrimaryDimensionChildExpand(const Window &rWindow) const
     338             :     {
     339           0 :         return rWindow.get_expand() || rWindow.get_hexpand();
     340             :     }
     341             : };
     342             : 
     343           0 : class VCL_DLLPUBLIC VclGrid : public VclContainer
     344             : {
     345             : private:
     346             :     bool m_bRowHomogeneous;
     347             :     bool m_bColumnHomogeneous;
     348             :     int m_nRowSpacing;
     349             :     int m_nColumnSpacing;
     350             : 
     351             :     struct GridEntry
     352             :     {
     353             :         Window *pChild;
     354             :         sal_Int32 nSpanWidth;
     355             :         sal_Int32 nSpanHeight;
     356           0 :         GridEntry()
     357             :             : pChild(0)
     358             :             , nSpanWidth(0)
     359           0 :             , nSpanHeight(0)
     360             :         {
     361           0 :         }
     362             :     };
     363             : 
     364             :     typedef boost::multi_array<GridEntry, 2> array_type;
     365             : 
     366             :     struct ExtendedGridEntry : GridEntry
     367             :     {
     368             :         int x;
     369             :         int y;
     370           0 :         ExtendedGridEntry()
     371             :             : x(-1)
     372           0 :             , y(-1)
     373             :         {
     374           0 :         }
     375             :     };
     376             : 
     377             :     typedef boost::multi_array<ExtendedGridEntry, 2> ext_array_type;
     378             : 
     379             :     array_type assembleGrid() const;
     380             :     bool isNullGrid(const array_type& A) const;
     381             : public:
     382             :     struct Value
     383             :     {
     384             :         long m_nValue;
     385             :         bool m_bExpand;
     386           0 :         Value() : m_nValue(0), m_bExpand(false) {}
     387             :     };
     388             : private:
     389             :     void calcMaxs(const array_type &A, std::vector<Value> &rWidths, std::vector<Value> &rHeights) const;
     390             : 
     391             :     virtual Size calculateRequisition() const;
     392             :     virtual void setAllocation(const Size &rAllocation);
     393             : public:
     394           0 :     VclGrid(Window *pParent)
     395             :         : VclContainer(pParent)
     396             :         , m_bRowHomogeneous(false), m_bColumnHomogeneous(false)
     397           0 :         , m_nRowSpacing(0), m_nColumnSpacing(0)
     398             :     {
     399           0 :     }
     400           0 :     void set_row_homogeneous(bool bHomogeneous)
     401             :     {
     402           0 :         m_bRowHomogeneous = bHomogeneous;
     403           0 :     }
     404           0 :     void set_column_homogeneous(bool bHomogeneous)
     405             :     {
     406           0 :         m_bColumnHomogeneous = bHomogeneous;
     407           0 :     }
     408           0 :     bool get_row_homogeneous() const
     409             :     {
     410           0 :         return m_bRowHomogeneous;
     411             :     }
     412           0 :     bool get_column_homogeneous() const
     413             :     {
     414           0 :         return m_bColumnHomogeneous;
     415             :     }
     416           0 :     void set_row_spacing(int nSpacing)
     417             :     {
     418           0 :         m_nRowSpacing = nSpacing;
     419           0 :     }
     420           0 :     void set_column_spacing(int nSpacing)
     421             :     {
     422           0 :         m_nColumnSpacing = nSpacing;
     423           0 :     }
     424           0 :     int get_row_spacing() const
     425             :     {
     426           0 :         return m_nRowSpacing;
     427             :     }
     428           0 :     int get_column_spacing() const
     429             :     {
     430           0 :         return m_nColumnSpacing;
     431             :     }
     432             :     virtual bool set_property(const OString &rKey, const OString &rValue);
     433             : };
     434             : 
     435             : VCL_DLLPUBLIC void setGridAttach(Window &rWidget, sal_Int32 nLeft, sal_Int32 nTop,
     436             :     sal_Int32 nWidth = 1, sal_Int32 nHeight = 1);
     437             : 
     438           0 : class VCL_DLLPUBLIC VclBin : public VclContainer
     439             : {
     440             : public:
     441           0 :     VclBin(Window *pParent, WinBits nStyle = WB_HIDE)
     442           0 :         : VclContainer(pParent, nStyle)
     443             :     {
     444           0 :     }
     445             :     virtual Window *get_child();
     446             :     virtual const Window *get_child() const;
     447             :     virtual Size calculateRequisition() const;
     448             :     virtual void setAllocation(const Size &rAllocation);
     449             : };
     450             : 
     451           0 : class VCL_DLLPUBLIC VclFrame : public VclBin
     452             : {
     453             : private:
     454             :     Window *m_pLabel;
     455             : private:
     456             :     friend class VclBuilder;
     457             :     void designate_label(Window *pWindow);
     458             : public:
     459           0 :     VclFrame(Window *pParent)
     460             :         : VclBin(pParent)
     461           0 :         , m_pLabel(NULL)
     462             :     {
     463           0 :     }
     464             :     void set_label(const OUString &rLabel);
     465             :     virtual Window *get_child();
     466             :     virtual const Window *get_child() const;
     467             :     Window *get_label_widget();
     468             :     const Window *get_label_widget() const;
     469             : protected:
     470             :     virtual Size calculateRequisition() const;
     471             :     virtual void setAllocation(const Size &rAllocation);
     472             :     virtual OUString getDefaultAccessibleName() const;
     473             : };
     474             : 
     475           0 : class VCL_DLLPUBLIC VclAlignment : public VclBin
     476             : {
     477             : public:
     478           0 :     VclAlignment(Window *pParent)
     479             :         : VclBin(pParent)
     480             :         , m_nBottomPadding(0)
     481             :         , m_nLeftPadding(0)
     482             :         , m_nRightPadding(0)
     483             :         , m_nTopPadding(0)
     484             :         , m_fXAlign(0.0)
     485             :         , m_fXScale(1.0)
     486             :         , m_fYAlign(0.0)
     487           0 :         , m_fYScale(1.0)
     488             :     {
     489           0 :     }
     490             :     virtual bool set_property(const OString &rKey, const OString &rValue);
     491             : protected:
     492             :     virtual Size calculateRequisition() const;
     493             :     virtual void setAllocation(const Size &rAllocation);
     494             : private:
     495             :     sal_Int32 m_nBottomPadding;
     496             :     sal_Int32 m_nLeftPadding;
     497             :     sal_Int32 m_nRightPadding;
     498             :     sal_Int32 m_nTopPadding;
     499             :     float m_fXAlign;
     500             :     float m_fXScale;
     501             :     float m_fYAlign;
     502             :     float m_fYScale;
     503             : };
     504             : 
     505           0 : class VCL_DLLPUBLIC VclExpander : public VclBin
     506             : {
     507             : public:
     508           0 :     VclExpander(Window *pParent)
     509             :         : VclBin(pParent)
     510             :         , m_bResizeTopLevel(true)
     511           0 :         , m_aDisclosureButton(this)
     512             :     {
     513           0 :         m_aDisclosureButton.SetToggleHdl(LINK(this, VclExpander, ClickHdl));
     514           0 :         m_aDisclosureButton.Show();
     515           0 :     }
     516             :     virtual Window *get_child();
     517             :     virtual const Window *get_child() const;
     518             :     virtual bool set_property(const OString &rKey, const OString &rValue);
     519             : protected:
     520             :     virtual Size calculateRequisition() const;
     521             :     virtual void setAllocation(const Size &rAllocation);
     522             : private:
     523             :     bool m_bResizeTopLevel;
     524             :     DisclosureButton m_aDisclosureButton;
     525             :     DECL_DLLPRIVATE_LINK(ClickHdl, DisclosureButton* pBtn);
     526             : };
     527             : 
     528             : //This is a work in progress, so if you want to put something inside a
     529             : //scrolled window that doesn't handle its own scrolling, then you may need to
     530             : //implement this fully
     531           0 : class VCL_DLLPUBLIC VclScrolledWindow : public VclBin
     532             : {
     533             : public:
     534           0 :     VclScrolledWindow(Window *pParent, WinBits nStyle = WB_HIDE | WB_AUTOHSCROLL | WB_AUTOVSCROLL)
     535             :         : VclBin(pParent, nStyle)
     536             :         , m_aVScroll(this, WB_HIDE | WB_VERT)
     537           0 :         , m_aHScroll(this, WB_HIDE | WB_HORZ)
     538             :     {
     539           0 :         SetType(WINDOW_SCROLLWINDOW);
     540           0 :     }
     541             :     virtual Window *get_child();
     542             :     virtual const Window *get_child() const;
     543             :     virtual bool set_property(const OString &rKey, const OString &rValue);
     544           0 :     ScrollBar& getVertScrollBar() { return m_aVScroll; }
     545             :     ScrollBar& getHorzScrollBar() { return m_aHScroll; }
     546             :     Size getVisibleChildSize() const;
     547             : protected:
     548             :     virtual Size calculateRequisition() const;
     549             :     virtual void setAllocation(const Size &rAllocation);
     550             : private:
     551             :     ScrollBar m_aVScroll;
     552             :     ScrollBar m_aHScroll;
     553             : };
     554             : 
     555             : //Enforces that its children are always the same size as itself.
     556             : //Intercepts any Commands intended for its children.
     557             : //
     558             : //by default the Commands are discarded, inherit from this
     559             : //and implement "Command" to get them
     560           0 : class VCL_DLLPUBLIC VclEventBox : public VclBin
     561             : {
     562             : private:
     563             :     //Any Commands an EventBoxHelper receives are forwarded to its parent
     564             :     //The VclEventBox ensures that m_aEventBoxHelper is the
     565             :     //first child and is transparent, but covers the rest of the children
     566           0 :     class EventBoxHelper : public Window
     567             :     {
     568             :     public:
     569           0 :         EventBoxHelper(Window* pParent)
     570           0 :             : Window(pParent, 0)
     571             :         {
     572           0 :             SetSizePixel(pParent->GetSizePixel());
     573           0 :             EnableChildTransparentMode();
     574           0 :             SetPaintTransparent(true);
     575           0 :             SetBackground();
     576           0 :         }
     577           0 :         virtual void Command(const CommandEvent& rCEvt)
     578             :         {
     579           0 :             GetParent()->Command(rCEvt);
     580           0 :         }
     581             :     };
     582             : 
     583             :     EventBoxHelper m_aEventBoxHelper;
     584             : public:
     585           0 :     VclEventBox(Window* pParent)
     586             :         : VclBin(pParent)
     587           0 :         , m_aEventBoxHelper(this)
     588             :     {
     589           0 :         m_aEventBoxHelper.Show();
     590           0 :     }
     591             :     virtual Window *get_child();
     592             :     virtual const Window *get_child() const;
     593             :     virtual Size calculateRequisition() const;
     594             :     virtual void setAllocation(const Size &rAllocation);
     595             : 
     596             :     virtual void Command(const CommandEvent& rCEvt);
     597             : };
     598             : 
     599             : enum VclSizeGroupMode
     600             : {
     601             :     VCL_SIZE_GROUP_NONE,
     602             :     VCL_SIZE_GROUP_HORIZONTAL,
     603             :     VCL_SIZE_GROUP_VERTICAL,
     604             :     VCL_SIZE_GROUP_BOTH
     605             : };
     606             : 
     607           0 : class VCL_DLLPUBLIC VclSizeGroup
     608             : {
     609             : private:
     610             :     std::set<Window*> m_aWindows;
     611             :     bool m_bIgnoreHidden;
     612             :     VclSizeGroupMode m_eMode;
     613             : 
     614             :     void trigger_queue_resize();
     615             : public:
     616           0 :     VclSizeGroup()
     617             :         : m_bIgnoreHidden(false)
     618           0 :         , m_eMode(VCL_SIZE_GROUP_HORIZONTAL)
     619             :     {
     620           0 :     }
     621           0 :     void insert(Window *pWindow)
     622             :     {
     623           0 :         m_aWindows.insert(pWindow);
     624           0 :     }
     625           0 :     void erase(Window *pWindow)
     626             :     {
     627           0 :         m_aWindows.erase(pWindow);
     628           0 :     }
     629             :     const std::set<Window*>& get_widgets() const
     630             :     {
     631             :         return m_aWindows;
     632             :     }
     633           0 :     std::set<Window*>& get_widgets()
     634             :     {
     635           0 :         return m_aWindows;
     636             :     }
     637             :     void set_ignore_hidden(bool bIgnoreHidden);
     638           0 :     bool get_ignore_hidden() const
     639             :     {
     640           0 :         return m_bIgnoreHidden;
     641             :     }
     642             :     void set_mode(VclSizeGroupMode eMode);
     643           0 :     VclSizeGroupMode get_mode() const
     644             :     {
     645           0 :         return m_eMode;
     646             :     }
     647             :     bool set_property(const OString &rKey, const OString &rValue);
     648             : };
     649             : 
     650             : enum VclButtonsType
     651             : {
     652             :     VCL_BUTTONS_NONE,
     653             :     VCL_BUTTONS_OK,
     654             :     VCL_BUTTONS_CLOSE,
     655             :     VCL_BUTTONS_CANCEL,
     656             :     VCL_BUTTONS_YES_NO,
     657             :     VCL_BUTTONS_OK_CANCEL
     658             : };
     659             : 
     660             : enum VclMessageType
     661             : {
     662             :     VCL_MESSAGE_INFO,
     663             :     VCL_MESSAGE_WARNING,
     664             :     VCL_MESSAGE_QUESTION,
     665             :     VCL_MESSAGE_ERROR
     666             : };
     667             : 
     668             : class VCL_DLLPUBLIC MessageDialog : public Dialog
     669             : {
     670             : private:
     671             :     VclButtonsType m_eButtonsType;
     672             :     VclMessageType m_eMessageType;
     673             :     VclGrid* m_pGrid;
     674             :     FixedImage* m_pImage;
     675             :     VclMultiLineEdit* m_pPrimaryMessage;
     676             :     VclMultiLineEdit* m_pSecondaryMessage;
     677             :     std::vector<PushButton*> m_aOwnedButtons;
     678             :     std::map<const Window*, short> m_aResponses;
     679             :     OUString m_sPrimaryString;
     680             :     OUString m_sSecondaryString;
     681             :     DECL_DLLPRIVATE_LINK(ButtonHdl, Button *);
     682             :     void setButtonHandlers(VclButtonBox *pButtonBox);
     683             :     short get_response(const Window *pWindow) const;
     684             : public:
     685             : 
     686             :     MessageDialog(Window* pParent, WinBits nStyle);
     687             :     MessageDialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription);
     688             :     virtual bool set_property(const OString &rKey, const OString &rValue);
     689             :     virtual short Execute();
     690             :     OUString get_primary_text() const;
     691             :     OUString get_secondary_text() const;
     692             :     void set_primary_text(const OUString &rPrimaryString);
     693             :     void set_secondary_text(const OUString &rSecondaryString);
     694             :     ~MessageDialog();
     695             : };
     696             : 
     697             : VCL_DLLPUBLIC Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize);
     698             : 
     699             : //Get first window of a pTopLevel window as
     700             : //if any intermediate layout widgets didn't exist
     701             : //i.e. acts like pChild = pChild->GetWindow(WINDOW_FIRSTCHILD);
     702             : //in a flat hierarchy where dialogs only have one layer
     703             : //of children
     704             : VCL_DLLPUBLIC Window* firstLogicalChildOfParent(Window *pTopLevel);
     705             : 
     706             : //Get next window after pChild of a pTopLevel window as
     707             : //if any intermediate layout widgets didn't exist
     708             : //i.e. acts like pChild = pChild->GetWindow(WINDOW_NEXT);
     709             : //in a flat hierarchy where dialogs only have one layer
     710             : //of children
     711             : VCL_DLLPUBLIC Window* nextLogicalChildOfParent(Window *pTopLevel, Window *pChild);
     712             : 
     713             : //Get previous window before pChild of a pTopLevel window as
     714             : //if any intermediate layout widgets didn't exist
     715             : //i.e. acts like pChild = pChild->GetWindow(WINDOW_PREV);
     716             : //in a flat hierarchy where dialogs only have one layer
     717             : //of children
     718             : VCL_DLLPUBLIC Window* prevLogicalChildOfParent(Window *pTopLevel, Window *pChild);
     719             : 
     720             : //Returns true is the Window has a single child which is a container
     721             : VCL_DLLPUBLIC bool isLayoutEnabled(const Window *pWindow);
     722             : 
     723     1089851 : VCL_DLLPUBLIC inline bool isContainerWindow(const Window &rWindow)
     724             : {
     725     1089851 :     WindowType eType = rWindow.GetType();
     726     1089851 :     return (eType == WINDOW_CONTAINER || eType == WINDOW_SCROLLWINDOW);
     727             : }
     728             : 
     729        5646 : VCL_DLLPUBLIC inline bool isContainerWindow(const Window *pWindow)
     730             : {
     731        5646 :     return pWindow && isContainerWindow(*pWindow);
     732             : }
     733             : 
     734             : //Returns true if the containing dialog is doing its initial
     735             : //layout and isn't visible yet
     736             : VCL_DLLPUBLIC bool isInitialLayout(const Window *pWindow);
     737             : 
     738             : // retro-fitting utilities //
     739             : 
     740             : //Get a Size which is large enough to contain all children with
     741             : //an equal amount of space at top left and bottom right
     742             : Size getLegacyBestSizeForChildren(const Window &rWindow);
     743             : 
     744             : //Get first parent which is not a layout widget
     745             : Window* getNonLayoutParent(Window *pParent);
     746             : 
     747             : //Get first real parent which is not a layout widget
     748             : Window* getNonLayoutRealParent(Window *pParent);
     749             : 
     750             : //return true if this window and its stack of containers are all shown
     751             : bool isVisibleInLayout(const Window *pWindow);
     752             : 
     753             : //return true if this window and its stack of containers are all enabled
     754             : bool isEnabledInLayout(const Window *pWindow);
     755             : 
     756             : #endif
     757             : 
     758             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10