OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
stage
include
ost
gui
widget_pool.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// This file is part of the OpenStructure project <www.openstructure.org>
3
//
4
// Copyright (C) 2008-2011 by the OpenStructure authors
5
//
6
// This library is free software; you can redistribute it and/or modify it under
7
// the terms of the GNU Lesser General Public License as published by the Free
8
// Software Foundation; either version 3.0 of the License, or (at your option)
9
// any later version.
10
// This library is distributed in the hope that it will be useful, but WITHOUT
11
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with this library; if not, write to the Free Software Foundation, Inc.,
17
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
//------------------------------------------------------------------------------
19
#ifndef OST_GUI_WIDGET_POOL_HH
20
#define OST_GUI_WIDGET_POOL_HH
21
22
#include <
ost/gui/widget.hh
>
23
#include <QSettings>
24
/*
25
Author: Marco Biasini, Stefan Scheuber
26
*/
27
namespace
ost {
namespace
gui {
28
29
struct
PooledWidget
30
{
31
PooledWidget
():
32
name
(
""
),
available
(-1)
33
{ }
34
35
PooledWidget
(
const
QString& n,
int
lim=-1):
36
name
(n),
available
(lim),
limit
(lim)
37
{ }
38
QString
name
;
39
int
available
;
40
int
limit
;
41
};
42
45
class
DLLEXPORT_OST_GUI
WidgetPool
:
public
QObject {
46
Q_OBJECT
47
public
:
48
WidgetPool
(QObject* parent=NULL);
49
55
void
Add(
const
QString& name,
int
limit=-1);
56
60
bool
IsAvailable(
const
QString& name);
61
66
Widget
* Create(
const
QString& name);
67
72
bool
Take(
const
QString& name);
73
78
bool
Give(
const
QString& name);
79
82
QList<QString> GetAvailableWidgets();
83
84
private
:
85
QMap<QString, PooledWidget> pool_;
86
};
87
88
}}
89
#endif
/* OST_GUI_WIDGET_POOL_HH */
ost::gui::PooledWidget::PooledWidget
PooledWidget(const QString &n, int lim=-1)
Definition:
widget_pool.hh:35
widget.hh
DLLEXPORT_OST_GUI
#define DLLEXPORT_OST_GUI
Definition:
module_config.hh:33
ost::gui::PooledWidget
Definition:
widget_pool.hh:29
ost::gui::PooledWidget::available
int available
Definition:
widget_pool.hh:39
ost::gui::Widget
Base class for widgets.
Definition:
widget.hh:40
ost::gui::PooledWidget::name
QString name
Definition:
widget_pool.hh:38
ost::gui::PooledWidget::PooledWidget
PooledWidget()
Definition:
widget_pool.hh:31
ost::gui::WidgetPool
This Widget pool manages instances of widgets Widgets can be added to this pool by simply passing the...
Definition:
widget_pool.hh:45
ost::gui::PooledWidget::limit
int limit
Definition:
widget_pool.hh:40
Generated by
1.8.5