summaryrefslogtreecommitdiff
path: root/vcl/inc/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-11-09 22:58:42 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:47:53 +0100
commit7d4c786e5c8b2b664997df6e9193cb4352cf9615 (patch)
tree367b1eb26d045ad64166b7ac11c22c3419b9715e /vcl/inc/vcl
parenta73656244f75099415efe1b671783eea9dcbe5f9 (diff)
add basic hbox, vbox and dialog support
Diffstat (limited to 'vcl/inc/vcl')
-rw-r--r--vcl/inc/vcl/dialog.hxx4
-rw-r--r--vcl/inc/vcl/fixed.hxx2
-rw-r--r--vcl/inc/vcl/layout.hxx154
-rw-r--r--vcl/inc/vcl/window.hxx13
4 files changed, 173 insertions, 0 deletions
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index 093ef1e0db69..c8bb05d2c9fb 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -83,6 +83,10 @@ public:
virtual void StateChanged( StateChangedType nStateChange );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual Size GetOptimalSize(WindowSizeType eType) const;
+ virtual void Resize();
+
+
virtual sal_Bool Close();
virtual short Execute();
diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx
index 63f094d0509d..4ce0d9d0c606 100644
--- a/vcl/inc/vcl/fixed.hxx
+++ b/vcl/inc/vcl/fixed.hxx
@@ -74,6 +74,8 @@ public:
static Size CalcMinimumTextSize( Control const* pControl, long nMaxWidth = 0 );
Size CalcMinimumSize( long nMaxWidth = 0 ) const;
virtual Size GetOptimalSize(WindowSizeType eType) const;
+
+ virtual void SetText( const XubString& rStr );
};
// -------------
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
new file mode 100644
index 000000000000..eaff5037a43a
--- /dev/null
+++ b/vcl/inc/vcl/layout.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Caolán McNamara <caolanm@redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef _VCLLAYOUT_HXX
+#define _VCLLAYOUT_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/window.hxx>
+
+class VCL_DLLPUBLIC Box : public Window
+{
+protected:
+ bool m_bHomogeneous;
+ int m_nSpacing;
+public:
+ Box(Window *pParent, bool bHomogeneous = false, int nSpacing = 0)
+ : Window(pParent)
+ , m_bHomogeneous(bHomogeneous)
+ , m_nSpacing(nSpacing)
+ {
+ Show();
+ }
+public:
+ virtual Size GetOptimalSize(WindowSizeType eType) const;
+ using Window::SetPosSizePixel;
+ virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize);
+protected:
+ Size calculateRequisition() const;
+ void setAllocation(const Size &rAllocation);
+
+ virtual long getPrimaryDimension(const Size &rSize) const = 0;
+ virtual void setPrimaryDimension(Size &rSize, long) const = 0;
+ virtual long getPrimaryCoordinate(const Point &rPos) const = 0;
+ virtual void setPrimaryCoordinate(Point &rPos, long) const = 0;
+ virtual long getSecondaryDimension(const Size &rSize) const = 0;
+ virtual void setSecondaryDimension(Size &rSize, long) const = 0;
+ virtual long getSecondaryCoordinate(const Point &rPos) const = 0;
+ virtual void setSecondaryCoordinate(Point &rPos, long) const = 0;
+
+ virtual long getPrimaryDimensionBorders(sal_Int32 nLeftBorder, sal_Int32 nTopBorder,
+ sal_Int32 nRightBorder, sal_Int32 nBottomBorder) = 0;
+};
+
+class VCL_DLLPUBLIC VBox : public Box
+{
+protected:
+ virtual long getPrimaryDimension(const Size &rSize) const
+ {
+ return rSize.getHeight();
+ }
+ virtual void setPrimaryDimension(Size &rSize, long nHeight) const
+ {
+ rSize.setHeight(nHeight);
+ }
+ virtual long getPrimaryCoordinate(const Point &rPos) const
+ {
+ return rPos.getY();
+ }
+ virtual void setPrimaryCoordinate(Point &rPos, long nPos) const
+ {
+ rPos.setY(nPos);
+ }
+ virtual long getSecondaryDimension(const Size &rSize) const
+ {
+ return rSize.getWidth();
+ }
+ virtual void setSecondaryDimension(Size &rSize, long nWidth) const
+ {
+ rSize.setWidth(nWidth);
+ }
+ virtual long getSecondaryCoordinate(const Point &rPos) const
+ {
+ return rPos.getX();
+ }
+ virtual void setSecondaryCoordinate(Point &rPos, long nPos) const
+ {
+ rPos.setX(nPos);
+ }
+ virtual long getPrimaryDimensionBorders(sal_Int32, sal_Int32 nTopBorder,
+ sal_Int32, sal_Int32 nBottomBorder)
+ {
+ return nTopBorder + nBottomBorder;
+ }
+};
+
+class VCL_DLLPUBLIC HBox : public Box
+{
+protected:
+ virtual long getPrimaryDimension(const Size &rSize) const
+ {
+ return rSize.getWidth();
+ }
+ virtual void setPrimaryDimension(Size &rSize, long nWidth) const
+ {
+ rSize.setWidth(nWidth);
+ }
+ virtual long getPrimaryCoordinate(const Point &rPos) const
+ {
+ return rPos.getX();
+ }
+ virtual void setPrimaryCoordinate(Point &rPos, long nPos) const
+ {
+ rPos.setX(nPos);
+ }
+ virtual long getSecondaryDimension(const Size &rSize) const
+ {
+ return rSize.getHeight();
+ }
+ virtual void setSecondaryDimension(Size &rSize, long nHeight) const
+ {
+ rSize.setHeight(nHeight);
+ }
+ virtual long getSecondaryCoordinate(const Point &rPos) const
+ {
+ return rPos.getY();
+ }
+ virtual void setSecondaryCoordinate(Point &rPos, long nPos) const
+ {
+ rPos.setY(nPos);
+ }
+ virtual long getPrimaryDimensionBorders(sal_Int32 nLeftBorder, sal_Int32,
+ sal_Int32 nRightBorder, sal_Int32)
+ {
+ return nLeftBorder + nRightBorder;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 67349eed3742..6fd7eca3cd13 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -379,6 +379,11 @@ private:
//
WindowImpl* mpWindowImpl;
+ //^^^la la la, I can't hear you^^^
+ bool m_bExpand;
+ bool m_bFill;
+ long m_nPadding;
+
SAL_DLLPRIVATE void ImplInitWindowData( WindowType nType );
#ifdef DBG_UTIL
@@ -1057,6 +1062,14 @@ public:
// Advisory Sizing - what is a good size for this widget ?
virtual Size GetOptimalSize(WindowSizeType eType) const;
+ bool getExpand() const { return m_bExpand; }
+ bool getFill() const { return m_bFill; }
+ long getPadding() const { return m_nPadding; }
+ void setExpand(bool bExpand) { m_bExpand = bExpand; }
+ void setFill(bool bFill) { m_bFill = bFill; }
+ void setPadding(long nPadding) { m_nPadding = nPadding; }
+ void queueResize();
+
//-------------------------------------
// Native Widget Rendering functions