convert input dialog to .ui
Change-Id: I7b4dc43bfed39c852692dabebfc1bd196625c333
This commit is contained in:
@@ -45,7 +45,6 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\
|
|||||||
sfx2/source/dialog/dialog.src \
|
sfx2/source/dialog/dialog.src \
|
||||||
sfx2/source/dialog/dinfdlg.src \
|
sfx2/source/dialog/dinfdlg.src \
|
||||||
sfx2/source/dialog/filedlghelper.src \
|
sfx2/source/dialog/filedlghelper.src \
|
||||||
sfx2/source/dialog/inputdlg.src \
|
|
||||||
sfx2/source/dialog/newstyle.src \
|
sfx2/source/dialog/newstyle.src \
|
||||||
sfx2/source/dialog/recfloat.src \
|
sfx2/source/dialog/recfloat.src \
|
||||||
sfx2/source/dialog/taskpane.src \
|
sfx2/source/dialog/taskpane.src \
|
||||||
|
@@ -19,6 +19,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
|
|||||||
sfx2/uiconfig/ui/documentinfopage \
|
sfx2/uiconfig/ui/documentinfopage \
|
||||||
sfx2/uiconfig/ui/documentpropertiesdialog \
|
sfx2/uiconfig/ui/documentpropertiesdialog \
|
||||||
sfx2/uiconfig/ui/errorfindemaildialog \
|
sfx2/uiconfig/ui/errorfindemaildialog \
|
||||||
|
sfx2/uiconfig/ui/inputdialog \
|
||||||
sfx2/uiconfig/ui/licensedialog \
|
sfx2/uiconfig/ui/licensedialog \
|
||||||
sfx2/uiconfig/ui/managestylepage \
|
sfx2/uiconfig/ui/managestylepage \
|
||||||
sfx2/uiconfig/ui/newstyle \
|
sfx2/uiconfig/ui/newstyle \
|
||||||
|
@@ -9,73 +9,31 @@
|
|||||||
|
|
||||||
#include "inputdlg.hxx"
|
#include "inputdlg.hxx"
|
||||||
|
|
||||||
#include "inputdlg.hrc"
|
|
||||||
|
|
||||||
#include <sfx2/sfxresid.hxx>
|
#include <sfx2/sfxresid.hxx>
|
||||||
#include <vcl/button.hxx>
|
#include <vcl/button.hxx>
|
||||||
#include <vcl/edit.hxx>
|
#include <vcl/edit.hxx>
|
||||||
#include <vcl/fixed.hxx>
|
#include <vcl/fixed.hxx>
|
||||||
|
|
||||||
#define LABEL_TEXT_SPACE 5
|
InputDialog::InputDialog(const OUString &rLabelText, Window *pParent)
|
||||||
|
: ModalDialog(pParent, "InputDialog", "sfx/ui/inputdialog.ui")
|
||||||
InputDialog::InputDialog (const OUString &rLabelText, Window *pParent)
|
|
||||||
: ModalDialog(pParent,SfxResId(DLG_INPUT_BOX)),
|
|
||||||
mpEntry(new Edit(this,SfxResId(EDT_INPUT_FIELD))),
|
|
||||||
mpLabel(new FixedText(this,SfxResId(LABEL_INPUT_TEXT))),
|
|
||||||
mpOK(new PushButton(this,SfxResId(BTN_INPUT_OK))),
|
|
||||||
mpCancel(new PushButton(this,SfxResId(BTN_INPUT_CANCEL)))
|
|
||||||
{
|
{
|
||||||
SetStyle(GetStyle() | WB_CENTER | WB_VCENTER);
|
get(m_pEntry, "entry");
|
||||||
|
get(m_pLabel, "label");
|
||||||
mpLabel->SetText(rLabelText);
|
get(m_pOK, "ok");
|
||||||
|
get(m_pCancel, "cancel");
|
||||||
// Fit label size to text and reposition edit box
|
m_pLabel->SetText(rLabelText);
|
||||||
Size aLabelSize = mpLabel->CalcMinimumSize();
|
m_pOK->SetClickHdl(LINK(this,InputDialog,ClickHdl));
|
||||||
Size aEditSize = mpEntry->GetSizePixel();
|
m_pCancel->SetClickHdl(LINK(this,InputDialog,ClickHdl));
|
||||||
Size aBtnSize = mpOK->GetSizePixel();
|
|
||||||
|
|
||||||
Point aLabelPos = mpLabel->GetPosPixel();
|
|
||||||
Point aEditPos = mpEntry->GetPosPixel();
|
|
||||||
|
|
||||||
aEditPos.setX(aLabelPos.getX() + aLabelSize.getWidth() + LABEL_TEXT_SPACE);
|
|
||||||
|
|
||||||
mpLabel->SetPosSizePixel(aLabelPos,aLabelSize);
|
|
||||||
mpEntry->SetPosSizePixel(aEditPos,aEditSize);
|
|
||||||
|
|
||||||
// Resize window if needed
|
|
||||||
Size aWinSize = GetOutputSize();
|
|
||||||
aWinSize.setWidth(aEditPos.getX() + aEditSize.getWidth() + LABEL_TEXT_SPACE);
|
|
||||||
SetSizePixel(aWinSize);
|
|
||||||
|
|
||||||
// Align buttons
|
|
||||||
Point aBtnPos = mpCancel->GetPosPixel();
|
|
||||||
|
|
||||||
aBtnPos.setX(aWinSize.getWidth() - aBtnSize.getWidth() - LABEL_TEXT_SPACE);
|
|
||||||
mpCancel->SetPosPixel(aBtnPos);
|
|
||||||
|
|
||||||
aBtnPos.setX(aBtnPos.getX() - aBtnSize.getWidth() - LABEL_TEXT_SPACE);
|
|
||||||
mpOK->SetPosPixel(aBtnPos);
|
|
||||||
|
|
||||||
mpOK->SetClickHdl(LINK(this,InputDialog,ClickHdl));
|
|
||||||
mpCancel->SetClickHdl(LINK(this,InputDialog,ClickHdl));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InputDialog::~InputDialog()
|
OUString InputDialog::getEntryText() const
|
||||||
{
|
{
|
||||||
delete mpEntry;
|
return m_pEntry->GetText();
|
||||||
delete mpLabel;
|
|
||||||
delete mpOK;
|
|
||||||
delete mpCancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
OUString InputDialog::getEntryText () const
|
|
||||||
{
|
|
||||||
return mpEntry->GetText();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_LINK(InputDialog,ClickHdl,PushButton*, pButton)
|
IMPL_LINK(InputDialog,ClickHdl,PushButton*, pButton)
|
||||||
{
|
{
|
||||||
EndDialog(pButton == mpOK ? true : false);
|
EndDialog(pButton == m_pOK ? true : false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* This file is part of the LibreOffice project.
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DLG_INPUT_BOX 256
|
|
||||||
#define LABEL_INPUT_TEXT 2
|
|
||||||
#define EDT_INPUT_FIELD 3
|
|
||||||
#define BTN_INPUT_OK 4
|
|
||||||
#define BTN_INPUT_CANCEL 5
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@@ -1,51 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* This file is part of the LibreOffice project.
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "inputdlg.hrc"
|
|
||||||
|
|
||||||
ModalDialog DLG_INPUT_BOX
|
|
||||||
{
|
|
||||||
OutputSize = TRUE;
|
|
||||||
SVLook = TRUE;
|
|
||||||
Moveable = TRUE;
|
|
||||||
Closeable = TRUE;
|
|
||||||
Size = MAP_APPFONT ( 215, 40 );
|
|
||||||
|
|
||||||
FixedText LABEL_INPUT_TEXT
|
|
||||||
{
|
|
||||||
Pos = MAP_APPFONT(5,6);
|
|
||||||
Size = MAP_APPFONT(80,10);
|
|
||||||
};
|
|
||||||
|
|
||||||
Edit EDT_INPUT_FIELD
|
|
||||||
{
|
|
||||||
Border = TRUE;
|
|
||||||
Pos = MAP_APPFONT(90,5);
|
|
||||||
Size = MAP_APPFONT(120,10);
|
|
||||||
};
|
|
||||||
|
|
||||||
PushButton BTN_INPUT_OK
|
|
||||||
{
|
|
||||||
Pos = MAP_APPFONT(125,20);
|
|
||||||
Size = MAP_APPFONT(40,15);
|
|
||||||
TabStop = TRUE;
|
|
||||||
DefButton = TRUE;
|
|
||||||
Text [en-US] = "OK";
|
|
||||||
};
|
|
||||||
|
|
||||||
PushButton BTN_INPUT_CANCEL
|
|
||||||
{
|
|
||||||
Pos = MAP_APPFONT(170,20);
|
|
||||||
Size = MAP_APPFONT(40,15);
|
|
||||||
TabStop = TRUE;
|
|
||||||
Text [en-US] = "Cancel";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@@ -19,11 +19,7 @@ class PushButton;
|
|||||||
class InputDialog : public ModalDialog
|
class InputDialog : public ModalDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
InputDialog (const OUString &labelText, Window *pParent = NULL);
|
InputDialog (const OUString &labelText, Window *pParent = NULL);
|
||||||
|
|
||||||
virtual ~InputDialog();
|
|
||||||
|
|
||||||
OUString getEntryText () const;
|
OUString getEntryText () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -32,10 +28,10 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Edit *mpEntry;
|
Edit *m_pEntry;
|
||||||
FixedText *mpLabel;
|
FixedText *m_pLabel;
|
||||||
PushButton *mpOK;
|
PushButton *m_pOK;
|
||||||
PushButton *mpCancel;
|
PushButton *m_pCancel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
|
#endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
|
||||||
|
108
sfx2/uiconfig/ui/inputdialog.ui
Normal file
108
sfx2/uiconfig/ui/inputdialog.ui
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
|
<object class="GtkDialog" id="InputDialog">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="border_width">6</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox" id="dialog-vbox1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="ok">
|
||||||
|
<property name="label">gtk-ok</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="can_default">True</property>
|
||||||
|
<property name="has_default">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="cancel">
|
||||||
|
<property name="label">gtk-cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</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="pack_type">end</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="valign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="row_spacing">6</property>
|
||||||
|
<property name="column_spacing">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="label" translatable="yes">Height</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="mnemonic_widget">entry</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="GtkEntry" id="entry">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="invisible_char">•</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="width">1</property>
|
||||||
|
<property name="height">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<action-widgets>
|
||||||
|
<action-widget response="0">ok</action-widget>
|
||||||
|
<action-widget response="0">cancel</action-widget>
|
||||||
|
</action-widgets>
|
||||||
|
</object>
|
||||||
|
</interface>
|
Reference in New Issue
Block a user