6822a3be |
1 | // Created on: 2017-06-16 |
2 | // Created by: Natalia ERMOLAEVA |
3 | // Copyright (c) 2017 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef TreeModel_HeaderSection_H |
17 | #define TreeModel_HeaderSection_H |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_Macro.hxx> |
21 | |
22 | #include <inspector/TreeModel_Tools.hxx> |
23 | |
24 | #include <Standard_WarningsDisable.hxx> |
25 | #include <QString> |
26 | #include <Standard_WarningsRestore.hxx> |
27 | |
28 | //! \class TreeModel_HeaderSection |
29 | //! \brief Container of tree view header sections, like width, visibility, text value |
30 | class TreeModel_HeaderSection |
31 | { |
32 | public: |
33 | //! Constructor |
34 | TreeModel_HeaderSection() : myName(), myWidth (-1), myIsHidden (false), myIsItalic (false) {} |
35 | |
36 | //! Constructor |
37 | TreeModel_HeaderSection (const QString& theName, const int theWidth = -1, const bool theIsHidden = false, |
38 | const bool theIsItalic = false) |
39 | : myName (theName), myWidth (theWidth), myIsHidden (theIsHidden), myIsItalic (theIsItalic) {} |
40 | |
41 | //! Destructor |
42 | ~TreeModel_HeaderSection() {} |
43 | |
7e1c1e48 |
44 | //! Returns whether the header section is not initialized with values. |
45 | //! The check is empty value of the name text |
46 | //! \return boolean value |
47 | bool IsEmpty() const { return myName.isEmpty(); } |
48 | |
6822a3be |
49 | //! Sets text value |
50 | //! \theName text value |
51 | void SetName (const QString& theName) { myName = theName; } |
52 | |
53 | //! Returns text value |
54 | QString GetName() const { return myName; } |
55 | |
56 | //! Sets section width |
57 | //! \param theValue width value |
58 | void SetWidth (const int theWidth) { myWidth = theWidth; } |
59 | |
60 | //! Returns section width |
61 | int GetWidth (const bool isComputeDefault = true) const |
62 | { return (myWidth ==-1 && isComputeDefault) ? TreeModel_Tools::GetTextWidth (GetName(), 0) : myWidth; } |
63 | |
64 | //! Sets section width |
65 | void SetIsHidden (bool isHidden) { myIsHidden = isHidden; } |
66 | |
67 | //! Returns if the section is visiblt |
68 | bool IsHidden() const { return myIsHidden; } |
69 | |
70 | //! Sets section width |
71 | void SetIsItalic (bool isItalic) { myIsItalic = isItalic; } |
72 | |
73 | //! Returns if the section is visiblt |
74 | bool IsItalic() const { return myIsItalic; } |
75 | |
76 | private: |
7e1c1e48 |
77 | QString myName; //!< text value |
78 | int myWidth; //!< section width |
79 | bool myIsHidden; //!< visibility |
80 | bool myIsItalic; //!< italic |
6822a3be |
81 | }; |
82 | |
83 | #endif |