diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-12-20 20:29:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-12-20 20:44:34 +0000 |
commit | 23ac39f99f270261ddad1749f656420766a47c97 (patch) | |
tree | 464f319821d60d47110af52c63aa8573b1493522 /sfx2 | |
parent | 3d26d9388ae12cc18008511c0bfcc60e9769cc3d (diff) |
convert input dialog to .ui
Change-Id: I7b4dc43bfed39c852692dabebfc1bd196625c333
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/AllLangResTarget_sfx2.mk | 1 | ||||
-rw-r--r-- | sfx2/UIConfig_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/dialog/inputdlg.cxx | 66 | ||||
-rw-r--r-- | sfx2/source/dialog/inputdlg.hrc | 16 | ||||
-rw-r--r-- | sfx2/source/dialog/inputdlg.src | 51 | ||||
-rw-r--r-- | sfx2/source/inc/inputdlg.hxx | 12 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/inputdialog.ui | 108 |
7 files changed, 125 insertions, 130 deletions
diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk index 8b3e6a25c6b8..04848718b0dc 100644 --- a/sfx2/AllLangResTarget_sfx2.mk +++ b/sfx2/AllLangResTarget_sfx2.mk @@ -45,7 +45,6 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\ sfx2/source/dialog/dialog.src \ sfx2/source/dialog/dinfdlg.src \ sfx2/source/dialog/filedlghelper.src \ - sfx2/source/dialog/inputdlg.src \ sfx2/source/dialog/newstyle.src \ sfx2/source/dialog/recfloat.src \ sfx2/source/dialog/taskpane.src \ diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index c3896968c603..35b0825b91b9 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -19,6 +19,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/documentinfopage \ sfx2/uiconfig/ui/documentpropertiesdialog \ sfx2/uiconfig/ui/errorfindemaildialog \ + sfx2/uiconfig/ui/inputdialog \ sfx2/uiconfig/ui/licensedialog \ sfx2/uiconfig/ui/managestylepage \ sfx2/uiconfig/ui/newstyle \ diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx index 9a10733bf3b8..b67f3897fd20 100644 --- a/sfx2/source/dialog/inputdlg.cxx +++ b/sfx2/source/dialog/inputdlg.cxx @@ -9,73 +9,31 @@ #include "inputdlg.hxx" -#include "inputdlg.hrc" - #include <sfx2/sfxresid.hxx> #include <vcl/button.hxx> #include <vcl/edit.hxx> #include <vcl/fixed.hxx> -#define LABEL_TEXT_SPACE 5 - -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); - - mpLabel->SetText(rLabelText); - - // Fit label size to text and reposition edit box - Size aLabelSize = mpLabel->CalcMinimumSize(); - Size aEditSize = mpEntry->GetSizePixel(); - 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() +InputDialog::InputDialog(const OUString &rLabelText, Window *pParent) + : ModalDialog(pParent, "InputDialog", "sfx/ui/inputdialog.ui") { - delete mpEntry; - delete mpLabel; - delete mpOK; - delete mpCancel; + get(m_pEntry, "entry"); + get(m_pLabel, "label"); + get(m_pOK, "ok"); + get(m_pCancel, "cancel"); + m_pLabel->SetText(rLabelText); + m_pOK->SetClickHdl(LINK(this,InputDialog,ClickHdl)); + m_pCancel->SetClickHdl(LINK(this,InputDialog,ClickHdl)); } -OUString InputDialog::getEntryText () const +OUString InputDialog::getEntryText() const { - return mpEntry->GetText(); + return m_pEntry->GetText(); } IMPL_LINK(InputDialog,ClickHdl,PushButton*, pButton) { - EndDialog(pButton == mpOK ? true : false); + EndDialog(pButton == m_pOK ? true : false); return 0; } diff --git a/sfx2/source/dialog/inputdlg.hrc b/sfx2/source/dialog/inputdlg.hrc deleted file mode 100644 index 2750d799746d..000000000000 --- a/sfx2/source/dialog/inputdlg.hrc +++ /dev/null @@ -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: */ diff --git a/sfx2/source/dialog/inputdlg.src b/sfx2/source/dialog/inputdlg.src deleted file mode 100644 index cf7e3ecf8405..000000000000 --- a/sfx2/source/dialog/inputdlg.src +++ /dev/null @@ -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: */ diff --git a/sfx2/source/inc/inputdlg.hxx b/sfx2/source/inc/inputdlg.hxx index 932fc3da50d0..c91b36cfe735 100644 --- a/sfx2/source/inc/inputdlg.hxx +++ b/sfx2/source/inc/inputdlg.hxx @@ -19,11 +19,7 @@ class PushButton; class InputDialog : public ModalDialog { public: - InputDialog (const OUString &labelText, Window *pParent = NULL); - - virtual ~InputDialog(); - OUString getEntryText () const; private: @@ -32,10 +28,10 @@ private: private: - Edit *mpEntry; - FixedText *mpLabel; - PushButton *mpOK; - PushButton *mpCancel; + Edit *m_pEntry; + FixedText *m_pLabel; + PushButton *m_pOK; + PushButton *m_pCancel; }; #endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX diff --git a/sfx2/uiconfig/ui/inputdialog.ui b/sfx2/uiconfig/ui/inputdialog.ui new file mode 100644 index 000000000000..9085b4c833ca --- /dev/null +++ b/sfx2/uiconfig/ui/inputdialog.ui @@ -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> |