MuseScore/libmscore/staffstate.h

67 lines
1.9 KiB
C
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2010-2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __STAFFSTATE_H__
#define __STAFFSTATE_H__
#include "element.h"
#include "elementlayout.h"
#include "instrument.h"
class QPainter;
2013-05-13 18:49:17 +02:00
namespace Ms {
enum class StaffStateType : char {
INSTRUMENT, TYPE,
VISIBLE, INVISIBLE
2012-05-26 14:26:10 +02:00
};
//---------------------------------------------------------
2012-07-25 11:49:34 +02:00
// @@ StaffState
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
class StaffState : public Element {
2012-07-25 11:49:34 +02:00
Q_OBJECT
StaffStateType _staffStateType;
2012-05-26 14:26:10 +02:00
qreal lw;
QPainterPath path;
Instrument _instrument;
virtual void draw(QPainter*) const;
virtual void layout();
public:
StaffState(Score*);
virtual StaffState* clone() const { return new StaffState(*this); }
virtual Element::Type type() const { return Element::Type::STAFF_STATE; }
2012-05-26 14:26:10 +02:00
void setStaffStateType(const QString&);
void setStaffStateType(StaffStateType st) { _staffStateType = st; }
StaffStateType staffStateType() const { return _staffStateType; }
QString staffStateTypeName() const;
2012-05-26 14:26:10 +02:00
2014-08-13 21:01:21 +02:00
virtual bool acceptDrop(const DropData&) const override;
2012-05-26 14:26:10 +02:00
virtual Element* drop(const DropData&);
virtual void write(Xml&) const;
2013-01-11 18:10:18 +01:00
virtual void read(XmlReader&);
2012-05-26 14:26:10 +02:00
Instrument instrument() const { return _instrument; }
void setInstrument(const Instrument& i) { _instrument = i; }
Segment* segment() { return (Segment*)parent(); }
};
2013-05-13 18:49:17 +02:00
} // namespace Ms
2012-05-26 14:26:10 +02:00
#endif