Debian Codegraph @

DatabaseExplorer/ErdTable.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : ErdTable.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef ERDTABLE_H
27 #define ERDTABLE_H
28
29 #include <wx/wx.h>
30 #include <wx/wxxmlserializer/XmlSerializer.h>
31 #include "wx/wxsf/RoundRectShape.h"
32 #include "wx/wxsf/BitmapShape.h"
33 #include "wx/wxsf/TextShape.h"
34 #include "wx/wxsf/FlexGridShape.h"
35 #include "wx/wxsf/DiagramManager.h"
36 #include "table.h"
37 #include "constraint.h"
38 #include "ErdForeignKey.h"
39 #include "NArrow.h"
40 #include "IDbType.h"
41 /*! \brief Class representig table graphics in ERD diagram. For more info see wxSF manual. */
42 class ErdTable : public wxSFRoundRectShape {
43
44 public:
45 XS_DECLARE_CLONABLE_CLASS(ErdTable);
46
47 ErdTable();
48 ErdTable(const ErdTable& obj);
49 ErdTable(Table* tab);
50
51 virtual ~ErdTable();
52
53 void AddColumn(const wxString& colName, IDbType* type);
54 void UpdateColumns();
55
56 Table* GetTable() { return (Table*) this->GetUserData(); }
57
58 protected:
59 void Initialize();
60
61 wxSFTextShape *m_pLabel;
62 wxSFFlexGridShape* m_pGrid;
63
64 virtual void DrawHighlighted(wxDC& dc);
65 virtual void DrawHover(wxDC& dc);
66 virtual void DrawNormal(wxDC& dc);
67
68 void DrawDetails(wxDC& dc);
69
70 void ClearGrid();
71 void ClearConnections();
72 void AddColumnShape(const wxString& colName, int id, Constraint::constraintType type);
73 void SetCommonProps(wxSFShapeBase* shape);
74 };
75
76 #endif // ERDTABLE_H