libyui-qt-graph  2.43.0
 All Classes Functions
YQGraph.h
1 /*
2  * Copyright (c) [2009-2012] Novell, Inc.
3  *
4  * All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as published
8  * by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, contact Novell, Inc.
17  *
18  * To contact Novell about this file by physical or electronic mail, you may
19  * find current contact information at www.novell.com.
20  */
21 
22 /*
23  * File: YQGraph.h
24  * Author: Arvin Schnell <aschnell@suse.de>
25  */
26 
27 
28 #ifndef YQGraph_h
29 #define YQGraph_h
30 
31 #include <YGraph.h>
32 
33 #include "QY2Graph.h"
34 
35 
36 class YQGraph : public QY2Graph, public YGraph
37 {
38  Q_OBJECT
39 
40 public:
41 
42  YQGraph(YWidget* parent, const std::string& filename, const std::string& layoutAlgorithm);
43 
44  YQGraph(YWidget* parent, /* graph_t */ void* graph);
45 
46  virtual ~YQGraph();
47 
48  /**
49  * Preferred width of the widget.
50  *
51  * Reimplemented from YWidget.
52  **/
53  virtual int preferredWidth();
54 
55  /**
56  * Preferred height of the widget.
57  *
58  * Reimplemented from YWidget.
59  **/
60  virtual int preferredHeight();
61 
62  /**
63  * Set the new size of the widget.
64  *
65  * Reimplemented from YWidget.
66  **/
67  virtual void setSize(int newWidth, int newHeight);
68 
69  void renderGraph(const std::string& filename, const std::string& layoutAlgorithm);
70 
71  void renderGraph(/* graph_t */ void* graph);
72 
73  std::string activatedNode() const { return lastActivatedNode; }
74 
75 private slots:
76 
77  void backgroundContextMenu(QContextMenuEvent* event);
78  void nodeContextMenu(QContextMenuEvent* event, const QString& name);
79  void nodeDoubleClick(QMouseEvent* event, const QString& name);
80 
81 private:
82 
83  void init();
84 
85  std::string lastActivatedNode;
86 
87 };
88 
89 
90 #endif // YQGraph_h
virtual int preferredWidth()
Definition: YQGraph.cc:95
virtual void setSize(int newWidth, int newHeight)
Definition: YQGraph.cc:109
virtual int preferredHeight()
Definition: YQGraph.cc:102