73bbb5e5e6f4807b26ce75c4e605e1f2baf47e6e
[vietkaralist] / qml / vietkaralist / TopBar.qml
1 /*
2 Copyright (C) 2011  by Cuong Le <metacuong@gmail.com>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>
16 */
17
18 import QtQuick 1.1
19
20 Item {
21
22     id:m_topbar
23
24     anchors.fill: parent
25
26     property alias title: mTitle.text
27
28     Rectangle {
29
30         width: parent.width-1
31         height: 49
32
33         color: "white"
34
35         radius: 0
36         border.color: "grey"
37
38         Text {
39             id : mTitle
40
41             color: "blue"
42
43             horizontalAlignment: Text.AlignHCenter
44
45             anchors.horizontalCenter: parent.horizontalCenter
46
47             font.bold: true
48             font.pixelSize: 22
49
50             y:10
51
52         }
53
54
55     }
56
57     /*
58       Minimize button
59       */
60
61     Rectangle {
62         id: btn_minimize
63
64         x:m_topbar.x + 5
65         y:m_topbar.y + 5
66
67         height: 40
68         width: 45
69
70         color: "transparent"
71
72         border.color: "grey"
73         border.width: 1
74
75         radius: 4
76
77         Rectangle {
78             x:parent.x
79             y:parent.y
80
81             width: parent.width - 15
82             height: parent.height - 15
83
84             border.color: "white"
85             color: "grey"
86             border.width: 1
87         }
88
89         Rectangle {
90             x:parent.x + 5
91             y:parent.y + 5
92             width: parent.width - 15
93             height: parent.height - 15
94
95             border.color: "white"
96             color: "grey"
97             border.width: 1
98         }
99
100         MouseArea {
101             anchors.fill: parent
102
103             onClicked: AppMan.minimize();
104
105             onPressed: {
106                 parent.color = "blue"
107             }
108
109             onReleased: {
110                 parent.color = "transparent"
111             }
112         }
113
114     }
115
116     /*
117           Close button
118           */
119
120         Rectangle {
121             id: btn_close
122
123             x:m_topbar.width - 50
124             y:m_topbar.y + 5
125
126             width: 45
127             height: 40
128
129             color: "transparent"
130
131             border.color: "grey"
132             border.width: 1
133
134             radius: 4
135
136             Text {
137                 id: button1
138                 color: "grey"
139                 anchors.centerIn: parent; font.bold: true
140                 text: "X"; style: Text.Raised; styleColor: "black"
141                 font.pixelSize: 26
142                 font.family: "Tahoma"
143             }
144
145             MouseArea {
146                 anchors.fill: parent
147
148                 onClicked: Qt.quit()
149
150                 onPressed: {
151                     parent.color = "blue"
152                 }
153
154                 onReleased: {
155                     parent.color = "transparent"
156                 }
157             }
158         }
159
160 }