The complete source code of IdealIRC http://www.idealirc.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
idealirc/IWin/IWin.h

71 lines
1.8 KiB

/*
* IdealIRC - Internet Relay Chat client
* Copyright (C) 2019 Tom-Andre Barstad
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef IWIN_H
#define IWIN_H
#include "Widgets/IIRCView.h"
#include <QWidget>
#include <unordered_map>
#include <QCloseEvent>
#include <QShowEvent>
class IWin : public QWidget
{
Q_OBJECT
public:
enum class Type
{
Undefined,
Status,
Channel,
Private,
Custom
};
static const QString InvalidWindowTypeString;
static std::unordered_map<Type,QString> TypeString;
Type getType() const;
IWin* getParent() const { return m_parent; }
IWin* getStatusParent();
virtual bool print(PrintType ptype, const QString& text) = 0;
virtual void refreshWindowTitle() = 0;
virtual void clear() = 0;
const QString& getButtonText() const;
void setButtonText(const QString& text);
bool operator==(const IWin& other); // TODO implementation
protected:
explicit IWin(Type type, IWin* parentWindow = nullptr);
void closeEvent(QCloseEvent *) override;
private:
Type m_type;
QString m_buttonText;
IWin* m_parent{ nullptr };
bool m_firstShow{ true };
signals:
void aboutToClose(IWin* who);
};
#endif // IWIN_H