From 53406353899af17a1f41d45daeab27dbc457389b Mon Sep 17 00:00:00 2001 From: xypwn Date: Fri, 3 Apr 2020 19:38:01 +0200 Subject: [PATCH] Add saveable labels for parts and connectors --- CircuitBuffer.cpp | 6 +- CircuitSimulator.pro | 3 + Connector.cpp | 29 +++++++ Connector.h | 6 ++ FileHandler.cpp | 25 ++++-- Label.cpp | 66 +++++++++++++++- Label.h | 23 +++++- MainWindow.cpp | 3 +- MainWindow.ui | 146 +++++++++++++++++++++++++----------- Part.cpp | 43 +++++++++-- Part.h | 9 ++- Parts/AndGate.cpp | 1 + Parts/BufferGate.cpp | 1 + Parts/HighConstant.cpp | 2 + Parts/IntegratedCircuit.cpp | 10 +++ Parts/LightBulb.cpp | 1 + Parts/LowConstant.cpp | 2 + Parts/NandGate.cpp | 1 + Parts/NorGate.cpp | 1 + Parts/NotGate.cpp | 1 + Parts/OrGate.cpp | 1 + Parts/ToggleButton.cpp | 2 + Parts/XnorGate.cpp | 1 + Parts/XorGate.cpp | 1 + Scene.cpp | 3 +- eAlignMode.h | 17 +++++ 26 files changed, 341 insertions(+), 63 deletions(-) diff --git a/CircuitBuffer.cpp b/CircuitBuffer.cpp index f7b2ec8..012b54e 100644 --- a/CircuitBuffer.cpp +++ b/CircuitBuffer.cpp @@ -17,7 +17,7 @@ void CircuitBuffer::addFromScene(const QList &parts, const QList& { // Maps the pointer of every given part to the corresponding pointer to an element in m_parts QMap partPtrToDataPtr; - + // Add all parts into buffer as PartData for(auto part : parts) { // Create partData @@ -33,6 +33,7 @@ void CircuitBuffer::addFromScene(const QList &parts, const QList& // Make it possible to find partData pointer with Part pointer partPtrToDataPtr.insert(part, &m_parts.last()); } + // Add all wires into buffer as WireData for(auto wire : wires) { auto wireInputPart = wire->m_connectorInput->parentPart(); @@ -55,6 +56,7 @@ QPair, QList> CircuitBuffer::addIntoScene(Scene* scene, QPoi QMap dataToAllocatedPart; + // Add all part data into scene as parts for(auto& partData : m_parts) { Part* part; @@ -66,7 +68,7 @@ QPair, QList> CircuitBuffer::addIntoScene(Scene* scene, QPoi allocatedParts.append(part); } - + // Add all wire data into scene as wires for(auto& wireData : m_wires) { // input and output are relative to the wire diff --git a/CircuitSimulator.pro b/CircuitSimulator.pro index 2a677f2..2f62226 100644 --- a/CircuitSimulator.pro +++ b/CircuitSimulator.pro @@ -17,6 +17,7 @@ DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ CircuitBuffer.cpp \ + Label.cpp \ Logic.cpp \ Parts/AndGate.cpp \ Parts/BufferGate.cpp \ @@ -47,6 +48,7 @@ SOURCES += \ HEADERS += \ CircuitBuffer.h \ + Label.h \ Logic.h \ Parts/AndGate.h \ Parts/BufferGate.h \ @@ -73,6 +75,7 @@ HEADERS += \ UndoCommands/RemoveParts.h \ UndoCommands/RemoveWire.h \ Wire.h \ + eAlignMode.h \ eConnectorType.h \ ePartType.h diff --git a/Connector.cpp b/Connector.cpp index 15080de..ecb371e 100644 --- a/Connector.cpp +++ b/Connector.cpp @@ -6,6 +6,7 @@ #include "Wire.h" #include "eConnectorType.h" #include "Scene.h" +#include "Label.h" // PUBLIC @@ -22,6 +23,30 @@ Part* Connector::parentPart() return (Part*)parentItem(); } +void Connector::setLabel(const QString& text) +{ + if(m_label == nullptr) + { + m_label = new Label(this); + // If this Connector is on the left side of a Part + if(m_connectorType == ConnectorType::Input) + m_label->alignText(QPointF(0, 0), mkAlignMode(AlignMode::Left, AlignMode::VCenter)); + // If this Connector is on the right side of a Part + else + m_label->alignText(QPointF(0, 0), mkAlignMode(AlignMode::Right, AlignMode::VCenter)); + } + m_label->setText(text); +} + +QString Connector::label() const +{ + if(m_label == nullptr) + return QString(); + else + return m_label->text(); +} + + QRectF Connector::boundingRect() const { if(m_connectorType == ConnectorType::Output) @@ -42,6 +67,9 @@ QPainterPath Connector::shape() const void Connector::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option) + Q_UNUSED(widget) + QPen pen = painter->pen(); pen.setWidth(2); if(parentItem()->isSelected()) @@ -70,6 +98,7 @@ void Connector::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, void Connector::mousePressEvent(QGraphicsSceneMouseEvent *event) { + Q_UNUSED(event) m_scene->connectorClicked(this); } diff --git a/Connector.h b/Connector.h index 14b4348..b4969a2 100644 --- a/Connector.h +++ b/Connector.h @@ -8,6 +8,7 @@ class Part; class Wire; class Scene; +class Label; class Connector : private QGraphicsItem { @@ -26,6 +27,9 @@ public: Part* parentPart(); + void setLabel(const QString& text = QString()); + QString label() const; + QRectF boundingRect() const override; // For drawing QPainterPath shape() const override; // For selection ("Hitbox") void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; @@ -42,6 +46,8 @@ private: bool m_state = false; bool m_selected = false; // Separate from regular selection, for creating connections + Label* m_label = nullptr; + void select(); // Called by MainWindow void unselect(); // Called by MainWindow }; diff --git a/FileHandler.cpp b/FileHandler.cpp index 5fd422b..d5be62b 100644 --- a/FileHandler.cpp +++ b/FileHandler.cpp @@ -10,6 +10,7 @@ #include "Connector.h" #include "Logic.h" #include "MainWindow.h" +#include "Label.h" #include "Parts/IntegratedCircuit.h" @@ -29,13 +30,11 @@ bool FileHandler::exists(QString filename) bool FileHandler::save(QString filename) { QFile file(filename); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return false; - QTextStream fOut(&file); - fOut << "[parts]\n"; + // Add each and it's data into the file for(auto part : m_logic->m_parts) { fOut << part << " " << part->m_partType << " " << part->pos().x() << " " << part->pos().y(); @@ -44,12 +43,16 @@ bool FileHandler::save(QString filename) // Strip out IC file path QFileInfo fileInfo(((IntegratedCircuit*)part)->filename()); QString icFile(fileInfo.fileName()); - fOut << " " << icFile; + // Write IC file name into file + fOut << " \"" << icFile << "\""; } + // Write label text into file + fOut << " \"" << part->m_label->text() << "\""; fOut << "\n"; } fOut << "[wires]\n"; + // Add each wire and it's data into the file for(auto wire : m_logic->m_wires) { auto wireInputPart = wire->m_connectorInput->parentPart(); @@ -77,7 +80,7 @@ bool FileHandler::open(QString filename) Sector currentSector; - // A .csim file stores all parts with IDs, this map simply keeps track of which ID was given which pointer + // A .csim file stores all parts with IDs, this map simply keeps track of which ID corresponds to which pointer QMap idPartPointerMap; while (!file.atEnd()) { @@ -90,13 +93,19 @@ bool FileHandler::open(QString filename) { QVector words; QString currWord; + // If the parser is in between two double quotes ("") + bool parserInString = false; for(QChar c : line) { - if(c == QChar::Space) + if(c == QChar::Space && !parserInString) { words.append(currWord); currWord.clear(); } + else if(c == '\"') + { + parserInString = !parserInString; + } else currWord.append(c); } @@ -122,9 +131,13 @@ bool FileHandler::open(QString filename) qFatal("Failed to open IC file: " + icFilename.toUtf8()); } part = m_logic->createIC(icFilename, pos); + part->setLabel(words[5]); } else + { part = m_logic->createPart(type, pos); + part->setLabel(words[4]); + } idPartPointerMap.insert(words[0], part); } else diff --git a/Label.cpp b/Label.cpp index 90daa2e..bba26da 100644 --- a/Label.cpp +++ b/Label.cpp @@ -1,6 +1,68 @@ #include "Label.h" -Label::Label() -{ +#include +#include +Label::Label(QGraphicsItem* parent) + :m_parentItem(parent) +{ + // TODO: Find out why I have to call setParentItem each time in recalculateTextAlignment + //setParentItem((QGraphicsItem*)m_parent); + if(parent->scene() != nullptr) + parent->scene()->addItem(this); +} + +void Label::setEditable(bool value) +{ + if(value) + setTextInteractionFlags(Qt::TextInteractionFlag::TextEditorInteraction); + else + setTextInteractionFlags(Qt::TextInteractionFlag::NoTextInteraction); +} + +void Label::setText(const QString& text) +{ + setPlainText(text); + recalculateTextAlignment(); +} + +QString Label::text() const +{ + return toPlainText(); +} + +void Label::alignText(QPointF anchorPos, AlignMode::AlignMode mode) +{ + m_textAnchor = anchorPos; + m_alignMode = mode; + recalculateTextAlignment(); +} + +void Label::keyPressEvent(QKeyEvent* event) +{ + QGraphicsTextItem::keyPressEvent(event); + + if(event->isAccepted()) + recalculateTextAlignment(); +} + +void Label::recalculateTextAlignment() +{ + setParentItem(m_parentItem); + + if(m_alignMode & AlignMode::Right) + setX( - boundingRect().width()); + else if(m_alignMode & AlignMode::HCenter) + setX( - boundingRect().width() / 2.f); + else //usually if(m_alignMode & AlignMode::Left) + setX(0); + + if(m_alignMode & AlignMode::Bottom) + setY( - boundingRect().height()); + else if(m_alignMode & AlignMode::VCenter) + setY( - boundingRect().height() / 2.f); + else //usually if(m_alignMode & AlignMode::Top) + setY(0); + + moveBy(m_textAnchor.x(), m_textAnchor.y()); } diff --git a/Label.h b/Label.h index 9666a62..b63c774 100644 --- a/Label.h +++ b/Label.h @@ -1,11 +1,30 @@ #ifndef LABEL_H #define LABEL_H +#include +#include -class Label : public QGraphicsTextItem +#include "eAlignMode.h" + +class Label : private QGraphicsTextItem { public: - Label(); + Label(QGraphicsItem* parent); + + void setEditable(bool value); + void setText(const QString& text); + QString text() const; + void alignText(QPointF anchorPos, AlignMode::AlignMode mode = AlignMode::Default); + +private: + QGraphicsItem* m_parentItem; + + QPointF m_textAnchor; + AlignMode::AlignMode m_alignMode; + + void keyPressEvent(QKeyEvent* event) override; + + void recalculateTextAlignment(); }; #endif // LABEL_H diff --git a/MainWindow.cpp b/MainWindow.cpp index ae9b8f5..30be055 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -188,7 +188,8 @@ void MainWindow::closeEvent(QCloseEvent *event) fileSave(); if(!unsavedChanges) event->accept(); - event->ignore(); + else + event->ignore(); break; case QMessageBox::Discard: event->accept(); diff --git a/MainWindow.ui b/MainWindow.ui index 2d8920f..4516c07 100644 --- a/MainWindow.ui +++ b/MainWindow.ui @@ -328,16 +328,6 @@ - - - - - 0 - 0 - - - - @@ -407,6 +397,16 @@ + + + + + 0 + 0 + + + + @@ -481,9 +481,9 @@ - + - toolBar + File Actions true @@ -504,31 +504,10 @@ - - - - - - - - - - - - - - - - - - - - - - toolBar_2 + Add Parts BottomToolBarArea @@ -537,6 +516,77 @@ false + + + Undo/Redo + + + TopToolBarArea + + + false + + + + + + + Edit + + + TopToolBarArea + + + false + + + + + + + + + Zoom + + + TopToolBarArea + + + false + + + + + + + + Select Tool + + + TopToolBarArea + + + false + + + + + + + + + Simulation Controls + + + TopToolBarArea + + + false + + + + + @@ -597,7 +647,7 @@ Connect Parts - Ctrl+J + 1 @@ -612,7 +662,7 @@ Select - Ctrl+G + 3 @@ -624,7 +674,7 @@ Zoom In - Ctrl+8 + I @@ -636,7 +686,7 @@ Zoom Out - Ctrl+9 + O @@ -648,7 +698,7 @@ Reset Zoom - Ctrl+0 + U @@ -663,7 +713,7 @@ Pan - Ctrl+H + 4 @@ -687,7 +737,7 @@ Redo - Ctrl+Y + Ctrl+Shift+Z @@ -738,7 +788,7 @@ Remove Connections - Ctrl+U + 2 @@ -761,6 +811,9 @@ Start + + S + @@ -770,6 +823,9 @@ Stop + + E + @@ -782,6 +838,9 @@ Step + + W + @@ -794,6 +853,9 @@ Toggle Undo View + + Ctrl+H + diff --git a/Part.cpp b/Part.cpp index 49a496d..0c6eb9a 100644 --- a/Part.cpp +++ b/Part.cpp @@ -5,28 +5,38 @@ #include #include #include -#include "Connector.h" +#include +#include + +#include "eAlignMode.h" #include "eConnectorType.h" +#include "Connector.h" #include "MainWindow.h" #include "Scene.h" #include "Logic.h" +#include "Label.h" + +#include // PUBLIC Part::Part(Logic* logic, CircuitItemBaseShape baseShape) :m_logic(logic), m_baseShape(baseShape) { // Set flags - setFlag(QGraphicsItem::ItemIsMovable); - setFlag(QGraphicsItem::ItemIsSelectable); - setFlag(QGraphicsItem::ItemSendsScenePositionChanges); + setFlags(QGraphicsItem::ItemIsMovable | + QGraphicsItem::ItemIsSelectable | + QGraphicsItem::ItemSendsScenePositionChanges); // Set default colors m_penColorNormal=Qt::GlobalColor::color1; - m_penColorSelected=Qt::GlobalColor::color0; + m_penColorSelected=Qt::GlobalColor::darkGray; m_penColorSymbol=Qt::GlobalColor::white; m_brushColorNormal=Qt::GlobalColor::blue; m_brushColorSelected=Qt::GlobalColor::blue; // Set default width factor (actual width = 20 * width factor) setWidth(2); + // Initialize label + m_label = new Label(this); + m_label->setEditable(true); } PartType::PartType Part::partType() @@ -44,6 +54,16 @@ void Part::setPos(QPointF pos) QGraphicsItem::setPos(pos); } +void Part::setLabel(QString text) +{ + m_label->setText(text); +} + +QString Part::label() const +{ + return m_label->text(); +} + void Part::addInputs(int amount) { for(int i = 0; i < amount; i++) @@ -71,6 +91,9 @@ void Part::setWidth(int factor) void Part::recalculateLayout() { + // Return if the part isn't in any scene + if(m_logic->parentScene() == nullptr) + return; // Add inputs and outputs and position them correctly int yOffsetInputs; int yOffsetOutputs; @@ -100,6 +123,16 @@ void Part::recalculateLayout() { m_outputs[i]->setPos(20 * m_widthFactor, yOffsetOutputs + 20 * i); } + + // Position and scale label correctly + int maxConnections = qMax(m_inputs.length(), m_outputs.length()); + qreal partHeight; + if(m_baseShape == RoundedRect) + partHeight = 20 * maxConnections; + else + partHeight = 40 * maxConnections; + // Center text relative to part's center + m_label->alignText(QPointF(m_widthFactor * 10, partHeight), mkAlignMode(AlignMode::HCenter, AlignMode::Top)); } QRectF Part::boundingRect() const diff --git a/Part.h b/Part.h index 2320406..281a65f 100644 --- a/Part.h +++ b/Part.h @@ -3,11 +3,13 @@ #include #include +#include #include "ePartType.h" class Connector; class Logic; +class Label; class Part : protected QGraphicsItem { @@ -49,6 +51,9 @@ public: QPointF getPos() const; void setPos(QPointF pos); + void setLabel(QString text); + QString label() const; + void addInputs(int amount); void addOutputs(int amount); @@ -89,7 +94,9 @@ protected: int m_widthFactor; private: - // Updates all of the outputs using the inputs + // Updates all of the outputs using the inputs, called by Logic void updateState(); + + Label* m_label; }; #endif // CIRCUITITEM_H diff --git a/Parts/AndGate.cpp b/Parts/AndGate.cpp index 7ef5f8a..e619fab 100644 --- a/Parts/AndGate.cpp +++ b/Parts/AndGate.cpp @@ -7,6 +7,7 @@ AndGate::AndGate(Logic* logic) { addInputs(2); addOutputs(1); + setLabel("And Gate"); recalculateLayout(); } diff --git a/Parts/BufferGate.cpp b/Parts/BufferGate.cpp index d014406..1063a84 100644 --- a/Parts/BufferGate.cpp +++ b/Parts/BufferGate.cpp @@ -7,6 +7,7 @@ BufferGate::BufferGate(Logic* logic) { addInputs(1); addOutputs(1); + setLabel("Buffer Gate"); recalculateLayout(); } diff --git a/Parts/HighConstant.cpp b/Parts/HighConstant.cpp index 85e807e..6fef0e2 100644 --- a/Parts/HighConstant.cpp +++ b/Parts/HighConstant.cpp @@ -7,6 +7,7 @@ HighConstant::HighConstant(Logic* logic) { addInputs(0); addOutputs(1); + setLabel("High Constant"); recalculateLayout(); m_brushColorNormal = Qt::GlobalColor::green; m_brushColorSelected = Qt::GlobalColor::green; @@ -14,6 +15,7 @@ HighConstant::HighConstant(Logic* logic) QVector HighConstant::compute(QVector inputs) { + Q_UNUSED(inputs) QVector ret(1); ret[0] = true; return ret; diff --git a/Parts/IntegratedCircuit.cpp b/Parts/IntegratedCircuit.cpp index 32618bf..d95bef3 100644 --- a/Parts/IntegratedCircuit.cpp +++ b/Parts/IntegratedCircuit.cpp @@ -1,7 +1,10 @@ #include "IntegratedCircuit.h" +#include + #include "../Scene.h" #include "../Logic.h" +#include "../Connector.h" #include "ToggleButton.h" #include "LightBulb.h" @@ -30,7 +33,14 @@ IntegratedCircuit::IntegratedCircuit(Logic* logic, QString filename) std::sort(m_icLogicInputs.begin(), m_icLogicInputs.end(), compareToggleButtons); std::sort(m_icLogicOutputs.begin(), m_icLogicOutputs.end(), compareLightBulbs); + setLabel(QFileInfo(m_filename).fileName()); recalculateLayout(); + + // Give all connectors labels according to those of the buttons/lamps of the IC logic + for(int i = 0; i < m_inputs.length(); i++) + m_inputs[i]->setLabel(m_icLogicInputs[i]->label()); + for(int i = 0; i < m_outputs.length(); i++) + m_outputs[i]->setLabel(m_icLogicOutputs[i]->label()); } QString IntegratedCircuit::filename() diff --git a/Parts/LightBulb.cpp b/Parts/LightBulb.cpp index 6f943de..5674346 100644 --- a/Parts/LightBulb.cpp +++ b/Parts/LightBulb.cpp @@ -7,6 +7,7 @@ LightBulb::LightBulb(Logic* logic) { addInputs(1); addOutputs(0); + setLabel("Light Bulb"); recalculateLayout(); m_brushColorNormal = Qt::GlobalColor::black; m_brushColorSelected = Qt::GlobalColor::black; diff --git a/Parts/LowConstant.cpp b/Parts/LowConstant.cpp index ea76efa..b308e14 100644 --- a/Parts/LowConstant.cpp +++ b/Parts/LowConstant.cpp @@ -7,6 +7,7 @@ LowConstant::LowConstant(Logic* logic) { addInputs(0); addOutputs(1); + setLabel("Low Constant"); recalculateLayout(); m_brushColorNormal = Qt::GlobalColor::black; m_brushColorSelected = Qt::GlobalColor::black; @@ -14,6 +15,7 @@ LowConstant::LowConstant(Logic* logic) QVector LowConstant::compute(QVector inputs) { + Q_UNUSED(inputs) QVector ret(1); ret[0] = false; return ret; diff --git a/Parts/NandGate.cpp b/Parts/NandGate.cpp index a3264ef..ebf1a43 100644 --- a/Parts/NandGate.cpp +++ b/Parts/NandGate.cpp @@ -7,6 +7,7 @@ NandGate::NandGate(Logic* logic) { addInputs(2); addOutputs(1); + setLabel("Nand Gate"); recalculateLayout(); } diff --git a/Parts/NorGate.cpp b/Parts/NorGate.cpp index 209d8f7..6cd37fa 100644 --- a/Parts/NorGate.cpp +++ b/Parts/NorGate.cpp @@ -7,6 +7,7 @@ NorGate::NorGate(Logic* logic) { addInputs(2); addOutputs(1); + setLabel("Nor Gate"); recalculateLayout(); } diff --git a/Parts/NotGate.cpp b/Parts/NotGate.cpp index f747796..3239d51 100644 --- a/Parts/NotGate.cpp +++ b/Parts/NotGate.cpp @@ -7,6 +7,7 @@ NotGate::NotGate(Logic* logic) { addInputs(1); addOutputs(1); + setLabel("Not Gate"); recalculateLayout(); } diff --git a/Parts/OrGate.cpp b/Parts/OrGate.cpp index 6af8128..d03a06d 100644 --- a/Parts/OrGate.cpp +++ b/Parts/OrGate.cpp @@ -7,6 +7,7 @@ OrGate::OrGate(Logic* logic) { addInputs(2); addOutputs(1); + setLabel("Or Gate"); recalculateLayout(); } diff --git a/Parts/ToggleButton.cpp b/Parts/ToggleButton.cpp index dc1fbf7..1f19205 100644 --- a/Parts/ToggleButton.cpp +++ b/Parts/ToggleButton.cpp @@ -7,6 +7,7 @@ ToggleButton::ToggleButton(Logic* logic) { addInputs(0); addOutputs(1); + setLabel("Toggle Button"); recalculateLayout(); m_brushColorNormal = Qt::GlobalColor::red; m_brushColorSelected = Qt::GlobalColor::red; @@ -14,6 +15,7 @@ ToggleButton::ToggleButton(Logic* logic) QVector ToggleButton::compute(QVector inputs) { + Q_UNUSED(inputs) QVector ret(1); ret[0] = m_toggleState; return ret; diff --git a/Parts/XnorGate.cpp b/Parts/XnorGate.cpp index 0e19812..ce62f43 100644 --- a/Parts/XnorGate.cpp +++ b/Parts/XnorGate.cpp @@ -7,6 +7,7 @@ XnorGate::XnorGate(Logic* logic) { addInputs(2); addOutputs(1); + setLabel("Xnor Gate"); recalculateLayout(); } diff --git a/Parts/XorGate.cpp b/Parts/XorGate.cpp index f5266ef..e231d6e 100644 --- a/Parts/XorGate.cpp +++ b/Parts/XorGate.cpp @@ -7,6 +7,7 @@ XorGate::XorGate(Logic* logic) { addInputs(2); addOutputs(1); + setLabel("Xor Gate"); recalculateLayout(); } diff --git a/Scene.cpp b/Scene.cpp index 3d2ebcb..55d028c 100644 --- a/Scene.cpp +++ b/Scene.cpp @@ -13,7 +13,6 @@ #include "UndoCommands/MoveParts.h" #include "UndoCommands/RemoveParts.h" #include "UndoCommands/RemoveWire.h" -//#include "UndoCommands/CopyParts.h" #include "FileHandler.h" @@ -229,7 +228,7 @@ void Scene::connectorClicked(Connector *connector) } } else - //Same stuff here, but with connectorSelectedRight instead of connectorSelectedLeft + //Same here, but with connectorSelectedRight instead of connectorSelectedLeft { if(m_selectedOutputConnector == connector) { diff --git a/eAlignMode.h b/eAlignMode.h index fa37175..89dc159 100644 --- a/eAlignMode.h +++ b/eAlignMode.h @@ -1,4 +1,21 @@ #ifndef EALIGNMODE_H #define EALIGNMODE_H +#define mkAlignMode(hPolicy, vPolicy) (AlignMode::AlignMode)(hPolicy | vPolicy) + +namespace AlignMode +{ + enum AlignMode : int + { + Left = 1, + Right = 2, + HCenter = 4, + Top = 8, + Bottom = 16, + VCenter = 32, + + Default = Left | Top + }; +} + #endif // EALIGNMODE_H