mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 21:25:44 +08:00
84 lines
2.2 KiB
C
84 lines
2.2 KiB
C
|
#ifndef DockFocusControllerH
|
||
|
#define DockFocusControllerH
|
||
|
//============================================================================
|
||
|
/// \file DockFocusController.h
|
||
|
/// \author Uwe Kindler
|
||
|
/// \date 05.06.2020
|
||
|
/// \brief Declaration of CDockFocusController class
|
||
|
//============================================================================
|
||
|
|
||
|
//============================================================================
|
||
|
// INCLUDES
|
||
|
//============================================================================
|
||
|
#include <QObject>
|
||
|
#include "ads_globals.h"
|
||
|
#include "DockManager.h"
|
||
|
|
||
|
namespace ads
|
||
|
{
|
||
|
struct DockFocusControllerPrivate;
|
||
|
class CDockManager;
|
||
|
class CFloatingDockContainer;
|
||
|
|
||
|
/**
|
||
|
* Manages focus styling of dock widgets and handling of focus changes
|
||
|
*/
|
||
|
class ADS_EXPORT CDockFocusController : public QObject
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
private:
|
||
|
DockFocusControllerPrivate* d; ///< private data (pimpl)
|
||
|
friend class DockFocusControllerPrivate;
|
||
|
|
||
|
private slots:
|
||
|
void onApplicationFocusChanged(QWidget *old, QWidget *now);
|
||
|
void onFocusedDockAreaViewToggled(bool Open);
|
||
|
void onStateRestored();
|
||
|
|
||
|
public:
|
||
|
using Super = QObject;
|
||
|
/**
|
||
|
* Default Constructor
|
||
|
*/
|
||
|
CDockFocusController(CDockManager* DockManager);
|
||
|
|
||
|
/**
|
||
|
* Virtual Destructor
|
||
|
*/
|
||
|
virtual ~CDockFocusController();
|
||
|
|
||
|
/**
|
||
|
* Helper function to set focus depending on the configuration of the
|
||
|
* FocusStyling flag
|
||
|
*/
|
||
|
template <class QWidgetPtr>
|
||
|
static void setWidgetFocus(QWidgetPtr widget)
|
||
|
{
|
||
|
if (!CDockManager::configFlags().testFlag(CDockManager::FocusStyling))
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
widget->setFocus(Qt::OtherFocusReason);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A container needs to call this function if a widget has been dropped
|
||
|
* into it
|
||
|
*/
|
||
|
void notifyWidgetOrAreaRelocation(QWidget* RelocatedWidget);
|
||
|
|
||
|
/**
|
||
|
* This function is called, if a floating widget has been dropped into
|
||
|
* an new position.
|
||
|
* When this function is called, all dock widgets of the FloatingWidget
|
||
|
* are already inserted into its new position
|
||
|
*/
|
||
|
void notifyFloatingWidgetDrop(CFloatingDockContainer* FloatingWidget);
|
||
|
}; // class DockFocusController
|
||
|
}
|
||
|
// namespace ads
|
||
|
//-----------------------------------------------------------------------------
|
||
|
#endif // DockFocusControllerH
|
||
|
|