2 * Copyright (C) 2007 Pekka Lampila <pekka.lampila@iki.fi>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
24 #include "swfdec_as_internal.h"
25 #include "swfdec_as_strings.h"
26 #include "swfdec_as_context.h"
27 #include "swfdec_debug.h"
29 SWFDEC_AS_NATIVE (111, 100, swfdec_print_job_start
)
31 swfdec_print_job_start (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
32 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
34 SWFDEC_STUB ("PrintJob.start");
37 SWFDEC_AS_NATIVE (111, 101, swfdec_print_job_addPage
)
39 swfdec_print_job_addPage (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
40 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
42 SWFDEC_STUB ("PrintJob.addPage");
45 SWFDEC_AS_NATIVE (111, 102, swfdec_print_job_send
)
47 swfdec_print_job_send (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
48 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
50 SWFDEC_STUB ("PrintJob.send");
54 swfdec_print_job_get_orientation (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
55 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
57 SWFDEC_STUB ("PrintJob.orientation (get)");
61 swfdec_print_job_get_pageHeight (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
62 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
64 SWFDEC_STUB ("PrintJob.pageHeight (get)");
68 swfdec_print_job_get_pageWidth (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
69 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
71 SWFDEC_STUB ("PrintJob.pageWidth (get)");
75 swfdec_print_job_get_paperHeight (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
76 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
78 SWFDEC_STUB ("PrintJob.paperHeight (get)");
82 swfdec_print_job_get_paperWidth (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
83 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
85 SWFDEC_STUB ("PrintJob.paperWidth (get)");
89 swfdec_print_job_init_properties (SwfdecAsContext
*cx
)
92 SwfdecAsObject
*xml
, *proto
;
94 // FIXME: We should only initialize if the prototype Object has not been
95 // initialized by any object's constructor with native properties
96 // (TextField, TextFormat, XML, XMLNode at least)
98 g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx
));
100 swfdec_as_object_get_variable (cx
->global
, SWFDEC_AS_STR_PrintJob
, &val
);
101 if (!SWFDEC_AS_VALUE_IS_OBJECT (val
))
103 xml
= SWFDEC_AS_VALUE_GET_OBJECT (val
);
105 swfdec_as_object_get_variable (xml
, SWFDEC_AS_STR_prototype
, &val
);
106 if (!SWFDEC_AS_VALUE_IS_OBJECT (val
))
108 proto
= SWFDEC_AS_VALUE_GET_OBJECT (val
);
110 swfdec_as_object_add_native_variable (proto
, SWFDEC_AS_STR_orientation
,
111 swfdec_print_job_get_orientation
, NULL
);
112 swfdec_as_object_add_native_variable (proto
, SWFDEC_AS_STR_pageHeight
,
113 swfdec_print_job_get_pageHeight
, NULL
);
114 swfdec_as_object_add_native_variable (proto
, SWFDEC_AS_STR_pageWidth
,
115 swfdec_print_job_get_pageWidth
, NULL
);
116 swfdec_as_object_add_native_variable (proto
, SWFDEC_AS_STR_paperHeight
,
117 swfdec_print_job_get_paperHeight
, NULL
);
118 swfdec_as_object_add_native_variable (proto
, SWFDEC_AS_STR_paperWidth
,
119 swfdec_print_job_get_paperWidth
, NULL
);
122 SWFDEC_AS_NATIVE (111, 0, swfdec_print_job_construct
)
124 swfdec_print_job_construct (SwfdecAsContext
*cx
, SwfdecAsObject
*object
,
125 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*ret
)
127 SWFDEC_STUB ("PrintJob");
129 swfdec_print_job_init_properties (cx
);