~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/scriptengines/ruby/applet.rb

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=begin
 
2
 *   Copyright 2008-2010 by Richard Dale <richard.j.dale@gmail.com>
 
3
 *
 
4
 *   This program is free software; you can redistribute it and/or modify
 
5
 *   it under the terms of the GNU Library General Public License as
 
6
 *   published by the Free Software Foundation; either version 2, or
 
7
 *   (at your option) any later version.
 
8
 *
 
9
 *   This program 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
 
12
 *   GNU General Public License for more details
 
13
 *
 
14
 *   You should have received a copy of the GNU Library General Public
 
15
 *   License along with this program; if not, write to the
 
16
 *   Free Software Foundation, Inc.,
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
=end
 
19
 
 
20
require 'plasma_applet'
 
21
 
 
22
module PlasmaScripting
 
23
  class Applet < Qt::Object
 
24
    slots  "setImmutability(Plasma::ImmutabilityType)",
 
25
            :destroy,
 
26
            :showConfigurationInterface,
 
27
            :raise,
 
28
            :lower,
 
29
            :flushPendingConstraintsEvents,
 
30
            :init,
 
31
            'initExtenderItem(Plasma::ExtenderItem*)'
 
32
 
 
33
    signals :releaseVisualFocus,
 
34
            :geometryChanged,
 
35
            :configNeedsSaving,
 
36
            :activate
 
37
 
 
38
    attr_accessor :applet_script
 
39
 
 
40
    def initialize(parent, args = nil)
 
41
      super(parent)
 
42
      @applet_script = parent
 
43
      connect(@applet_script.applet, SIGNAL(:releaseVisualFocus), self, SIGNAL(:releaseVisualFocus))
 
44
      connect(@applet_script.applet, SIGNAL(:geometryChanged), self, SIGNAL(:geometryChanged))
 
45
      connect(@applet_script.applet, SIGNAL(:configNeedsSaving), self, SIGNAL(:configNeedsSaving))
 
46
      connect(@applet_script.applet, SIGNAL(:activate), self, SIGNAL(:activate))
 
47
      connect(@applet_script.applet, SIGNAL('extenderItemRestored(Plasma::ExtenderItem*)'), self, SLOT('initExtenderItem(Plasma::ExtenderItem*)'))
 
48
    end
 
49
 
 
50
    # If a method is called on a PlasmaScripting::Applet instance is found to be missing
 
51
    # then try calling the method on the underlying Plasma::Applet in the ScriptEngine.
 
52
    def method_missing(method, *args)
 
53
      begin
 
54
        super(method, *args)
 
55
      rescue
 
56
        applet_script.applet.method_missing(method, *args)
 
57
      end
 
58
    end
 
59
 
 
60
    def self.const_missing(name)
 
61
      begin
 
62
        super(name)
 
63
      rescue
 
64
        Plasma::Applet.const_missing(name)
 
65
      end
 
66
    end
 
67
 
 
68
    def configChanged
 
69
    end
 
70
 
 
71
    def paintInterface(painter, option, contentsRect)
 
72
    end
 
73
 
 
74
    def initExtenderItem(item)
 
75
      puts "Missing implementation of initExtenderItem in the applet " \
 
76
                   "#{item.config.readEntry('SourceAppletPluginName', '')}" \
 
77
                   "!\n Any applet that uses extenders should implement initExtenderItem to " \
 
78
                   "instantiate a widget."
 
79
    end
 
80
 
 
81
    def size
 
82
      @applet_script.size
 
83
    end
 
84
 
 
85
    def shape
 
86
      @applet_script.shape
 
87
    end
 
88
 
 
89
    def resize(*args)
 
90
      if args.length == 1 && args[0].kindof?(Qt::Size)
 
91
        puts "Warning: invalid resize() call. Add this to your metadata.desktop file:"
 
92
        puts "X-Plasma-DefautSize=%d,%d" % [args[0].width, args[0].height]
 
93
      elsif args.length == 2 
 
94
        puts "Warning: invalid resize() call. Add this to your metadata.desktop file:"
 
95
        puts "X-Plasma-DefautSize=%d,%d" % [args[0].to_i, args[1].to_i]
 
96
      else
 
97
        super(*args)
 
98
      end
 
99
    end
 
100
 
 
101
    def constraintsEvent(constraints)
 
102
    end
 
103
 
 
104
    def contextualActions
 
105
      return []
 
106
    end
 
107
 
 
108
    def createConfigurationInterface(dialog)
 
109
    end
 
110
 
 
111
    def showConfigurationInterface
 
112
    end
 
113
 
 
114
    def dataEngine(engine)
 
115
      @applet_script.dataEngine(engine)
 
116
    end
 
117
 
 
118
    def package
 
119
      @applet_script.package
 
120
    end
 
121
 
 
122
    def setImmutability(immutabilityType)
 
123
      @applet_script.applet.setImmutability(immutabilityType)
 
124
    end
 
125
 
 
126
    def immutability=(immutabilityType)
 
127
      setImmutability(immutabilityType)
 
128
    end
 
129
 
 
130
    def destroy
 
131
      @applet_script.applet.destroy
 
132
    end
 
133
 
 
134
    def raise
 
135
      @applet_script.applet.raise
 
136
    end
 
137
 
 
138
    def lower
 
139
      @applet_script.applet.lower
 
140
    end
 
141
 
 
142
    def flushPendingConstraintsEvents
 
143
      @applet_script.applet.flushPendingConstraintsEvents
 
144
    end
 
145
  end
 
146
 
 
147
  class Containment < Applet
 
148
    def initialize(parent, args = nil)
 
149
      super(parent, args)
 
150
    end
 
151
  end
 
152
 
 
153
  class PopupApplet < Applet
 
154
    def initialize(parent, args = nil)
 
155
      super(parent, args)
 
156
    end
 
157
  end
 
158
end
 
159
 
 
160
module PlasmaScriptengineRuby
 
161
  class Applet < Plasma::AppletScript
 
162
    def initialize(parent, args)
 
163
      super(parent)
 
164
    end
 
165
 
 
166
    def camelize(str)
 
167
      str.gsub(/(^|[._-])(.)/) { $2.upcase }
 
168
    end
 
169
 
 
170
    def init
 
171
      oldSize = applet.size
 
172
 
 
173
      puts "RubyAppletScript::Applet#init mainScript: #{mainScript}"
 
174
      program = Qt::FileInfo.new(mainScript)
 
175
      $: << program.path
 
176
      load Qt::File.encodeName(program.filePath).to_s
 
177
      moduleName = camelize(Qt::Dir.new(package.path).dirName)
 
178
      className = camelize(program.baseName)
 
179
      puts "RubyAppletScript::Applet#init instantiating: #{moduleName}::#{className}"
 
180
      klass = Object.const_get(moduleName.to_sym).const_get(className.to_sym)
 
181
      @applet_script = klass.new(self)
 
182
      @applet_script.init
 
183
      if oldSize.height > 10 && oldSize.width > 10
 
184
        applet.resize(oldSize)
 
185
      end
 
186
 
 
187
      set_up_event_handlers
 
188
      return true
 
189
    end
 
190
 
 
191
    def configChanged
 
192
      @applet_script.configChanged
 
193
    end
 
194
 
 
195
    def paintInterface(painter, option, contentsRect)
 
196
      @applet_script.paintInterface(painter, option, contentsRect)
 
197
    end
 
198
 
 
199
    def constraintsEvent(constraints)
 
200
      @applet_script.constraintsEvent(constraints)
 
201
    end
 
202
 
 
203
    def contextualActions
 
204
      @applet_script.contextualActions
 
205
    end
 
206
 
 
207
    def showConfigurationInterface
 
208
      dialog = standardConfigurationDialog()
 
209
      @applet_script.createConfigurationInterface(dialog)
 
210
      addStandardConfigurationPages(dialog)
 
211
      dialog.show
 
212
    end
 
213
 
 
214
    protected
 
215
 
 
216
    def eventFilter(obj, event)
 
217
      handler = @event_handlers[event.type.to_i]
 
218
      if handler
 
219
        @applet_script.send(handler, event)
 
220
        return true
 
221
      else
 
222
        return false
 
223
      end
 
224
    end
 
225
 
 
226
    private
 
227
 
 
228
    def set_up_event_handlers
 
229
      @event_handlers = {}
 
230
 
 
231
      if @applet_script.respond_to?(:mousePressEvent)
 
232
        @event_handlers[Qt::Event::GraphicsSceneMousePress.to_i] = :mousePressEvent
 
233
      end
 
234
 
 
235
      if @applet_script.respond_to?(:contextMenuEvent)
 
236
        @event_handlers[Qt::Event::GraphicsSceneContextMenu.to_i] = :contextMenuEvent
 
237
      end
 
238
 
 
239
      if @applet_script.respond_to?(:dragEnterEvent)
 
240
        @event_handlers[Qt::Event::GraphicsSceneDragEnter.to_i] = :dragEnterEvent
 
241
      end
 
242
 
 
243
      if @applet_script.respond_to?(:dragLeaveEvent)
 
244
        @event_handlers[Qt::Event::GraphicsSceneDragLeave.to_i] = :dragLeaveEvent
 
245
      end
 
246
 
 
247
      if @applet_script.respond_to?(:dragMoveEvent)
 
248
        @event_handlers[Qt::Event::GraphicsSceneDragMove.to_i] = :dragMoveEvent
 
249
      end
 
250
 
 
251
      if @applet_script.respond_to?(:dropEvent)
 
252
        @event_handlers[Qt::Event::GraphicsSceneDrop.to_i] = :dropEvent
 
253
      end
 
254
 
 
255
      if @applet_script.respond_to?(:focusInEvent)
 
256
        @event_handlers[Qt::Event::FocusIn.to_i] = :focusInEvent
 
257
      end
 
258
 
 
259
      if @applet_script.respond_to?(:focusOutEvent)
 
260
        @event_handlers[Qt::Event::FocusOut.to_i] = :focusOutEvent
 
261
      end
 
262
 
 
263
      if @applet_script.respond_to?(:hoverEnterEvent)
 
264
        @event_handlers[Qt::Event::GraphicsSceneHoverEnter.to_i] = :hoverEnterEvent
 
265
      end
 
266
 
 
267
      if @applet_script.respond_to?(:hoverLeaveEvent)
 
268
        @event_handlers[Qt::Event::GraphicsSceneHoverLeave.to_i] = :hoverLeaveEvent
 
269
      end
 
270
 
 
271
      if @applet_script.respond_to?(:hoverMoveEvent)
 
272
        @event_handlers[Qt::Event::GraphicsSceneHoverMove.to_i] = :hoverMoveEvent
 
273
      end
 
274
 
 
275
      if @applet_script.respond_to?(:inputMethodEvent)
 
276
        @event_handlers[Qt::Event::InputMethod.to_i] = :inputMethodEvent
 
277
      end
 
278
 
 
279
      if @applet_script.respond_to?(:keyPressEvent)
 
280
        @event_handlers[Qt::Event::KeyPress.to_i] = :keyPressEvent
 
281
      end
 
282
 
 
283
      if @applet_script.respond_to?(:keyReleaseEvent)
 
284
        @event_handlers[Qt::Event::KeyRelease.to_i] = :keyReleaseEvent
 
285
      end
 
286
 
 
287
      if @applet_script.respond_to?(:mouseDoubleClickEvent)
 
288
        @event_handlers[Qt::Event::GraphicsSceneMouseDoubleClick.to_i] = :mouseDoubleClickEvent
 
289
      end
 
290
 
 
291
      if @applet_script.respond_to?(:mouseMoveEvent)
 
292
        @event_handlers[Qt::Event::GraphicsSceneMouseMove.to_i] = :mouseMoveEvent
 
293
      end
 
294
 
 
295
      if @applet_script.respond_to?(:mousePressEvent)
 
296
        @event_handlers[Qt::Event::GraphicsSceneMousePress.to_i] = :mousePressEvent
 
297
      end
 
298
 
 
299
      if @applet_script.respond_to?(:mouseReleaseEvent)
 
300
        @event_handlers[Qt::Event::GraphicsSceneMouseRelease.to_i] = :mouseReleaseEvent
 
301
      end
 
302
 
 
303
      if @applet_script.respond_to?(:wheelEvent)
 
304
        @event_handlers[Qt::Event::GraphicsSceneWheel.to_i] = :wheelEvent
 
305
      end
 
306
 
 
307
      if !@event_handlers.empty?
 
308
        applet.installEventFilter(self)
 
309
      end
 
310
    end
 
311
 
 
312
  end
 
313
end
 
314
 
 
315
module Plasma
 
316
  #
 
317
  # Because a PlasmaScript::Applet is not actually a Plasma::Applet we
 
318
  # need to 'cheat' in the api, to pretend that it is. So the constructors
 
319
  # in the Plasma widget classes will substitute any PlasmaScript::Applet
 
320
  # argument passed for the real Plasma::Applet in the ScriptEngine
 
321
  #
 
322
 
 
323
  class BusyWidget < Qt::Base
 
324
    def initialize(parent = nil)
 
325
      if parent.kind_of?(PlasmaScripting::Applet)
 
326
        super(parent.applet_script.applet)
 
327
      else
 
328
        super
 
329
      end
 
330
    end
 
331
  end
 
332
 
 
333
  class CheckBox < Qt::Base
 
334
    def initialize(parent = nil)
 
335
      if parent.kind_of?(PlasmaScripting::Applet)
 
336
        super(parent.applet_script.applet)
 
337
      else
 
338
        super
 
339
      end
 
340
    end
 
341
  end
 
342
 
 
343
  class ComboBox < Qt::Base
 
344
    def initialize(parent = nil)
 
345
      if parent.kind_of?(PlasmaScripting::Applet)
 
346
        super(parent.applet_script.applet)
 
347
      else
 
348
        super
 
349
      end
 
350
    end
 
351
  end
 
352
 
 
353
  class Extender < Qt::Base
 
354
    def initialize(parent = nil)
 
355
      if parent.kind_of?(PlasmaScripting::Applet)
 
356
        super(parent.applet_script.applet)
 
357
      else
 
358
        super
 
359
      end
 
360
    end
 
361
  end
 
362
 
 
363
  class FlashingLabel < Qt::Base
 
364
    def initialize(parent = nil)
 
365
      if parent.kind_of?(PlasmaScripting::Applet)
 
366
        super(parent.applet_script.applet)
 
367
      else
 
368
        super
 
369
      end
 
370
    end
 
371
  end
 
372
 
 
373
  class Frame < Qt::Base
 
374
    def initialize(parent = nil)
 
375
      if parent.kind_of?(PlasmaScripting::Applet)
 
376
        super(parent.applet_script.applet)
 
377
      else
 
378
        super
 
379
      end
 
380
    end
 
381
  end
 
382
 
 
383
  class GroupBox < Qt::Base
 
384
    def initialize(parent = nil)
 
385
      if parent.kind_of?(PlasmaScripting::Applet)
 
386
        super(parent.applet_script.applet)
 
387
      else
 
388
        super
 
389
      end
 
390
    end
 
391
  end
 
392
 
 
393
  class IconWidget < Qt::Base
 
394
    def initialize(*args)
 
395
      sargs = []
 
396
      for i in 0...args.length do
 
397
        if args[i].kind_of?(PlasmaScripting::Applet)
 
398
          sargs << args[i].applet_script.applet
 
399
        else
 
400
          sargs << args[i]
 
401
        end
 
402
      end
 
403
      super(*sargs)
 
404
    end
 
405
  end
 
406
 
 
407
  class ItemBackground < Qt::Base
 
408
    def initialize(parent = nil)
 
409
      if parent.kind_of?(PlasmaScripting::Applet)
 
410
        super(parent.applet_script.applet)
 
411
      else
 
412
        super
 
413
      end
 
414
    end
 
415
  end
 
416
 
 
417
  class Label < Qt::Base
 
418
    def initialize(parent = nil)
 
419
      if parent.kind_of?(PlasmaScripting::Applet)
 
420
        super(parent.applet_script.applet)
 
421
      else
 
422
        super
 
423
      end
 
424
    end
 
425
  end
 
426
 
 
427
  class LineEdit < Qt::Base
 
428
    def initialize(parent = nil)
 
429
      if parent.kind_of?(PlasmaScripting::Applet)
 
430
        super(parent.applet_script.applet)
 
431
      else
 
432
        super
 
433
      end
 
434
    end
 
435
  end
 
436
 
 
437
  class Meter < Qt::Base
 
438
    def initialize(parent = nil)
 
439
      if parent.kind_of?(PlasmaScripting::Applet)
 
440
        super(parent.applet_script.applet)
 
441
      else
 
442
        super
 
443
      end
 
444
    end
 
445
  end
 
446
 
 
447
  class PushButton < Qt::Base
 
448
    def initialize(parent = nil)
 
449
      if parent.kind_of?(PlasmaScripting::Applet)
 
450
        super(parent.applet_script.applet)
 
451
      else
 
452
        super
 
453
      end
 
454
    end
 
455
  end
 
456
 
 
457
  class RadioButton < Qt::Base
 
458
    def initialize(parent = nil)
 
459
      if parent.kind_of?(PlasmaScripting::Applet)
 
460
        super(parent.applet_script.applet)
 
461
      else
 
462
        super
 
463
      end
 
464
    end
 
465
  end
 
466
 
 
467
  class ScrollBar < Qt::Base
 
468
    def initialize(orientation, parent = nil)
 
469
      if parent.kind_of?(PlasmaScripting::Applet)
 
470
        super(orientation, parent.applet_script.applet)
 
471
      else
 
472
        super
 
473
      end
 
474
    end
 
475
  end
 
476
 
 
477
  class ScrollWidget < Qt::Base
 
478
    def initialize(parent = nil)
 
479
      if parent.kind_of?(PlasmaScripting::Applet)
 
480
        super(parent.applet_script.applet)
 
481
      else
 
482
        super
 
483
      end
 
484
    end
 
485
  end
 
486
 
 
487
  class Separator < Qt::Base
 
488
    def initialize(parent = nil, wFlags = 0)
 
489
      if parent.kind_of?(PlasmaScripting::Applet)
 
490
        super(parent.applet_script.applet, wFlags)
 
491
      else
 
492
        super
 
493
      end
 
494
    end
 
495
  end
 
496
 
 
497
  class SignalPlotter < Qt::Base
 
498
    def initialize(parent = nil)
 
499
      if parent.kind_of?(PlasmaScripting::Applet)
 
500
        super(parent.applet_script.applet)
 
501
      else
 
502
        super
 
503
      end
 
504
    end
 
505
  end
 
506
 
 
507
  class Slider < Qt::Base
 
508
    def initialize(parent = nil)
 
509
      if parent.kind_of?(PlasmaScripting::Applet)
 
510
        super(parent.applet_script.applet)
 
511
      else
 
512
        super
 
513
      end
 
514
    end
 
515
  end
 
516
 
 
517
  class SpinBox < Qt::Base
 
518
    def initialize(parent = nil)
 
519
      if parent.kind_of?(PlasmaScripting::Applet)
 
520
        super(parent.applet_script.applet)
 
521
      else
 
522
        super
 
523
      end
 
524
    end
 
525
 
 
526
    def range=(arg)
 
527
      if arg.kind_of? Range
 
528
        return super(arg.begin, arg.exclude_end?  ? arg.end - 1 : arg.end)
 
529
      else
 
530
        return super(arg)
 
531
      end
 
532
    end
 
533
  end
 
534
 
 
535
  class SvgWidget < Qt::Base
 
536
    def initialize(*args)
 
537
      if args.length > 0 && args[0].kind_of?(PlasmaScripting::Applet)
 
538
        args[0] = args[0].applet_script.applet
 
539
        super(*args)
 
540
      elsif args.length > 2 && args[2].kind_of?(PlasmaScripting::Applet)
 
541
        args[2] = args[2].applet_script.applet
 
542
        super(*args)
 
543
      else
 
544
        super
 
545
      end
 
546
    end
 
547
  end
 
548
 
 
549
  class TabBar < Qt::Base
 
550
    def initialize(parent = nil)
 
551
      if parent.kind_of?(PlasmaScripting::Applet)
 
552
        super(parent.applet_script.applet)
 
553
      else
 
554
        super
 
555
      end
 
556
    end
 
557
  end
 
558
 
 
559
  class TextBrowser < Qt::Base
 
560
    def initialize(parent = nil)
 
561
      if parent.kind_of?(PlasmaScripting::Applet)
 
562
        super(parent.applet_script.applet)
 
563
      else
 
564
        super
 
565
      end
 
566
    end
 
567
  end
 
568
 
 
569
  class TextEdit < Qt::Base
 
570
    def initialize(parent = nil)
 
571
      if parent.kind_of?(PlasmaScripting::Applet)
 
572
        super(parent.applet_script.applet)
 
573
      else
 
574
        super
 
575
      end
 
576
    end
 
577
  end
 
578
 
 
579
  class ToolButton < Qt::Base
 
580
    def initialize(parent = nil)
 
581
      if parent.kind_of?(PlasmaScripting::Applet)
 
582
        super(parent.applet_script.applet)
 
583
      else
 
584
        super
 
585
      end
 
586
    end
 
587
  end
 
588
  
 
589
  class ToolTipManager < Qt::Base
 
590
    def setContent(widget, data)
 
591
      if widget.kind_of?(PlasmaScripting::Applet)
 
592
        super(widget.applet_script.applet, data)
 
593
      else
 
594
        super
 
595
      end
 
596
    end
 
597
 
 
598
    def set_content(widget, data)
 
599
      setContent(widget, data)
 
600
    end
 
601
 
 
602
    def clearContent(widget)
 
603
      if widget.kind_of?(PlasmaScripting::Applet)
 
604
        super(widget.applet_script.applet)
 
605
      else
 
606
        super
 
607
      end
 
608
    end
 
609
 
 
610
    def clear_content(widget)
 
611
      clearContent(widget)
 
612
    end
 
613
 
 
614
    def show(widget)
 
615
      if widget.kind_of?(PlasmaScripting::Applet)
 
616
        super(widget.applet_script.applet)
 
617
      else
 
618
        super
 
619
      end
 
620
    end
 
621
 
 
622
    def visible?(widget)
 
623
      return isVisible(widget)
 
624
    end
 
625
 
 
626
    def isVisible(widget)
 
627
      if widget.kind_of?(PlasmaScripting::Applet)
 
628
        super(widget.applet_script.applet)
 
629
      else
 
630
        super
 
631
      end
 
632
    end
 
633
 
 
634
    def registerWidget(widget)
 
635
      if widget.kind_of?(PlasmaScripting::Applet)
 
636
        super(widget.applet_script.applet)
 
637
      else
 
638
        super
 
639
      end
 
640
    end
 
641
 
 
642
    def register_widget(widget)
 
643
      registerWidget(widget)
 
644
    end
 
645
 
 
646
    def unregisterWidget(widget)
 
647
      if widget.kind_of?(PlasmaScripting::Applet)
 
648
        super(widget.applet_script.applet)
 
649
      else
 
650
        super
 
651
      end
 
652
    end
 
653
 
 
654
    def unregister_widget(widget)
 
655
      unregisterWidget(widget)
 
656
    end
 
657
  end
 
658
 
 
659
  class TreeView < Qt::Base
 
660
    def initialize(parent = nil)
 
661
      if parent.kind_of?(PlasmaScripting::Applet)
 
662
        super(parent.applet_script.applet)
 
663
      else
 
664
        super
 
665
      end
 
666
    end
 
667
  end
 
668
 
 
669
  class VideoWidget < Qt::Base
 
670
    def initialize(parent = nil)
 
671
      if parent.kind_of?(PlasmaScripting::Applet)
 
672
        super(parent.applet_script.applet)
 
673
      else
 
674
        super
 
675
      end
 
676
    end
 
677
  end
 
678
 
 
679
  class WebView < Qt::Base
 
680
    def initialize(parent = nil)
 
681
      if parent.kind_of?(PlasmaScripting::Applet)
 
682
        super(parent.applet_script.applet)
 
683
      else
 
684
        super
 
685
      end
 
686
    end
 
687
  end
 
688
 
 
689
end
 
690
 
 
691
module Qt
 
692
  class GraphicsProxyWidget < Qt::Base
 
693
    def initialize(parent = nil, wFlags = nil)
 
694
      if parent.kind_of?(PlasmaScripting::Applet)
 
695
        super(parent.applet_script.applet, wFlags)
 
696
      else
 
697
        super
 
698
      end
 
699
    end
 
700
 
 
701
    def parent_item=(item)
 
702
      setParentItem(item)
 
703
    end
 
704
 
 
705
    def parentItem=(item)
 
706
      setParentItem(item)
 
707
    end
 
708
 
 
709
    def setParentItem(item)
 
710
      if item.kind_of?(PlasmaScripting::Applet)
 
711
        super(item.applet_script.applet)
 
712
      else
 
713
        super
 
714
      end
 
715
    end
 
716
 
 
717
    def type(*args)
 
718
      method_missing(:type, *args)
 
719
    end
 
720
  end
 
721
 
 
722
  class QAbstractGraphicsShapeItem < Qt::Base
 
723
    def initialize(parent = nil, wFlags = nil)
 
724
      if parent.kind_of?(PlasmaScripting::Applet)
 
725
        super(parent.applet_script.applet, wFlags)
 
726
      else
 
727
        super
 
728
      end
 
729
    end
 
730
 
 
731
    def parent_item=(item)
 
732
      setParentItem(item)
 
733
    end
 
734
 
 
735
    def parentItem=(item)
 
736
      setParentItem(item)
 
737
    end
 
738
 
 
739
    def setParentItem(item)
 
740
      if item.kind_of?(PlasmaScripting::Applet)
 
741
        super(item.applet_script.applet)
 
742
      else
 
743
        super
 
744
      end
 
745
    end
 
746
 
 
747
    def type(*args)
 
748
      method_missing(:type, *args)
 
749
    end
 
750
  end
 
751
 
 
752
  class GraphicsEllipseItem < Qt::Base
 
753
    def initialize(parent = nil, wFlags = nil)
 
754
      if parent.kind_of?(PlasmaScripting::Applet)
 
755
        super(parent.applet_script.applet, wFlags)
 
756
      else
 
757
        super
 
758
      end
 
759
    end
 
760
 
 
761
    def parent_item=(item)
 
762
      setParentItem(item)
 
763
    end
 
764
 
 
765
    def parentItem=(item)
 
766
      setParentItem(item)
 
767
    end
 
768
 
 
769
    def setParentItem(item)
 
770
      if item.kind_of?(PlasmaScripting::Applet)
 
771
        super(item.applet_script.applet)
 
772
      else
 
773
        super
 
774
      end
 
775
    end
 
776
 
 
777
    def type(*args)
 
778
      method_missing(:type, *args)
 
779
    end
 
780
  end
 
781
 
 
782
  class GraphicsItemGroup < Qt::Base
 
783
    def initialize(parent = nil, wFlags = nil)
 
784
      if parent.kind_of?(PlasmaScripting::Applet)
 
785
        super(parent.applet_script.applet, wFlags)
 
786
      else
 
787
        super
 
788
      end
 
789
    end
 
790
 
 
791
    def parent_item=(item)
 
792
      setParentItem(item)
 
793
    end
 
794
 
 
795
    def parentItem=(item)
 
796
      setParentItem(item)
 
797
    end
 
798
 
 
799
    def setParentItem(item)
 
800
      if item.kind_of?(PlasmaScripting::Applet)
 
801
        super(item.applet_script.applet)
 
802
      else
 
803
        super
 
804
      end
 
805
    end
 
806
 
 
807
    def type(*args)
 
808
      method_missing(:type, *args)
 
809
    end
 
810
  end
 
811
 
 
812
  class GraphicsLineItem < Qt::Base
 
813
    def initialize(parent = nil, wFlags = nil)
 
814
      if parent.kind_of?(PlasmaScripting::Applet)
 
815
        super(parent.applet_script.applet, wFlags)
 
816
      else
 
817
        super
 
818
      end
 
819
    end
 
820
 
 
821
    def parent_item=(item)
 
822
      setParentItem(item)
 
823
    end
 
824
 
 
825
    def parentItem=(item)
 
826
      setParentItem(item)
 
827
    end
 
828
 
 
829
    def setParentItem(item)
 
830
      if item.kind_of?(PlasmaScripting::Applet)
 
831
        super(item.applet_script.applet)
 
832
      else
 
833
        super
 
834
      end
 
835
    end
 
836
 
 
837
    def type(*args)
 
838
      method_missing(:type, *args)
 
839
    end
 
840
  end
 
841
 
 
842
  class GraphicsPathItem < Qt::Base
 
843
    def initialize(parent = nil, wFlags = nil)
 
844
      if parent.kind_of?(PlasmaScripting::Applet)
 
845
        super(parent.applet_script.applet, wFlags)
 
846
      else
 
847
        super
 
848
      end
 
849
    end
 
850
 
 
851
    def parent_item=(item)
 
852
      setParentItem(item)
 
853
    end
 
854
 
 
855
    def parentItem=(item)
 
856
      setParentItem(item)
 
857
    end
 
858
 
 
859
    def setParentItem(item)
 
860
      if item.kind_of?(PlasmaScripting::Applet)
 
861
        super(item.applet_script.applet)
 
862
      else
 
863
        super
 
864
      end
 
865
    end
 
866
 
 
867
    def type(*args)
 
868
      method_missing(:type, *args)
 
869
    end
 
870
  end
 
871
 
 
872
  class GraphicsPixmapItem < Qt::Base
 
873
    def initialize(parent = nil, wFlags = nil)
 
874
      if parent.kind_of?(PlasmaScripting::Applet)
 
875
        super(parent.applet_script.applet, wFlags)
 
876
      else
 
877
        super
 
878
      end
 
879
    end
 
880
 
 
881
    def parent_item=(item)
 
882
      setParentItem(item)
 
883
    end
 
884
 
 
885
    def parentItem=(item)
 
886
      setParentItem(item)
 
887
    end
 
888
 
 
889
    def setParentItem(item)
 
890
      if item.kind_of?(PlasmaScripting::Applet)
 
891
        super(item.applet_script.applet)
 
892
      else
 
893
        super
 
894
      end
 
895
    end
 
896
 
 
897
    def type(*args)
 
898
      method_missing(:type, *args)
 
899
    end
 
900
  end
 
901
 
 
902
  class GraphicsPolygonItem < Qt::Base
 
903
    def initialize(parent = nil, wFlags = nil)
 
904
      if parent.kind_of?(PlasmaScripting::Applet)
 
905
        super(parent.applet_script.applet, wFlags)
 
906
      else
 
907
        super
 
908
      end
 
909
    end
 
910
 
 
911
    def parent_item=(item)
 
912
      setParentItem(item)
 
913
    end
 
914
 
 
915
    def parentItem=(item)
 
916
      setParentItem(item)
 
917
    end
 
918
 
 
919
    def setParentItem(item)
 
920
      if item.kind_of?(PlasmaScripting::Applet)
 
921
        super(item.applet_script.applet)
 
922
      else
 
923
        super
 
924
      end
 
925
    end
 
926
 
 
927
    def type(*args)
 
928
      method_missing(:type, *args)
 
929
    end
 
930
  end
 
931
 
 
932
  class GraphicsRectItem < Qt::Base
 
933
    def initialize(parent = nil, wFlags = nil)
 
934
      if parent.kind_of?(PlasmaScripting::Applet)
 
935
        super(parent.applet_script.applet, wFlags)
 
936
      else
 
937
        super
 
938
      end
 
939
    end
 
940
 
 
941
    def parent_item=(item)
 
942
      setParentItem(item)
 
943
    end
 
944
 
 
945
    def parentItem=(item)
 
946
      setParentItem(item)
 
947
    end
 
948
 
 
949
    def setParentItem(item)
 
950
      if item.kind_of?(PlasmaScripting::Applet)
 
951
        super(item.applet_script.applet)
 
952
      else
 
953
        super
 
954
      end
 
955
    end
 
956
 
 
957
    def type(*args)
 
958
      method_missing(:type, *args)
 
959
    end
 
960
  end
 
961
 
 
962
  class GraphicsSimpleTextItem < Qt::Base
 
963
    def initialize(parent = nil, wFlags = nil)
 
964
      if parent.kind_of?(PlasmaScripting::Applet)
 
965
        super(parent.applet_script.applet, wFlags)
 
966
      else
 
967
        super
 
968
      end
 
969
    end
 
970
 
 
971
    def parent_item=(item)
 
972
      setParentItem(item)
 
973
    end
 
974
 
 
975
    def parentItem=(item)
 
976
      setParentItem(item)
 
977
    end
 
978
 
 
979
    def setParentItem(item)
 
980
      if item.kind_of?(PlasmaScripting::Applet)
 
981
        super(item.applet_script.applet)
 
982
      else
 
983
        super
 
984
      end
 
985
    end
 
986
 
 
987
    def type(*args)
 
988
      method_missing(:type, *args)
 
989
    end
 
990
  end
 
991
 
 
992
  class GraphicsSvgItem < Qt::Base
 
993
    def initialize(parent = nil, wFlags = nil)
 
994
      if parent.kind_of?(PlasmaScripting::Applet)
 
995
        super(parent.applet_script.applet, wFlags)
 
996
      else
 
997
        super
 
998
      end
 
999
    end
 
1000
 
 
1001
    def parent_item=(item)
 
1002
      setParentItem(item)
 
1003
    end
 
1004
 
 
1005
    def parentItem=(item)
 
1006
      setParentItem(item)
 
1007
    end
 
1008
 
 
1009
    def setParentItem(item)
 
1010
      if item.kind_of?(PlasmaScripting::Applet)
 
1011
        super(item.applet_script.applet)
 
1012
      else
 
1013
        super
 
1014
      end
 
1015
    end
 
1016
 
 
1017
    def type(*args)
 
1018
      method_missing(:type, *args)
 
1019
    end
 
1020
  end
 
1021
 
 
1022
  class GraphicsTextItem < Qt::Base
 
1023
    def initialize(parent = nil, wFlags = nil)
 
1024
      if parent.kind_of?(PlasmaScripting::Applet)
 
1025
        super(parent.applet_script.applet, wFlags)
 
1026
      else
 
1027
        super
 
1028
      end
 
1029
    end
 
1030
 
 
1031
    def parent_item=(item)
 
1032
      setParentItem(item)
 
1033
    end
 
1034
 
 
1035
    def parentItem=(item)
 
1036
      setParentItem(item)
 
1037
    end
 
1038
 
 
1039
    def setParentItem(item)
 
1040
      if item.kind_of?(PlasmaScripting::Applet)
 
1041
        super(item.applet_script.applet)
 
1042
      else
 
1043
        super
 
1044
      end
 
1045
    end
 
1046
 
 
1047
    def type(*args)
 
1048
      method_missing(:type, *args)
 
1049
    end
 
1050
  end
 
1051
 
 
1052
  class GraphicsWidget < Qt::Base
 
1053
    def initialize(parent = nil, wFlags = nil)
 
1054
      if parent.kind_of?(PlasmaScripting::Applet)
 
1055
        super(parent.applet_script.applet, wFlags)
 
1056
      else
 
1057
        super
 
1058
      end
 
1059
    end
 
1060
 
 
1061
    def parent_item=(item)
 
1062
      setParentItem(item)
 
1063
    end
 
1064
 
 
1065
    def parentItem=(item)
 
1066
      setParentItem(item)
 
1067
    end
 
1068
 
 
1069
    def setParentItem(item)
 
1070
      if item.kind_of?(PlasmaScripting::Applet)
 
1071
        super(item.applet_script.applet)
 
1072
      else
 
1073
        super
 
1074
      end
 
1075
    end
 
1076
 
 
1077
    def type(*args)
 
1078
      method_missing(:type, *args)
 
1079
    end
 
1080
  end
 
1081
 
 
1082
  class GraphicsGridLayout < Qt::Base
 
1083
    def initialize(parent = nil)
 
1084
      if parent.kind_of?(PlasmaScripting::Applet)
 
1085
        super(parent.applet_script.applet)
 
1086
      else
 
1087
        super
 
1088
      end
 
1089
    end
 
1090
 
 
1091
    def add_item(*args)
 
1092
      addItem(*args)
 
1093
    end
 
1094
 
 
1095
    def addItem(*args)
 
1096
      sargs = []
 
1097
      for i in 0...args.length do
 
1098
        if args[i].kind_of?(PlasmaScripting::Applet)
 
1099
          sargs << args[i].applet_script.applet
 
1100
        else
 
1101
          sargs << args[i]
 
1102
        end
 
1103
      end
 
1104
      super(*sargs)
 
1105
    end
 
1106
 
 
1107
    def alignment(item)
 
1108
      if item.kind_of?(PlasmaScripting::Applet)
 
1109
        super(item.applet_script.applet)
 
1110
      else
 
1111
        super
 
1112
      end
 
1113
    end
 
1114
 
 
1115
    def set_alignment(item, alignment)
 
1116
      setAlignment(item, alignment)
 
1117
    end
 
1118
 
 
1119
    def setAlignment(item, alignment)
 
1120
      if item.kind_of?(PlasmaScripting::Applet)
 
1121
        super(item.applet_script.applet, alignment)
 
1122
      else
 
1123
        super
 
1124
      end
 
1125
    end
 
1126
  end
 
1127
 
 
1128
  class GraphicsLinearLayout < Qt::Base
 
1129
    def initialize(*args)
 
1130
      sargs = []
 
1131
      for i in 0...args.length do
 
1132
        if args[i].kind_of?(PlasmaScripting::Applet)
 
1133
          sargs << args[i].applet_script.applet
 
1134
        else
 
1135
          sargs << args[i]
 
1136
        end
 
1137
      end
 
1138
      super(*sargs)
 
1139
    end
 
1140
 
 
1141
    def add_item(*args)
 
1142
      addItem(*args)
 
1143
    end
 
1144
 
 
1145
    def addItem(*args)
 
1146
      sargs = []
 
1147
      for i in 0...args.length do
 
1148
        if args[i].kind_of?(PlasmaScripting::Applet)
 
1149
          sargs << args[i].applet_script.applet
 
1150
        else
 
1151
          sargs << args[i]
 
1152
        end
 
1153
      end
 
1154
      super(*sargs)
 
1155
    end
 
1156
 
 
1157
    def alignment(item)
 
1158
      if item.kind_of?(PlasmaScripting::Applet)
 
1159
        super(item.applet_script.applet)
 
1160
      else
 
1161
        super
 
1162
      end
 
1163
    end
 
1164
 
 
1165
    def insert_item(index, item)
 
1166
      insertItem(index, item)
 
1167
    end
 
1168
 
 
1169
    def insertItem(index, item)
 
1170
      if item.kind_of?(PlasmaScripting::Applet)
 
1171
        super(index, item.applet_script.applet)
 
1172
      else
 
1173
        super
 
1174
      end
 
1175
    end
 
1176
 
 
1177
    def set_alignment(item, alignment)
 
1178
      setAlignment(item, alignment)
 
1179
    end
 
1180
 
 
1181
    def setAlignment(item, alignment)
 
1182
      if item.kind_of?(PlasmaScripting::Applet)
 
1183
        super(item.applet_script.applet, alignment)
 
1184
      else
 
1185
        super
 
1186
      end
 
1187
    end
 
1188
 
 
1189
    def set_stretch_factor(item, stretch)
 
1190
      setStretchFactor(item, stretch)
 
1191
    end
 
1192
 
 
1193
    def setStretchFactor(item, stretch)
 
1194
      if item.kind_of?(PlasmaScripting::Applet)
 
1195
        super(item.applet_script.applet, stretch)
 
1196
      else
 
1197
        super
 
1198
      end
 
1199
    end
 
1200
 
 
1201
    def stretch_factor(item)
 
1202
      stretchFactor(item)
 
1203
    end
 
1204
 
 
1205
    def stretchFactor(item)
 
1206
      if item.kind_of?(PlasmaScripting::Applet)
 
1207
        super(item.applet_script.applet)
 
1208
      else
 
1209
        super
 
1210
      end
 
1211
    end
 
1212
  end
 
1213
end
 
1214
 
 
1215
# kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;