MuseScore/libmscore/stem.h

79 lines
2.3 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 __STEM_H__
#define __STEM_H__
#include "element.h"
class QPainter;
2013-05-13 18:49:17 +02:00
namespace Ms {
class Chord;
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
2012-07-25 11:49:34 +02:00
// @@ Stem
/// Graphic representation of a note stem.
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
class Stem : public Element {
Q_OBJECT
2012-05-26 14:26:10 +02:00
QLineF line; // p1 is attached to note head
qreal _userLen;
qreal _len; // allways positive
virtual void startEdit(MuseScoreView*, const QPointF&);
2012-05-26 14:26:10 +02:00
public:
Stem(Score*);
2014-06-27 13:41:49 +02:00
Stem &operator=(const Stem&) = delete;
2012-05-26 14:26:10 +02:00
virtual Stem* clone() const { return new Stem(*this); }
virtual Element::Type type() const { return Element::Type::STEM; }
2012-05-26 14:26:10 +02:00
virtual void draw(QPainter*) const;
virtual bool isEditable() const { return true; }
2012-05-26 14:26:10 +02:00
virtual void layout();
virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/);
virtual void editDrag(const EditData&);
2014-03-16 14:57:32 +01:00
virtual void updateGrips(int*, int*, QRectF*) const;
2012-05-26 14:26:10 +02:00
virtual void write(Xml& xml) const;
2013-01-11 18:10:18 +01:00
virtual void read(XmlReader& e);
2012-11-19 10:08:15 +01:00
virtual void reset();
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 QVariant getProperty(P_ID propertyId) const;
virtual bool setProperty(P_ID propertyId, const QVariant&);
Chord* chord() const { return (Chord*)parent(); }
bool up() const;
qreal userLen() const { return _userLen; }
void setUserLen(qreal l) { _userLen = l; }
2013-01-02 09:29:17 +01:00
qreal lineWidth() const;
2013-03-13 15:24:03 +01:00
QPointF hookPos() const;
2012-05-26 14:26:10 +02:00
void setLen(qreal l);
qreal len() const { return _len; }
qreal stemLen() const;
QPointF p2() const { return line.p2(); }
2012-05-26 14:26:10 +02:00
};
2013-05-13 18:49:17 +02:00
} // namespace Ms
2012-05-26 14:26:10 +02:00
#endif