Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / inc / FieldControls.hxx
blob7eb88ec4e0776f657f7ddd1f49c7c542d8cff834
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #pragma once
21 #include "SqlNameEdit.hxx"
22 #include <unotools/resmgr.hxx>
24 namespace dbaui
27 class OPropColumnEditCtrl : public OSQLNameEntry
29 short m_nPos;
30 OUString m_strHelpText;
31 public:
32 OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, TranslateId pHelpId, short nPosition);
34 short GetPos() const { return m_nPos; }
35 const OUString& GetHelp() const { return m_strHelpText; }
38 class OPropEditCtrl : public OWidgetBase
40 std::unique_ptr<weld::Entry> m_xEntry;
41 short m_nPos;
42 OUString m_strHelpText;
44 public:
45 OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, TranslateId pHelpId, short nPosition);
47 void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
48 OUString get_text() const { return m_xEntry->get_text(); }
49 void set_editable(bool bEditable) { m_xEntry->set_editable(bEditable); }
51 virtual void save_value() override { m_xEntry->save_value(); }
52 virtual bool get_value_changed_from_saved() const override { return m_xEntry->get_value_changed_from_saved(); }
54 short GetPos() const { return m_nPos; }
55 const OUString& GetHelp() const { return m_strHelpText; }
58 class OPropNumericEditCtrl : public OWidgetBase
60 std::unique_ptr<weld::SpinButton> m_xSpinButton;
61 short m_nPos;
62 OUString m_strHelpText;
64 public:
65 OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, TranslateId pHelpId, short nPosition);
67 void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
68 OUString get_text() const { return m_xSpinButton->get_text(); }
70 virtual void save_value() override { m_xSpinButton->save_value(); }
71 virtual bool get_value_changed_from_saved() const override { return m_xSpinButton->get_value_changed_from_saved(); }
72 void set_digits(int nLen) { m_xSpinButton->set_digits(nLen); }
73 void set_min(int nMin) { m_xSpinButton->set_min(nMin); }
74 void set_max(int nMax) { m_xSpinButton->set_max(nMax); }
75 void set_range(int nMin, int nMax) { m_xSpinButton->set_range(nMin, nMax); }
76 int get_value() const { return m_xSpinButton->get_value(); }
78 short GetPos() const { return m_nPos; }
79 const OUString& GetHelp() const { return m_strHelpText; }
81 void set_editable(bool bEditable) { m_xSpinButton->set_editable(bEditable); }
84 class OPropListBoxCtrl : public OWidgetBase
86 std::unique_ptr<weld::ComboBox> m_xComboBox;
87 short m_nPos;
88 OUString m_strHelpText;
90 public:
91 OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, TranslateId pHelpId, short nPosition);
92 virtual ~OPropListBoxCtrl() override
94 m_xComboBox->clear();
97 virtual void save_value() override { m_xComboBox->save_value(); }
98 virtual bool get_value_changed_from_saved() const override { return m_xComboBox->get_value_changed_from_saved(); }
100 weld::ComboBox& GetComboBox() { return *m_xComboBox; }
102 OUString get_active_text() const { return m_xComboBox->get_active_text(); }
103 void set_active_text(const OUString &rText) { m_xComboBox->set_active_text(rText); }
105 int get_active() const { return m_xComboBox->get_active(); }
106 void set_active(int nPos) { m_xComboBox->set_active(nPos); }
108 int get_count() const { return m_xComboBox->get_count(); }
110 void append_text(const OUString &rText) { m_xComboBox->append_text(rText); }
111 void remove_text(const OUString &rText) { m_xComboBox->remove_text(rText); }
112 int find_text(const OUString &rText) const { return m_xComboBox->find_text(rText); }
114 short GetPos() const { return m_nPos; }
115 const OUString& GetHelp() const { return m_strHelpText; }
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */