1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
/***************************************************************************
* Copyright (C) 2004-2007 by Georgy Yunaev, [email protected] *
* Please do not use email address above for bug reports; see *
* the README file *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KCHMVIEWWINDOW_H
#define KCHMVIEWWINDOW_H
#include "forwarddeclarations.h"
#include "kde-qt.h"
/**
@author Georgy Yunaev
*/
class KCHMViewWindow
{
public:
KCHMViewWindow ( TQTabWidget * parent );
virtual ~KCHMViewWindow();
//! Open a page from current chm archive
bool openUrl (const TQString& url );
TQString getBaseUrl() const { return m_base_url; }
TQString getOpenedPage() const { return m_openedPage; }
TQString getNewTabLink() const { return m_newTabLinkKeeper; }
TQString makeURLabsolute ( const TQString &url, bool set_as_base = true );
public:
// virtual members, which should be implemented by viewers
//! Invalidate current view, doing all the cleanups etc.
virtual void invalidate();
//! Popups the print dialog, and prints the current page on the printer.
virtual bool printCurrentPage() = 0;
//! Continues the find-in-page search forward or backward
virtual void searchWord( const TQString & word, bool forward = true, bool casesensitive = false ) = 0;
//! Return current ZoomFactor.
virtual int getZoomFactor() const = 0;
//! Sets ZoomFactor. The value returned by getZoomFactor(), given to this function, should give the same result.
virtual void setZoomFactor (int zoom) = 0;
//! Relatively changes ZoomFactor. Most common values are -1 and 1.
virtual void addZoomFactor (int value) = 0;
virtual TQObject * getTQObject() = 0;
virtual TQWidget * getTQWidget() = 0;
/*!
* Return current scrollbar position in view window. Saved on program exit.
* There is no restriction on returned value, except that giving this value to
* setScrollbarPosition() should move the scrollbar in the same position.
*/
virtual int getScrollbarPosition() = 0;
//! Sets the scrollbar position.
virtual void setScrollbarPosition(int pos) = 0;
//! Select the content of the whole page
virtual void clipSelectAll() = 0;
//! Copies the selected content to the clipboard
virtual void clipCopy() = 0;
//! Returns the window title
virtual TQString getTitle() const;
//! Navigation stuff
virtual void navigateBack();
virtual void navigateHome();
virtual void navigateForward();
//! Navigation auxiliary stuff
virtual void setHistoryMaxSize (unsigned int size) { m_historyMaxSize = size; }
virtual void addNavigationHistory( const TQString & url, int scrollpos );
virtual void updateNavigationToolbar();
/*!
* Used by contents window (and probably by other windows in future) to show
* context menu in listviews. Put here to futher reuse code in index and search windows.
*/
KTQPopupMenu * createListItemContextMenu ( TQWidget * w );
void setTabKeeper ( const TQString& link );
protected: /* signals */
/*!
* Emitted when the user clicked on the link, before the page changed.
* If linkClicked() return false, the current page should NOT change.
* Otherwise it should be changed to the new link value.
*/
virtual void signalLinkClicked ( const TQString & newlink, bool& follow_link ) = 0;
protected:
virtual bool openPage ( const TQString& url ) = 0;
virtual void handleStartPageAsImage( TQString& link );
KTQPopupMenu * getContextMenu( const TQString& link, TQWidget * parent );
KTQPopupMenu * createStandardContextMenu( TQWidget * parent );
//! History
class KCHMUrlHistory
{
public:
KCHMUrlHistory() { scrollbarpos = 0; }
KCHMUrlHistory( const TQString& _url, int _scrollbarpos )
: url(_url), scrollbarpos(_scrollbarpos) {};
const TQString& getUrl() const { return url; }
int getScrollPosition() const { return scrollbarpos; }
void setScrollPosition( int pos ) { scrollbarpos = pos; }
private:
TQString url;
int scrollbarpos;
};
unsigned int m_historyMaxSize;
unsigned int m_historyCurrentPos;
TQValueList<KCHMUrlHistory> m_history;
KTQPopupMenu * m_contextMenu;
KTQPopupMenu * m_contextMenuLink;
// This member keeps a "open new tab" link between getContextMenu() call and appropriate
// slot call
TQString m_newTabLinkKeeper;
TQString m_openedPage;
TQString m_lastOpenedPage;
TQString m_base_url;
TQTabWidget * m_parentTabWidget;
};
#endif
|