1 /*
2 	Copyright (C) 2008, 2009 Andres Cabrera
3 	mantaraya36@gmail.com
4 
5 	This file is part of CsoundQt.
6 
7 	CsoundQt is free software; you can redistribute it
8 	and/or modify it under the terms of the GNU Lesser General Public
9 	License as published by the Free Software Foundation; either
10 	version 2.1 of the License, or (at your option) any later version.
11 
12 	CsoundQt is distributed in the hope that it will be useful,
13 	but WITHOUT ANY WARRANTY; without even the implied warranty of
14 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 	GNU Lesser General Public License for more details.
16 
17 	You should have received a copy of the GNU Lesser General Public
18 	License along with Csound; if not, write to the Free Software
19 	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 	02111-1307 USA
21 */
22 
23 #ifndef DOCKHELP_H
24 #define DOCKHELP_H
25 
26 #include <QDockWidget>
27 #include <QUrl>
28 #include "types.h"
29 #include <QTextDocument>
30 
31 namespace Ui {
32 class DockHelp;
33 }
34 
35 class DockHelp : public QDockWidget
36 {
37 	Q_OBJECT
38 public:
39 	explicit DockHelp(QWidget *parent = 0);
40 	~DockHelp();
41 
42 	bool hasFocus();
43 	void loadFile(QString fileName);
44 	bool externalBrowser;
45 	QString docDir;
46 
47 private:
48 	QTextDocument::FindFlags findFlags;
49 	virtual void closeEvent(QCloseEvent * event);
50     virtual void keyPressEvent(QKeyEvent *event);
51 	void findText(QString expr); // bool backward = false, bool caseSensitive = false, bool wholeWords = false);
52 
53 protected:
54 	void resizeEvent(QResizeEvent *);
55 
56 public slots:
57 	void showManual();
58 	void showGen();
59 	void showOverview();
60 	void showOpcodeQuickRef();
61 	void browseBack();
62 	void browseForward();
63 	void followLink(QUrl url);
64 	void copy();
65 	void onTextChanged();
66 	void onReturnPressed();
67 	void onNextButtonPressed();
68 	void onPreviousButtonPressed();
69 	void onWholeWordBoxChanged(int value);
70 	void onCaseBoxChanged(int value);
71     void focusText();
setVisibleAndRaise(bool show)72     void setVisibleAndRaise(bool show) {
73         setVisible(show);
74         if(show)
75             raise();
76     }
77     void toggleFindBarVisible(bool show);
78 
79 
80 private:
81 	Ui::DockHelp *ui;
82 
83 signals:
84 	void Close(bool visible);
85 	void openManualExample(QString fileName);
86 
87 };
88 
89 #endif
90