Bug 22803 - Make header conform to implementation
[swfdec.git] / swfdec / swfdec_print_job.c
blob5bf334ba313a797d0e098612e3367229854c62ce
1 /* Swfdec
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.
8 *
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
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
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)
30 void
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)
38 void
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)
46 void
47 swfdec_print_job_send (SwfdecAsContext *cx, SwfdecAsObject *object,
48 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
50 SWFDEC_STUB ("PrintJob.send");
53 static void
54 swfdec_print_job_get_orientation (SwfdecAsContext *cx, SwfdecAsObject *object,
55 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
57 SWFDEC_STUB ("PrintJob.orientation (get)");
60 static void
61 swfdec_print_job_get_pageHeight (SwfdecAsContext *cx, SwfdecAsObject *object,
62 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
64 SWFDEC_STUB ("PrintJob.pageHeight (get)");
67 static void
68 swfdec_print_job_get_pageWidth (SwfdecAsContext *cx, SwfdecAsObject *object,
69 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
71 SWFDEC_STUB ("PrintJob.pageWidth (get)");
74 static void
75 swfdec_print_job_get_paperHeight (SwfdecAsContext *cx, SwfdecAsObject *object,
76 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
78 SWFDEC_STUB ("PrintJob.paperHeight (get)");
81 static void
82 swfdec_print_job_get_paperWidth (SwfdecAsContext *cx, SwfdecAsObject *object,
83 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
85 SWFDEC_STUB ("PrintJob.paperWidth (get)");
88 static void
89 swfdec_print_job_init_properties (SwfdecAsContext *cx)
91 SwfdecAsValue val;
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))
102 return;
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))
107 return;
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)
123 void
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);