diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-07-03 14:06:50 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2012-07-03 16:03:31 -0430 |
commit | 9f55545a1a1d96e133eb734607ef52a463a0f0ea (patch) | |
tree | 371672d0e575c6336d932d6c032dbfabd3ac04d1 /sfx2/source/dialog/inputdlg.cxx | |
parent | ff1ba1fc3c45b7449e2f4fe3c46a1d4c134a7092 (diff) |
Create dialog skeleton to ask user for new folder name.
Change-Id: I5f861753c7b4d0e901c8268f4004676df7da124f
Diffstat (limited to 'sfx2/source/dialog/inputdlg.cxx')
-rw-r--r-- | sfx2/source/dialog/inputdlg.cxx | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx new file mode 100644 index 000000000000..41d5d4f48635 --- /dev/null +++ b/sfx2/source/dialog/inputdlg.cxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * 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.hxx" + +#include <vcl/button.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> + +#define LABEL_TEXT_SPACE 10 +#define DIALOG_BORDER 10 +#define MAX_FOLDER_NAME_LENGTH 20 + +InputDialog::InputDialog (const rtl::OUString &rLabelText, Window *pParent) + : ModalDialog(pParent), + mpEntry(new Edit(this)), + mpLabel(new FixedText(this)) +{ + SetStyle(GetStyle() | WB_CENTER | WB_VCENTER); + + Point aPos(DIALOG_BORDER,DIALOG_BORDER); + + Size aTextSize = mpLabel->CalcMinimumTextSize(mpLabel,100); + Size aEntrySize = mpEntry->CalcSize(MAX_FOLDER_NAME_LENGTH); + + aTextSize.setWidth(aEntrySize.getHeight()); + + mpLabel->SetPosPixel(Point(DIALOG_BORDER,DIALOG_BORDER)); + mpLabel->SetSizePixel(aTextSize); + mpLabel->SetText(String("Enter name")); + + aPos.setX(DIALOG_BORDER + aTextSize.getWidth() + LABEL_TEXT_SPACE + DIALOG_BORDER); + + mpEntry->SetPosPixel(aPos); + mpEntry->SetSizePixel(aEntrySize); + + // Set windows correct size + SetSizePixel(Size(aTextSize.getWidth() + aEntrySize.getWidth() + 2*DIALOG_BORDER, + aTextSize.getHeight()+2*DIALOG_BORDER)); + + mpEntry->Show(); + mpLabel->Show(); +} + +rtl::OUString InputDialog::getEntryText () const +{ + return mpEntry->GetText(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + + |