2015-12-09 19:21:38 +08:00
|
|
|
#ifndef SECTIONCONTENT_H
|
|
|
|
#define SECTIONCONTENT_H
|
|
|
|
|
|
|
|
#include <QPointer>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QHash>
|
|
|
|
#include <QSharedPointer>
|
2016-02-11 21:33:02 +08:00
|
|
|
#include <QWeakPointer>
|
2015-12-09 19:21:38 +08:00
|
|
|
|
2016-02-02 22:01:48 +08:00
|
|
|
#include "ads/API.h"
|
2015-12-09 19:21:38 +08:00
|
|
|
|
|
|
|
ADS_NAMESPACE_BEGIN
|
2016-02-17 21:42:46 +08:00
|
|
|
class ContainerWidget;
|
2015-12-09 19:21:38 +08:00
|
|
|
|
2016-02-24 04:31:09 +08:00
|
|
|
class ADS_EXPORT_API SectionContent
|
2015-12-09 19:21:38 +08:00
|
|
|
{
|
2016-02-11 21:33:02 +08:00
|
|
|
friend class ContainerWidget;
|
|
|
|
|
|
|
|
private:
|
2016-02-17 21:42:46 +08:00
|
|
|
SectionContent();
|
|
|
|
SectionContent(const SectionContent&);
|
|
|
|
SectionContent& operator=(const SectionContent&);
|
2016-02-11 21:33:02 +08:00
|
|
|
|
2015-12-09 19:21:38 +08:00
|
|
|
public:
|
|
|
|
typedef QSharedPointer<SectionContent> RefPtr;
|
2016-02-11 21:33:02 +08:00
|
|
|
typedef QWeakPointer<SectionContent> WeakPtr;
|
2015-12-09 19:21:38 +08:00
|
|
|
|
2016-02-17 21:42:46 +08:00
|
|
|
/*!
|
|
|
|
* Creates new content, associates it to <em>container</em> and takes ownership of
|
|
|
|
* <em>title</em>- and <em>content</em>- widgets.
|
|
|
|
* \param uniqueName An unique identifier across the entire process.
|
|
|
|
* \param container The parent ContainerWidget in which this content will be active.
|
|
|
|
* \param title The widget to use as title.
|
|
|
|
* \param content The widget to use as content.
|
|
|
|
* \return May return a invalid ref-pointer in case of invalid parameters.
|
|
|
|
*/
|
|
|
|
static RefPtr newSectionContent(const QString& uniqueName, ContainerWidget* container, QWidget* title, QWidget* content);
|
|
|
|
|
2015-12-09 19:21:38 +08:00
|
|
|
virtual ~SectionContent();
|
|
|
|
int uid() const;
|
|
|
|
QString uniqueName() const;
|
2016-02-17 21:42:46 +08:00
|
|
|
ContainerWidget* containerWidget() const;
|
2015-12-09 19:21:38 +08:00
|
|
|
QWidget* titleWidget() const;
|
|
|
|
QWidget* contentWidget() const;
|
|
|
|
|
2016-02-11 21:33:02 +08:00
|
|
|
private:
|
2015-12-09 19:21:38 +08:00
|
|
|
const int _uid;
|
2016-02-17 21:42:46 +08:00
|
|
|
QString _uniqueName;
|
|
|
|
ContainerWidget* _container;
|
2015-12-09 19:21:38 +08:00
|
|
|
QPointer<QWidget> _title;
|
|
|
|
QPointer<QWidget> _content;
|
|
|
|
|
2016-02-24 03:51:19 +08:00
|
|
|
static int GetNextUid();
|
|
|
|
static QHash<int, SectionContent::WeakPtr>& GetLookupMap();
|
|
|
|
static QHash<QString, SectionContent::WeakPtr>& GetLookupMapByName();
|
|
|
|
|
|
|
|
//static QHash<int, SectionContent::WeakPtr> LookupMap;
|
|
|
|
//static QHash<QString, SectionContent::WeakPtr> LookupMapByName;
|
2015-12-09 19:21:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
ADS_NAMESPACE_END
|
2016-02-12 14:15:10 +08:00
|
|
|
#endif
|