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 */
Generated on Mon Nov 11 2013 09:56:11 for OpenStructure by
1.8.1.1