2010-08-25 22:59:08 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-08-25 22:59:08 +02:00
|
|
|
|
|
|
|
Clementine 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 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MACLINEEDIT_H
|
|
|
|
#define MACLINEEDIT_H
|
|
|
|
|
|
|
|
#include <QMacCocoaViewContainer>
|
|
|
|
|
|
|
|
#include "lineedit.h"
|
|
|
|
|
|
|
|
class SearchTargetWrapper;
|
|
|
|
|
|
|
|
class MacLineEdit : public QMacCocoaViewContainer, public LineEditInterface {
|
|
|
|
Q_OBJECT
|
2010-12-20 00:40:36 +01:00
|
|
|
Q_PROPERTY(QString hint READ hint WRITE set_hint);
|
2010-08-25 22:59:08 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
MacLineEdit(QWidget* parent = 0);
|
|
|
|
~MacLineEdit();
|
|
|
|
|
2010-12-20 00:40:36 +01:00
|
|
|
QString hint() const { return hint_; }
|
|
|
|
void set_hint(const QString& hint);
|
|
|
|
void clear_hint() { set_hint(QString()); }
|
2010-08-25 22:59:08 +02:00
|
|
|
|
|
|
|
void paintEvent(QPaintEvent* e);
|
|
|
|
|
2010-12-20 00:40:36 +01:00
|
|
|
void set_text(const QString&);
|
2010-08-25 22:59:08 +02:00
|
|
|
QString text() const;
|
2010-12-20 00:40:36 +01:00
|
|
|
void set_focus() {}
|
2010-08-25 22:59:08 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void textChanged(const QString& text);
|
|
|
|
void textEdited(const QString& text);
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Called by NSSearchFieldCell when the text changes.
|
|
|
|
void TextChanged(const QString& text);
|
|
|
|
|
|
|
|
QString hint_;
|
|
|
|
|
|
|
|
friend class SearchTargetWrapper;
|
|
|
|
SearchTargetWrapper* wrapper_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MACLINEEDIT_H
|