MuseScore  3.4
Music composition and notation
staffstate.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2010-2011 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __STAFFSTATE_H__
14 #define __STAFFSTATE_H__
15 
16 #include "element.h"
17 #include "instrument.h"
18 
19 namespace Ms {
20 
21 enum class StaffStateType : char {
22  INSTRUMENT,
23  TYPE,
24  VISIBLE,
25  INVISIBLE
26  };
27 
28 //---------------------------------------------------------
29 // @@ StaffState
30 //---------------------------------------------------------
31 
32 class StaffState final : public Element {
34  qreal lw;
35  QPainterPath path;
36 
38 
39  virtual void draw(QPainter*) const;
40  virtual void layout();
41 
42  public:
43  StaffState(Score*);
44  StaffState(const StaffState&);
45  ~StaffState();
46 
47  virtual StaffState* clone() const { return new StaffState(*this); }
48  virtual ElementType type() const { return ElementType::STAFF_STATE; }
49 
50  void setStaffStateType(const QString&);
51  void setStaffStateType(StaffStateType st) { _staffStateType = st; }
52  StaffStateType staffStateType() const { return _staffStateType; }
53  QString staffStateTypeName() const;
54 
55  virtual bool acceptDrop(EditData&) const override;
56  virtual Element* drop(EditData&);
57  virtual void write(XmlWriter&) const;
58  virtual void read(XmlReader&);
59  Instrument* instrument() const { return _instrument; }
60  void setInstrument(const Instrument* i) { *_instrument = *i; }
61  void setInstrument(const Instrument&& i) { *_instrument = i; }
62  Segment* segment() { return (Segment*)parent(); }
63  };
64 
65 
66 } // namespace Ms
67 #endif
Definition: xml.h:67
StaffStateType
Definition: staffstate.h:21
virtual StaffState * clone() const
Definition: staffstate.h:47
Base class of score layout elements.
Definition: element.h:158
Definition: instrument.h:250
StaffStateType staffStateType() const
Definition: staffstate.h:52
virtual ElementType type() const
Definition: staffstate.h:48
QPainterPath path
Definition: staffstate.h:35
Definition: score.h:391
Definition: inspectorAmbitus.cpp:21
Definition: segment.h:50
Definition: aeolus.cpp:26
void setInstrument(const Instrument *i)
Definition: staffstate.h:60
Definition: xml.h:218
void setInstrument(const Instrument &&i)
Definition: staffstate.h:61
StaffStateType _staffStateType
Definition: staffstate.h:33
void setStaffStateType(StaffStateType st)
Definition: staffstate.h:51
Definition: element.h:111
Instrument * instrument() const
Definition: staffstate.h:59
Segment * segment()
Definition: staffstate.h:62
ElementType
Definition: types.h:34
qreal lw
Definition: staffstate.h:34
Instrument * _instrument
Definition: staffstate.h:37
Definition: staffstate.h:32