Vidalia  0.3.1
VAttachButton.cpp
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file VAttachButton.cpp
13 ** \brief Button that handles detaching of tabs
14 */
15 
16 #include "VAttachButton.h"
17 
18 #define IMG_DETACH ":/images/16x16/detach-arrow.png"
19 
20 VAttachButton::VAttachButton(QWidget *parent) :
21  QPushButton(parent)
22 {
23  _tab = 0;
24  _attached = true;
25  setIcon(QIcon(IMG_DETACH));
26  setFlat(true);
27  resize(24,24);
28 }
29 
31 {
32  disconnect(this,0,0,0);
33 }
34 
35 void
37 {
38  _tab = tab;
39  connect(this, SIGNAL(clicked()), this, SLOT(toggleAttach()));
40 }
41 
42 VidaliaTab *
44 {
45  return _tab;
46 }
47 
48 void
50 {
51  if(_attached) {
52  emit detachTab();
53  } else {
54  emit attachTab();
55  }
57 }
58