X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fclickable.h;fp=src%2Fuisupport%2Fclickable.h;h=ce8d9a6d9cf4f33fbccd3f99c567d1039eb27206;hp=0000000000000000000000000000000000000000;hb=55579f53f3bd37f2a20d9be7458bdc54b345a052;hpb=b7ba7d253e27507af6e749ee48b42073493139c0 diff --git a/src/uisupport/clickable.h b/src/uisupport/clickable.h new file mode 100644 index 00000000..ce8d9a6d --- /dev/null +++ b/src/uisupport/clickable.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2005-09 by the Quassel Project * + * devel@quassel-irc.org * + * * + * 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) version 3. * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef CLICKABLE_H_ +#define CLICKABLE_H_ + +#include + +class Clickable { + +public: + // Don't change these enums without also changing dependent methods! + enum Type { + Invalid = -1, + Url = 0, + Channel = 1, + Nick = 2 + }; + + explicit inline Clickable(Type type = Invalid, quint16 start = 0, quint16 length = 0) + : _type(type), _start(start), _length(length) + {} + + inline Type type() const { return _type; } + inline quint16 start() const { return _start; } + inline quint16 length() const { return _length; } + + inline bool isValid() const { return _type != Invalid; } + +private: + Type _type; + quint16 _start; + quint16 _length; +}; + +class ClickableList : public QList { + +public: + static ClickableList fromString(const QString &); + +}; + +#endif // CLICKABLE_H_