summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/control/button.cxx96
-rw-r--r--vcl/source/control/ctrl.cxx25
-rw-r--r--vcl/source/control/edit.cxx45
-rw-r--r--vcl/source/control/field.cxx32
-rw-r--r--vcl/source/control/fixed.cxx16
-rw-r--r--vcl/source/control/lstbox.cxx20
-rw-r--r--vcl/source/control/spinfld.cxx40
-rw-r--r--vcl/source/window/builder.cxx4
-rw-r--r--vcl/source/window/dialog.cxx2
-rw-r--r--vcl/source/window/window.cxx2
10 files changed, 194 insertions, 88 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 2028bf6eb02a..8721cbd988d8 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1220,6 +1220,17 @@ PushButton::PushButton( Window* pParent, const ResId& rResId ) :
Show();
}
+void PushButton::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ {
+ ImplInitPushButtonData();
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ }
+
+ Button::take_properties(rOther);
+}
+
// -----------------------------------------------------------------------
PushButton::~PushButton()
@@ -1763,6 +1774,13 @@ OKButton::OKButton( Window* pParent, const ResId& rResId ) :
Show();
}
+void OKButton::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ PushButton::take_properties(rOther);
+}
+
// -----------------------------------------------------------------------
void OKButton::Click()
@@ -1833,6 +1851,13 @@ CancelButton::CancelButton( Window* pParent, const ResId& rResId ) :
Show();
}
+void CancelButton::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ PushButton::take_properties(rOther);
+}
+
// -----------------------------------------------------------------------
void CancelButton::Click()
@@ -1903,6 +1928,13 @@ HelpButton::HelpButton( Window* pParent, const ResId& rResId ) :
Show();
}
+void HelpButton::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ PushButton::take_properties(rOther);
+}
+
// -----------------------------------------------------------------------
void HelpButton::Click()
@@ -2456,6 +2488,29 @@ RadioButton::RadioButton( Window* pParent, const ResId& rResId ) :
Show();
}
+void RadioButton::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ {
+ ImplInitRadioButtonData();
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ }
+
+ Button::take_properties(rOther);
+
+ RadioButton &rOtherRadio = static_cast<RadioButton&>(rOther);
+ if (rOtherRadio.m_xGroup.get())
+ {
+ rOtherRadio.m_xGroup->erase(&rOtherRadio);
+ rOtherRadio.m_xGroup->insert(this);
+ }
+ std::swap(m_xGroup, rOtherRadio.m_xGroup);
+ mbChecked = rOtherRadio.mbChecked;
+ mbSaveValue = rOtherRadio.mbSaveValue;
+ mbRadioCheck = rOtherRadio.mbRadioCheck;
+ mbStateChanged = rOtherRadio.mbStateChanged;
+}
+
// -----------------------------------------------------------------------
void RadioButton::ImplLoadRes( const ResId& rResId )
@@ -2831,22 +2886,6 @@ void RadioButton::SetState( sal_Bool bCheck )
}
}
-void RadioButton::take_properties(Window &rOther)
-{
- RadioButton &rOtherRadio = static_cast<RadioButton&>(rOther);
- if (rOtherRadio.m_xGroup.get())
- {
- rOtherRadio.m_xGroup->erase(&rOtherRadio);
- rOtherRadio.m_xGroup->insert(this);
- }
- std::swap(m_xGroup, rOtherRadio.m_xGroup);
- mbChecked = rOtherRadio.mbChecked;
- mbSaveValue = rOtherRadio.mbSaveValue;
- mbRadioCheck = rOtherRadio.mbRadioCheck;
- mbStateChanged = rOtherRadio.mbStateChanged;
- Button::take_properties(rOther);
-}
-
bool RadioButton::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
{
if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("active")))
@@ -3419,6 +3458,22 @@ CheckBox::CheckBox( Window* pParent, const ResId& rResId ) :
Show();
}
+void CheckBox::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ {
+ ImplInitCheckBoxData();
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ }
+
+ Button::take_properties(rOther);
+
+ CheckBox &rOtherCheck = static_cast<CheckBox&>(rOther);
+ meState = rOtherCheck.meState;
+ meSaveValue = rOtherCheck.meSaveValue;
+ mbTriState = rOtherCheck.mbTriState;
+}
+
// -----------------------------------------------------------------------
void CheckBox::MouseButtonDown( const MouseEvent& rMEvt )
@@ -3803,15 +3858,6 @@ void CheckBox::SetState( TriState eState )
}
}
-void CheckBox::take_properties(Window &rOther)
-{
- CheckBox &rOtherCheck = static_cast<CheckBox&>(rOther);
- meState = rOtherCheck.meState;
- meSaveValue = rOtherCheck.meSaveValue;
- mbTriState = rOtherCheck.mbTriState;
- Button::take_properties(rOther);
-}
-
bool CheckBox::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
{
if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("active")))
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 3d7ac2172e91..537d85636aec 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -65,15 +65,7 @@ Control::Control( Window* pParent, WinBits nStyle ) :
Window( WINDOW_CONTROL )
{
ImplInitControlData();
- Window::ImplInit( pParent, nStyle, NULL );
-}
-
-void Control::take_properties(Window &rOther)
-{
- Control &rOtherControl = static_cast<Control&>(rOther);
- std::swap(mpControlData, rOtherControl.mpControlData);
- mbHasFocus = rOtherControl.mbHasFocus;
- Window::take_properties(rOther);
+ ImplInit( pParent, nStyle, NULL );
}
Control::Control( Window* pParent, const ResId& rResId ) :
@@ -89,6 +81,21 @@ Control::Control( Window* pParent, const ResId& rResId ) :
Show();
}
+void Control::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ {
+ ImplInitControlData();
+ ImplInit(rOther.GetParent(), rOther.GetStyle(), NULL);
+ }
+
+ Window::take_properties(rOther);
+
+ Control &rOtherControl = static_cast<Control&>(rOther);
+ std::swap(mpControlData, rOtherControl.mpControlData);
+ mbHasFocus = rOtherControl.mbHasFocus;
+}
+
// -----------------------------------------------------------------------
Control::~Control()
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 8365dc8a8c98..fbe4d6d38604 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -200,8 +200,34 @@ Edit::Edit( Window* pParent, WinBits nStyle ) :
ImplInit( pParent, nStyle );
}
+Edit::Edit( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_EDIT )
+{
+ if (Dialog::replace_buildable(pParent, rResId.GetId(), *this))
+ return;
+
+ ImplInitEditData();
+ rResId.SetRT( RSC_EDIT );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ // Derived MultiLineEdit takes care to call Show only after MultiLineEdit
+ // ctor has already started:
+ if ( !(nStyle & WB_HIDE) && rResId.GetRT() != RSC_MULTILINEEDIT )
+ Show();
+}
+
void Edit::take_properties(Window &rOther)
{
+ if (!GetParent())
+ {
+ ImplInitEditData();
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ }
+
+ Control::take_properties(rOther);
+
Edit &rOtherEdit = static_cast<Edit&>(rOther);
maText = rOtherEdit.maText;
maSaveValue = rOtherEdit.maSaveValue;
@@ -221,25 +247,6 @@ void Edit::take_properties(Window &rOther)
mbIsSubEdit = rOtherEdit.mbIsSubEdit;
mbInMBDown = rOtherEdit.mbInMBDown;
mbActivePopup = rOtherEdit.mbActivePopup;
- Control::take_properties(rOther);
-}
-
-Edit::Edit( Window* pParent, const ResId& rResId ) :
- Control( WINDOW_EDIT )
-{
- if (Dialog::replace_buildable(pParent, rResId.GetId(), *this))
- return;
-
- ImplInitEditData();
- rResId.SetRT( RSC_EDIT );
- WinBits nStyle = ImplInitRes( rResId );
- ImplInit( pParent, nStyle );
- ImplLoadRes( rResId );
-
- // Derived MultiLineEdit takes care to call Show only after MultiLineEdit
- // ctor has already started:
- if ( !(nStyle & WB_HIDE) && rResId.GetRT() != RSC_MULTILINEEDIT )
- Show();
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index fbf7f39665dd..10e94020debe 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1657,10 +1657,7 @@ MetricField::MetricField( Window* pParent, const ResId& rResId ) :
SpinField( WINDOW_METRICFIELD )
{
if (Dialog::replace_buildable(pParent, rResId.GetId(), *this))
- {
- SetField( this );
return;
- }
rResId.SetRT( RSC_METRICFIELD );
WinBits nStyle = ImplInitRes( rResId ) ;
@@ -1672,28 +1669,33 @@ MetricField::MetricField( Window* pParent, const ResId& rResId ) :
Show();
}
-bool MetricField::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
+void MetricField::take_properties(Window &rOther)
{
- if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("format")))
+ if (!GetParent())
{
- maCustomUnitText = rtl::OStringToOUString(rValue, RTL_TEXTENCODING_UTF8);
- meUnit = FUNIT_CUSTOM;
+ SpinField::ImplInit(rOther.GetParent(), rOther.GetStyle());
+ SetField( this );
}
- else
- return SpinField::set_property(rKey, rValue);
- return true;
-}
-void MetricField::take_properties(Window &rOther)
-{
- MetricField &rOtherField = static_cast<MetricField&>(rOther);
+ SpinField::take_properties(rOther);
+ MetricField &rOtherField = static_cast<MetricField&>(rOther);
maCustomUnitText = rOtherField.maCustomUnitText;
maCurUnitText = rOtherField.maCurUnitText;
mnBaseValue = rOtherField.mnBaseValue;
meUnit = rOtherField.meUnit;
+}
- SpinField::take_properties(rOther);
+bool MetricField::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
+{
+ if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("format")))
+ {
+ maCustomUnitText = rtl::OStringToOUString(rValue, RTL_TEXTENCODING_UTF8);
+ meUnit = FUNIT_CUSTOM;
+ }
+ else
+ return SpinField::set_property(rKey, rValue);
+ return true;
}
void MetricField::ImplLoadRes( const ResId& rResId )
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index a95df76cb59f..2e05a6f6acc0 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -177,6 +177,14 @@ FixedText::FixedText( Window* pParent, const ResId& rResId ) :
Show();
}
+void FixedText::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+
+ Control::take_properties(rOther);
+}
+
// -----------------------------------------------------------------------
FixedText::FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessibleLabelForRelation ) :
@@ -596,6 +604,14 @@ FixedLine::FixedLine( Window* pParent, const ResId& rResId ) :
Show();
}
+void FixedLine::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+
+ Control::take_properties(rOther);
+}
+
// -----------------------------------------------------------------------
void FixedLine::FillLayoutData() const
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 649103d79c29..30cafc7424b1 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -74,12 +74,32 @@ ListBox::ListBox( Window* pParent, const ResId& rResId ) :
rResId.SetRT( RSC_LISTBOX );
WinBits nStyle = ImplInitRes( rResId );
ImplInit( pParent, nStyle );
+
ImplLoadRes( rResId );
if ( !(nStyle & WB_HIDE ) )
Show();
}
+void ListBox::take_properties(Window &rOther)
+{
+ if (!GetParent())
+ {
+ ImplInitListBoxData();
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ }
+
+ Control::take_properties(rOther);
+
+ fprintf(stderr, "ListBox::take_properties\n");
+ ListBox &rOtherListBox = static_cast<ListBox&>(rOther);
+ mnDDHeight = rOtherListBox.mnDDHeight;
+ mnSaveValue = rOtherListBox.mnSaveValue;
+ mbDDAutoSize = rOtherListBox.mbDDAutoSize;
+ mnLineCount = rOtherListBox.mnLineCount;
+ fprintf(stderr, "ListBox::take_properties %p %d\n", this, IsVisible());
+}
+
// -----------------------------------------------------------------------
ListBox::~ListBox()
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 5570ae8f2309..9487d2ff76a2 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -352,14 +352,34 @@ SpinField::SpinField( Window* pParent, WinBits nWinStyle ) :
ImplInit( pParent, nWinStyle );
}
+SpinField::SpinField( Window* pParent, const ResId& rResId ) :
+ Edit( WINDOW_SPINFIELD )
+{
+ ImplInitSpinFieldData();
+ rResId.SetRT( RSC_SPINFIELD );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
void SpinField::take_properties(Window &rOther)
{
fprintf(stderr, "SpinField::take_properties\n");
+ if (!GetParent())
+ {
+ ImplInitSpinFieldData();
+ ImplInit(rOther.GetParent(), rOther.GetStyle());
+ }
+
+ Edit::take_properties(rOther);
+
SpinField &rOtherField = static_cast<SpinField&>(rOther);
- assert(!mpEdit && rOther.mpEdit);
- mpEdit = new Edit(this, WB_NOBORDER);
- SetSubEdit(mpEdit);
+ assert(mpEdit && rOther.mpEdit);
mpEdit->take_properties(*rOtherField.mpEdit);
+
maUpperRect = rOtherField.maUpperRect;
maLowerRect = rOtherField.maLowerRect;
maDropDownRect = rOtherField.maDropDownRect;
@@ -371,24 +391,10 @@ void SpinField::take_properties(Window &rOther)
mbUpperIn = rOtherField.mbUpperIn;
mbLowerIn = rOtherField.mbLowerIn;
mbInDropDown = rOtherField.mbInDropDown;
-
- Edit::take_properties(rOther);
-
fprintf(stderr, "SpinField::take_properties %p %d\n", this, IsVisible());
}
-SpinField::SpinField( Window* pParent, const ResId& rResId ) :
- Edit( WINDOW_SPINFIELD )
-{
- ImplInitSpinFieldData();
- rResId.SetRT( RSC_SPINFIELD );
- WinBits nStyle = ImplInitRes( rResId );
- ImplInit( pParent, nStyle );
- ImplLoadRes( rResId );
- if ( !(nStyle & WB_HIDE) )
- Show();
-}
// --------------------------------------------------------------------
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 98e008700f36..66e182917529 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -182,7 +182,7 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkSpinButton")))
pWindow = new MetricField(pParent, WB_RIGHT|WB_SPIN|WB_BORDER|WB_3DLOOK);
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkComboBox")))
- pWindow = new ListBox(pParent, WB_DROPDOWN|WB_CENTER|WB_VCENTER|WB_3DLOOK);
+ pWindow = new ListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK);
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")))
@@ -548,8 +548,6 @@ void VclBuilder::swapGuts(Window &rOrig, Window &rReplacement)
sal_uInt16 nPosition = getPositionWithinParent(rOrig);
- rReplacement.ImplInit(rOrig.mpWindowImpl->mpRealParent, rOrig.GetStyle(), NULL);
-
if (rReplacement.mpWindowImpl->mpBorderWindow)
fprintf(stderr, "problem two\n");
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 65d2a025dd22..d95d52b0166f 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1175,6 +1175,8 @@ bool Dialog::replace_buildable(Window *pParent, sal_Int32 nID, Window &rReplacem
rReplacement.ImplInit(pActionArea, 0, NULL);
rReplacement.Hide();
}
+ else
+ fprintf(stderr, "%d found\n", nID);
assert(rReplacement.mpWindowImpl);
return true;
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 256e71743ab6..8538512b0165 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -9684,6 +9684,8 @@ Size Window::get_preferred_size() const
void Window::take_properties(Window &rOther)
{
WindowImpl *pWindowImpl = rOther.mpWindowImpl;
+ if (!mpWindowImpl->mpRealParent)
+ ImplInit(pWindowImpl->mpRealParent, rOther.GetStyle(), NULL);
std::swap(mpWindowImpl->mpUserData, pWindowImpl->mpUserData);
std::swap(mpWindowImpl->mpExtImpl, pWindowImpl->mpExtImpl);
std::swap(mpWindowImpl->mpCursor, pWindowImpl->mpCursor);