summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-07 15:11:02 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:48:24 +0100
commit94c960e4582846112dd6487cb17e1c64bab5e40b (patch)
treed2f2c4dac99f81b17d5e76aa94f4bb916563f5d1 /vcl
parent142e382e120bdcb5a8e6be0fb849a3c16a03b9c5 (diff)
Add GtkNotebook->TabControl import and update demo to use it
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/builder.hxx4
-rw-r--r--vcl/inc/vcl/layout.hxx2
-rw-r--r--vcl/qa/cppunit/builder/demo.ui476
-rw-r--r--vcl/source/window/builder.cxx148
-rw-r--r--vcl/source/window/layout.cxx15
5 files changed, 418 insertions, 227 deletions
diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 80b6536912c7..970801ad18ef 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -32,6 +32,7 @@
#include <vcl/window.hxx>
#include <xmlreader/xmlreader.hxx>
#include <map>
+#include <stack>
#include <vector>
class ListBox;
@@ -90,6 +91,8 @@ private:
ListStore *get_model_by_name(rtl::OString sID);
static void mungemodel(ListBox &rTarget, ListStore &rStore);
+ std::stack<rtl::OString> m_aParentTypes;
+
rtl::OString m_sID;
Window *m_pParent;
public:
@@ -117,6 +120,7 @@ private:
void collectProperty(xmlreader::XmlReader &reader, stringmap &rVec);
void handleListStore(xmlreader::XmlReader &reader, const rtl::OString &rID);
+ void handleTabChild(Window *pParent, xmlreader::XmlReader &reader);
//Helpers to retrofit all the existing code the the builder
static void swapGuts(Window &rOrig, Window &rReplacement);
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index e32a5098cf8f..b0fe34f09b60 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -375,6 +375,8 @@ public:
VclBin(Window *pParent) : VclContainer(pParent) {}
Window *get_child();
const Window *get_child() const;
+ virtual Size calculateRequisition() const;
+ virtual void setAllocation(const Size &rAllocation);
};
class VCL_DLLPUBLIC VclFrame : public VclBin
diff --git a/vcl/qa/cppunit/builder/demo.ui b/vcl/qa/cppunit/builder/demo.ui
index c8dc61812df8..2e1be0036147 100644
--- a/vcl/qa/cppunit/builder/demo.ui
+++ b/vcl/qa/cppunit/builder/demo.ui
@@ -17,6 +17,7 @@
<child>
<object class="GtkButton" id="button2">
<property name="label">Hello</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -31,6 +32,7 @@
<child>
<object class="GtkButton" id="button1">
<property name="label">World</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -51,29 +53,92 @@
</packing>
</child>
<child>
- <object class="GtkFrame" id="frame1">
+ <object class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
+ <property name="can_focus">True</property>
<child>
- <object class="GtkAlignment" id="alignment1">
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="left_padding">12</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="box1">
+ <object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <property name="homogeneous">True</property>
+ <property name="row_spacing">4</property>
+ <property name="column_spacing">2</property>
+ <property name="row_homogeneous">True</property>
+ <property name="column_homogeneous">True</property>
<child>
- <object class="GtkLabel" id="label2">
+ <object class="GtkLabel" id="labelfoo">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">left</property>
+ <property name="label" translatable="yes">cell 1.1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">cell 3.3</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">A label that spans three rows</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkSpinButton" id="spinbutton1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ <property name="numeric">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -82,11 +147,50 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label3">
+ <object class="GtkComboBox" id="combobox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">right</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="button4">
+ <property name="label" translatable="yes">EXPAND</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button5">
+ <property name="label" translatable="yes">FILL</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -94,249 +198,225 @@
<property name="position">1</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkLabel" id="label6">
+ <object class="GtkButton" id="button3">
+ <property name="label" translatable="yes">button</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">center</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="entry1">
+ <object class="GtkRadioButton" id="radiobutton1">
+ <property name="label" translatable="yes">radiobutton</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="text" translatable="yes">an edit control</property>
- <property name="invisible_char_set">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton1">
+ <property name="label" translatable="yes">checkbutton</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkBox" id="box2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">left</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">right</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">center</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="text" translatable="yes">an edit control</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Frame Label</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
</child>
</object>
</child>
- <child type="label">
- <object class="GtkLabel" id="label1">
+ <child type="tab">
+ <object class="GtkLabel" id="Tab1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Frame Label</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="button3">
- <property name="label" translatable="yes">button</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="radiobutton1">
- <property name="label" translatable="yes">radiobutton</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="label" translatable="yes">page 1</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="tab_fill">False</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkbutton1">
- <property name="label" translatable="yes">checkbutton</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="button4">
- <property name="label" translatable="yes">EXPAND</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <object class="GtkButton" id="button6">
+ <property name="label" translatable="yes">button</property>
<property name="use_action_appearance">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button5">
- <property name="label" translatable="yes">FILL</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkSpinButton" id="spinbutton1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
- <property name="numeric">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="combobox1">
+ <child type="tab">
+ <object class="GtkLabel" id="Tab2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 2</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">4</property>
- <property name="column_spacing">2</property>
- <property name="row_homogeneous">True</property>
- <property name="column_homogeneous">True</property>
- <child>
- <object class="GtkLabel" id="labelfoo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">cell 1.1</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="tab_fill">False</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label4">
+ <object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">cell 3.3</property>
+ <property name="label" translatable="yes">label</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="position">2</property>
</packing>
</child>
- <child>
- <object class="GtkLabel" id="label5">
+ <child type="tab">
+ <object class="GtkLabel" id="Tab3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">A label that spans three rows</property>
+ <property name="label" translatable="yes">page 3</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">3</property>
- <property name="height">1</property>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 963792b45812..f4541efed402 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -34,6 +34,8 @@
#include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
#include <window.h>
VclBuilder::VclBuilder(Window *pParent, rtl::OUString sUri, rtl::OString sID)
@@ -178,6 +180,26 @@ bool VclBuilder::extractModel(const rtl::OString &id, stringmap &rMap)
Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const rtl::OString &id, stringmap &rMap)
{
+ if (!m_aParentTypes.empty() && m_aParentTypes.top().equalsL(RTL_CONSTASCII_STRINGPARAM("GtkNotebook")))
+ {
+ //We have to add a page
+ TabControl *pTabControl = static_cast<TabControl*>(pParent);
+ TabPage* pPage = new TabPage(pTabControl);
+ m_aChildren.push_back(WinAndId(rtl::OString(), pPage));
+
+ //And give the page one container as a child to make it a layout enabled
+ //tab page
+ VclBin* pContainer = new VclBin(pPage);
+ m_aChildren.push_back(WinAndId(rtl::OString(), pContainer));
+ pParent = pContainer;
+
+ //keep it simple and make pageid == position
+ sal_uInt16 nNewPageId = pTabControl->GetPageCount()+1;
+ pTabControl->InsertPage(nNewPageId, rtl::OUString());
+ pTabControl->SetTabPage(nNewPageId, pPage);
+ pTabControl->SetCurPageId(nNewPageId);
+ }
+
Window *pWindow = NULL;
if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkDialog")))
pWindow = new Dialog(pParent, WB_SIZEMOVE|WB_3DLOOK|WB_CLOSEABLE);
@@ -220,12 +242,16 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkLabel")))
pWindow = new FixedText(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkEntry")))
- pWindow = new Edit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK );
+ pWindow = new Edit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK);
+ else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkNotebook")))
+ pWindow = new TabControl(pParent, WB_STDTABCONTROL|WB_3DLOOK);
else
fprintf(stderr, "TO-DO, implement %s\n", name.getStr());
if (pWindow)
{
fprintf(stderr, "for %s, created %p child of %p (%p/%p/%p)\n", name.getStr(), pWindow, pParent, pWindow->mpWindowImpl->mpParent, pWindow->mpWindowImpl->mpRealParent, pWindow->mpWindowImpl->mpBorderWindow);
+ m_aChildren.push_back(WinAndId(id, pWindow));
+ m_aParentTypes.push(name);
}
return pWindow;
}
@@ -246,8 +272,6 @@ Window *VclBuilder::insertObject(Window *pParent, const rtl::OString &rClass, co
pCurrentChild = makeObject(pParent, rClass, rID, rMap);
if (!pCurrentChild)
fprintf(stderr, "missing object!\n");
- else
- m_aChildren.push_back(WinAndId(rID, pCurrentChild));
}
if (pCurrentChild)
@@ -309,16 +333,69 @@ void VclBuilder::reorderWithinParent(Window &rWindow, sal_uInt16 nNewPosition)
rWindow.reorderWithinParent(nNewPosition);
}
-void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
+void VclBuilder::handleTabChild(Window *pParent, xmlreader::XmlReader &reader)
{
int nLevel = 1;
+ stringmap aProperties;
+ while(1)
+ {
+ xmlreader::Span name;
+ int nsId;
+
+ xmlreader::XmlReader::Result res = reader.nextItem(
+ xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
+
+ if (res == xmlreader::XmlReader::RESULT_BEGIN)
+ {
+ ++nLevel;
+ if (name.equals(RTL_CONSTASCII_STRINGPARAM("property")))
+ collectProperty(reader, aProperties);
+ }
+
+ if (res == xmlreader::XmlReader::RESULT_END)
+ --nLevel;
+
+ if (!nLevel)
+ break;
+
+ if (res == xmlreader::XmlReader::RESULT_DONE)
+ break;
+ }
+ VclBuilder::stringmap::iterator aFind = aProperties.find(rtl::OString(RTL_CONSTASCII_STRINGPARAM("label")));
+ if (aFind != aProperties.end())
+ {
+ TabControl *pTabControl = static_cast<TabControl*>(pParent);
+ pTabControl->SetPageText(pTabControl->GetCurPageId(), rtl::OStringToOUString(aFind->second, RTL_TEXTENCODING_UTF8));
+ }
+}
+
+void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
+{
Window *pCurrentChild = NULL;
+ xmlreader::Span name;
+ int nsId;
+ rtl::OString sType;
+
+ while (reader.nextAttribute(&nsId, &name))
+ {
+ if (name.equals(RTL_CONSTASCII_STRINGPARAM("type")))
+ {
+ name = reader.getAttributeValue(false);
+ sType = rtl::OString(name.begin, name.length);
+ }
+ }
+
+ if (sType.equalsL(RTL_CONSTASCII_STRINGPARAM("tab")))
+ {
+ handleTabChild(pParent, reader);
+ return;
+ }
+
+ int nLevel = 1;
while(1)
{
- xmlreader::Span name;
- int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
@@ -330,35 +407,50 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
if (pCurrentChild)
{
- rtl::OString sPosition(RTL_CONSTASCII_STRINGPARAM("position"));
- std::vector<Window*> aChilds;
- for (Window* pChild = pCurrentChild->GetWindow(WINDOW_FIRSTCHILD); pChild;
- pChild = pChild->GetWindow(WINDOW_NEXT))
+ //Select the first page if its a notebook
+ if (m_aParentTypes.top().equalsL(RTL_CONSTASCII_STRINGPARAM("GtkNotebook")))
{
- aChilds.push_back(pChild);
- }
+ TabControl *pTabControl = static_cast<TabControl*>(pCurrentChild);
+ pTabControl->SetCurPageId(1);
- for (size_t i = 0; i < aChilds.size(); ++i)
- {
- sal_uInt16 nPosition = aChilds[i]->getWidgetProperty<sal_uInt16>(sPosition, 0xFFFF);
- if (nPosition == 0xFFFF)
- continue;
- reorderWithinParent(*aChilds[i], nPosition);
+ //To-Do add reorder capability to the TabControl
}
+ else
+ {
+ //To-Do make reorder a virtual in Window, move this foo
+ //there and see above
+
+ rtl::OString sPosition(RTL_CONSTASCII_STRINGPARAM("position"));
+ std::vector<Window*> aChilds;
+ for (Window* pChild = pCurrentChild->GetWindow(WINDOW_FIRSTCHILD); pChild;
+ pChild = pChild->GetWindow(WINDOW_NEXT))
+ {
+ aChilds.push_back(pChild);
+ }
+
+ for (size_t i = 0; i < aChilds.size(); ++i)
+ {
+ sal_uInt16 nPosition = aChilds[i]->getWidgetProperty<sal_uInt16>(sPosition, 0xFFFF);
+ if (nPosition == 0xFFFF)
+ continue;
+ reorderWithinParent(*aChilds[i], nPosition);
+ }
#if TODO
//sort by ltr ttb
- rtl::OString sLeftAttach(RTL_CONSTASCII_STRINGPARAM("left-attach"));
- rtl::OString sTopAttach(RTL_CONSTASCII_STRINGPARAM("top-attach"));
- for (size_t i = 0; i < aChilds.size(); ++i)
- {
- sal_uInt16 nPosition = aChilds[i]->getWidgetProperty<sal_uInt16>(sPosition, 0xFFFF);
- if (nPosition == 0xFFFF)
- continue;
- reorderWithinParent(*aChilds[i], nPosition);
- }
+ rtl::OString sLeftAttach(RTL_CONSTASCII_STRINGPARAM("left-attach"));
+ rtl::OString sTopAttach(RTL_CONSTASCII_STRINGPARAM("top-attach"));
+ for (size_t i = 0; i < aChilds.size(); ++i)
+ {
+ sal_uInt16 nPosition = aChilds[i]->getWidgetProperty<sal_uInt16>(sPosition, 0xFFFF);
+ if (nPosition == 0xFFFF)
+ continue;
+ reorderWithinParent(*aChilds[i], nPosition);
+ }
#endif
+ }
+ m_aParentTypes.pop();
}
}
else if (name.equals(RTL_CONSTASCII_STRINGPARAM("packing")))
@@ -370,9 +462,7 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
}
if (res == xmlreader::XmlReader::RESULT_END)
- {
--nLevel;
- }
if (!nLevel)
break;
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index e6cf87ed654f..cfce7322bba1 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -571,6 +571,21 @@ Window *VclBin::get_child()
return const_cast<Window*>(const_cast<const VclBin*>(this)->get_child());
}
+Size VclBin::calculateRequisition() const
+{
+ const Window *pChild = get_child();
+ if (pChild && pChild->IsVisible())
+ return pChild->GetOptimalSize(WINDOWSIZE_PREFERRED);
+ return Size(0, 0);
+}
+
+void VclBin::setAllocation(const Size &rAllocation)
+{
+ Window *pChild = get_child();
+ if (pChild && pChild->IsVisible())
+ pChild->SetPosSizePixel(Point(0, 0), rAllocation);
+}
+
//To-Do, hook a DecorationView into VclFrame ?
Size VclFrame::calculateRequisition() const