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

Generated by: LCOV version 1.10