]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wx/lib/pdfwin.py
avoid assert in wxMac port, only change the font point size when we
[wxWidgets.git] / wxPython / wx / lib / pdfwin.py
CommitLineData
b7c75283
RD
1#----------------------------------------------------------------------
2# Name: wx.lib.pdfwin
3# Purpose: A class that allows the use of the Acrobat PSF reader
4# ActiveX control
5#
6# Author: Robin Dunn
7#
8# Created: 22-March-2004
9# RCS-ID: $Id$
10# Copyright: (c) 2004 by Total Control Software
11# Licence: wxWindows license
12#----------------------------------------------------------------------
13# This module was generated by the wx.activex.GernerateAXModule class
14# (See also the genaxmodule script.)
15
16import wx
17import wx.activex
18
19clsID = '{CA8A9780-280D-11CF-A24D-444553540000}'
a7a01418 20progID = 'AcroPDF.PDF.1'
b7c75283
RD
21
22
23
a7a01418
RD
24# Create eventTypes and event binders
25wxEVT_Error = wx.activex.RegisterActiveXEvent('OnError')
26wxEVT_Message = wx.activex.RegisterActiveXEvent('OnMessage')
27
28EVT_Error = wx.PyEventBinder(wxEVT_Error, 1)
29EVT_Message = wx.PyEventBinder(wxEVT_Message, 1)
30
31
b7c75283
RD
32# Derive a new class from ActiveXWindow
33class PDFWindow(wx.activex.ActiveXWindow):
34 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
35 size=wx.DefaultSize, style=0, name='PDFWindow'):
36 wx.activex.ActiveXWindow.__init__(self, parent,
37 wx.activex.CLSID('{CA8A9780-280D-11CF-A24D-444553540000}'),
38 ID, pos, size, style, name)
39
40 # Methods exported by the ActiveX object
a7a01418
RD
41 def QueryInterface(self, riid):
42 return self.CallAXMethod('QueryInterface', riid)
43
44 def AddRef(self):
45 return self.CallAXMethod('AddRef')
46
47 def Release(self):
48 return self.CallAXMethod('Release')
49
50 def GetTypeInfoCount(self):
51 return self.CallAXMethod('GetTypeInfoCount')
52
53 def GetTypeInfo(self, itinfo, lcid):
54 return self.CallAXMethod('GetTypeInfo', itinfo, lcid)
55
56 def GetIDsOfNames(self, riid, rgszNames, cNames, lcid):
57 return self.CallAXMethod('GetIDsOfNames', riid, rgszNames, cNames, lcid)
58
59 def Invoke(self, dispidMember, riid, lcid, wFlags, pdispparams):
60 return self.CallAXMethod('Invoke', dispidMember, riid, lcid, wFlags, pdispparams)
61
b7c75283
RD
62 def LoadFile(self, fileName):
63 return self.CallAXMethod('LoadFile', fileName)
64
65 def setShowToolbar(self, On):
66 return self.CallAXMethod('setShowToolbar', On)
67
68 def gotoFirstPage(self):
69 return self.CallAXMethod('gotoFirstPage')
70
71 def gotoLastPage(self):
72 return self.CallAXMethod('gotoLastPage')
73
74 def gotoNextPage(self):
75 return self.CallAXMethod('gotoNextPage')
76
77 def gotoPreviousPage(self):
78 return self.CallAXMethod('gotoPreviousPage')
79
80 def setCurrentPage(self, n):
81 return self.CallAXMethod('setCurrentPage', n)
82
83 def goForwardStack(self):
84 return self.CallAXMethod('goForwardStack')
85
86 def goBackwardStack(self):
87 return self.CallAXMethod('goBackwardStack')
88
89 def setPageMode(self, pageMode):
90 return self.CallAXMethod('setPageMode', pageMode)
91
92 def setLayoutMode(self, layoutMode):
93 return self.CallAXMethod('setLayoutMode', layoutMode)
94
95 def setNamedDest(self, namedDest):
96 return self.CallAXMethod('setNamedDest', namedDest)
97
98 def Print(self):
99 return self.CallAXMethod('Print')
100
101 def printWithDialog(self):
102 return self.CallAXMethod('printWithDialog')
103
104 def setZoom(self, percent):
105 return self.CallAXMethod('setZoom', percent)
106
107 def setZoomScroll(self, percent, left, top):
108 return self.CallAXMethod('setZoomScroll', percent, left, top)
109
110 def setView(self, viewMode):
111 return self.CallAXMethod('setView', viewMode)
112
113 def setViewScroll(self, viewMode, offset):
114 return self.CallAXMethod('setViewScroll', viewMode, offset)
115
116 def setViewRect(self, left, top, width, height):
117 return self.CallAXMethod('setViewRect', left, top, width, height)
118
119 def printPages(self, from_, to):
120 return self.CallAXMethod('printPages', from_, to)
121
122 def printPagesFit(self, from_, to, shrinkToFit):
123 return self.CallAXMethod('printPagesFit', from_, to, shrinkToFit)
124
125 def printAll(self):
126 return self.CallAXMethod('printAll')
127
128 def printAllFit(self, shrinkToFit):
129 return self.CallAXMethod('printAllFit', shrinkToFit)
130
131 def setShowScrollbars(self, On):
132 return self.CallAXMethod('setShowScrollbars', On)
133
a7a01418
RD
134 def GetVersions(self):
135 return self.CallAXMethod('GetVersions')
136
137 def setCurrentHightlight(self, a, b, c, d):
138 return self.CallAXMethod('setCurrentHightlight', a, b, c, d)
139
140 def setCurrentHighlight(self, a, b, c, d):
141 return self.CallAXMethod('setCurrentHighlight', a, b, c, d)
142
143 def postMessage(self, strArray):
144 return self.CallAXMethod('postMessage', strArray)
145
146 # Getters, Setters and properties
147 def _get_src(self):
148 return self.GetAXProp('src')
149 def _set_src(self, src):
150 self.SetAXProp('src', src)
151 src = property(_get_src, _set_src)
152
153 def _get_messageHandler(self):
154 return self.GetAXProp('messageHandler')
155 def _set_messageHandler(self, messageHandler):
156 self.SetAXProp('messageHandler', messageHandler)
157 messagehandler = property(_get_messageHandler, _set_messageHandler)
b7c75283
RD
158
159
160# PROPERTIES
161# --------------------
a7a01418
RD
162# src
163# type:string arg:string canGet:True canSet:True
164#
165# messagehandler
166# type:VT_VARIANT arg:VT_VARIANT canGet:True canSet:True
167#
b7c75283
RD
168#
169#
170#
171# METHODS
172# --------------------
a7a01418
RD
173# QueryInterface
174# retType: VT_VOID
175# params:
176# riid
177# in:True out:False optional:False type:unsupported type 29
178# ppvObj
179# in:False out:True optional:False type:unsupported type 26
180#
181# AddRef
182# retType: int
183#
184# Release
185# retType: int
186#
187# GetTypeInfoCount
188# retType: VT_VOID
189# params:
190# pctinfo
191# in:False out:True optional:False type:int
192#
193# GetTypeInfo
194# retType: VT_VOID
195# params:
196# itinfo
197# in:True out:False optional:False type:int
198# lcid
199# in:True out:False optional:False type:int
200# pptinfo
201# in:False out:True optional:False type:unsupported type 26
202#
203# GetIDsOfNames
204# retType: VT_VOID
205# params:
206# riid
207# in:True out:False optional:False type:unsupported type 29
208# rgszNames
209# in:True out:False optional:False type:unsupported type 26
210# cNames
211# in:True out:False optional:False type:int
212# lcid
213# in:True out:False optional:False type:int
214# rgdispid
215# in:False out:True optional:False type:int
216#
217# Invoke
218# retType: VT_VOID
219# params:
220# dispidMember
221# in:True out:False optional:False type:int
222# riid
223# in:True out:False optional:False type:unsupported type 29
224# lcid
225# in:True out:False optional:False type:int
226# wFlags
227# in:True out:False optional:False type:int
228# pdispparams
229# in:True out:False optional:False type:unsupported type 29
230# pvarResult
231# in:False out:True optional:False type:VT_VARIANT
232# pexcepinfo
233# in:False out:True optional:False type:unsupported type 29
234# puArgErr
235# in:False out:True optional:False type:int
236#
b7c75283
RD
237# LoadFile
238# retType: bool
239# params:
240# fileName
a7a01418 241# in:True out:False optional:False type:string
b7c75283
RD
242#
243# setShowToolbar
244# retType: VT_VOID
245# params:
246# On
a7a01418 247# in:True out:False optional:False type:bool
b7c75283
RD
248#
249# gotoFirstPage
250# retType: VT_VOID
251#
252# gotoLastPage
253# retType: VT_VOID
254#
255# gotoNextPage
256# retType: VT_VOID
257#
258# gotoPreviousPage
259# retType: VT_VOID
260#
261# setCurrentPage
262# retType: VT_VOID
263# params:
264# n
a7a01418 265# in:True out:False optional:False type:int
b7c75283
RD
266#
267# goForwardStack
268# retType: VT_VOID
269#
270# goBackwardStack
271# retType: VT_VOID
272#
273# setPageMode
274# retType: VT_VOID
275# params:
276# pageMode
a7a01418 277# in:True out:False optional:False type:string
b7c75283
RD
278#
279# setLayoutMode
280# retType: VT_VOID
281# params:
282# layoutMode
a7a01418 283# in:True out:False optional:False type:string
b7c75283
RD
284#
285# setNamedDest
286# retType: VT_VOID
287# params:
288# namedDest
a7a01418 289# in:True out:False optional:False type:string
b7c75283
RD
290#
291# Print
292# retType: VT_VOID
293#
294# printWithDialog
295# retType: VT_VOID
296#
297# setZoom
298# retType: VT_VOID
299# params:
300# percent
a7a01418 301# in:True out:False optional:False type:double
b7c75283
RD
302#
303# setZoomScroll
304# retType: VT_VOID
305# params:
306# percent
a7a01418 307# in:True out:False optional:False type:double
b7c75283 308# left
a7a01418 309# in:True out:False optional:False type:double
b7c75283 310# top
a7a01418 311# in:True out:False optional:False type:double
b7c75283
RD
312#
313# setView
314# retType: VT_VOID
315# params:
316# viewMode
a7a01418 317# in:True out:False optional:False type:string
b7c75283
RD
318#
319# setViewScroll
320# retType: VT_VOID
321# params:
322# viewMode
a7a01418 323# in:True out:False optional:False type:string
b7c75283 324# offset
a7a01418 325# in:True out:False optional:False type:double
b7c75283
RD
326#
327# setViewRect
328# retType: VT_VOID
329# params:
330# left
a7a01418 331# in:True out:False optional:False type:double
b7c75283 332# top
a7a01418 333# in:True out:False optional:False type:double
b7c75283 334# width
a7a01418 335# in:True out:False optional:False type:double
b7c75283 336# height
a7a01418 337# in:True out:False optional:False type:double
b7c75283
RD
338#
339# printPages
340# retType: VT_VOID
341# params:
342# from
a7a01418 343# in:True out:False optional:False type:int
b7c75283 344# to
a7a01418 345# in:True out:False optional:False type:int
b7c75283
RD
346#
347# printPagesFit
348# retType: VT_VOID
349# params:
350# from
a7a01418 351# in:True out:False optional:False type:int
b7c75283 352# to
a7a01418 353# in:True out:False optional:False type:int
b7c75283 354# shrinkToFit
a7a01418 355# in:True out:False optional:False type:bool
b7c75283
RD
356#
357# printAll
358# retType: VT_VOID
359#
360# printAllFit
361# retType: VT_VOID
362# params:
363# shrinkToFit
a7a01418 364# in:True out:False optional:False type:bool
b7c75283
RD
365#
366# setShowScrollbars
367# retType: VT_VOID
368# params:
369# On
a7a01418 370# in:True out:False optional:False type:bool
b7c75283 371#
a7a01418
RD
372# GetVersions
373# retType: VT_VARIANT
374#
375# setCurrentHightlight
376# retType: VT_VOID
377# params:
378# a
379# in:True out:False optional:False type:int
380# b
381# in:True out:False optional:False type:int
382# c
383# in:True out:False optional:False type:int
384# d
385# in:True out:False optional:False type:int
386#
387# setCurrentHighlight
388# retType: VT_VOID
389# params:
390# a
391# in:True out:False optional:False type:int
392# b
393# in:True out:False optional:False type:int
394# c
395# in:True out:False optional:False type:int
396# d
397# in:True out:False optional:False type:int
398#
399# postMessage
b7c75283 400# retType: VT_VOID
a7a01418
RD
401# params:
402# strArray
403# in:True out:False optional:False type:VT_VARIANT
b7c75283
RD
404#
405#
406#
407#
408# EVENTS
409# --------------------
a7a01418
RD
410# Error
411# retType: VT_VOID
412#
413# Message
414# retType: VT_VOID
415#
b7c75283
RD
416#
417#
418#