Class: Shoes::App

Inherits:
Qt::Application
  • Object
show all
Defined in:
lib/blue_shoes/app.rb

Overview

this class represents a whole Shoes App.

Direct Known Subclasses

Dialog

Defined Under Namespace

Classes: Alert, Ask

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}, blk) ⇒ App

:nodoc: all



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
# File 'lib/blue_shoes/app.rb', line 5

def initialize opts = {}, blk #:nodoc:

  super ARGV

  #set the application icon to the shoes logo
  set_window_icon(Qt::Icon.new "#{File.expand_path(File.dirname(__FILE__))}/../../static/blue_shoes.jpg")

  #set up some options with defaults
  height = opts[:height] || 200
  width = opts[:width] || 400
  resizeable = opts[:resizable].nil? ? true : false

  @_main_window = Qt::Widget.new do

    self.layout = Shoes::Stack.new
    resize height, width

    #this is the list of subwidgets we've got
    @widgets = []

    #we can make the window unresizable by adding a minimum and maximum
    #size
    unless resizeable
      setMaximumSize(height,width)
      setMinimumSize(height,width)
    end


    # in QT, each widget has a paint_event that gets called whenever
    # it needs to be repainted. 
    def self.paint_event event
      #we create a painter...
      painter = Qt::Painter.new self
      #then call it over every widget in our list
      @widgets.each{|w| w.draw painter }
      #and then end painting
      painter.end
    end

    #a nice convenience function to add our widgets to the array
    def add_widget widget
      @widgets << widget
    end

  end

  #we want to have a current widget, which starts off as the main window
  @_current_widget = @_main_window

  #we evaluate the block we were passed. This is pretty much the heart of
  #Shoes.
  instance_eval &blk

  #then we show our window
  @_main_window.show
  #and call QT's exec to kick things off!
  exec
  exit
end

Instance Attribute Details

#clipboardObject

the system clipboard



210
211
212
# File 'lib/blue_shoes/app.rb', line 210

def clipboard
  @clipboard
end

Instance Method Details

#add_widget(widget) ⇒ Object

a convenience function for adding a widget to the current widget



81
82
83
# File 'lib/blue_shoes/app.rb', line 81

def add_widget widget
  @_current_widget.layout.add_widget widget, 0
end

#after(&blk) ⇒ Object

Adds elements to a specific place in a slot, just after the element which is a child of the slot.



627
628
629
630
# File 'lib/blue_shoes/app.rb', line 627

def after(&blk)
  # returns self
  throw NotImplementedError
end

#alert(message) ⇒ Object

Pops up a window containing a short message.



96
97
98
# File 'lib/blue_shoes/app.rb', line 96

def alert(message)
  Alert.new message
end

#animate(fps) ⇒ Object

Starts an animation timer, which runs parallel to the rest of the app. The fps is a number, the frames per seconds. This number dictates how many times per second the attached block will be called.



360
361
362
363
# File 'lib/blue_shoes/app.rb', line 360

def animate(fps)
  # returns  |frame| ... } » Shoes::Animation
  throw NotImplementedError
end

#append(&blk) ⇒ Object

Adds elements to the end of a slot.



621
622
623
624
# File 'lib/blue_shoes/app.rb', line 621

def append(&blk)
  # returns self
  throw NotImplementedError
end

#arc(left, top, width, height, angle1, angle2) ⇒ Object

Draws an arc shape (a section of an oval) at coordinates (left, top). This method just give you a bit more control than oval, by offering the :angle1 and :angle2 styles. (In fact, you can mimick the oval method by setting :angle1 to 0 and :angle2 to Shoes::TWO_PI.)



252
253
254
255
# File 'lib/blue_shoes/app.rb', line 252

def arc(left, top, width, height, angle1, angle2)
  # returns Shoes::Shape
  throw NotImplementedError
end

#arrow(left, top, width) ⇒ Object

Draws an arrow at coordinates (left, top) with a pixel width.



258
259
260
261
# File 'lib/blue_shoes/app.rb', line 258

def arrow(left, top, width)
  # returns Shoes::Shape
  throw NotImplementedError
end

#ask(message) ⇒ Object

Pops up a window and asks a question.



116
117
118
119
# File 'lib/blue_shoes/app.rb', line 116

def ask(message)
  ask = Ask.new message
  ask.text
end

#ask_color(title) ⇒ Object

Pops up a color picker window. The program will wait for a color to be picked, then gives you back a Color object. See the Color help for some ways you can use this color.



123
124
125
126
# File 'lib/blue_shoes/app.rb', line 123

def ask_color(title)
  # returns Shoes::Color
  throw NotImplementedError
end

#ask_open_fileObject

Pops up an “Open file…” window. It’s the standard window which shows all of your folders and lets you select a file to open. Hands you back the name of the file.



129
130
131
132
# File 'lib/blue_shoes/app.rb', line 129

def ask_open_file
  # returns a string
  throw NotImplementedError
end

#ask_open_folderObject

Pops up an “Open folder…” window. It’s the standard window which shows all of your folders and lets you select a folder to open. Hands you back the name of the folder.



141
142
143
144
# File 'lib/blue_shoes/app.rb', line 141

def ask_open_folder
  # returns a string
  throw NotImplementedError
end

#ask_save_fileObject

Pops up a “Save file…” window, similiar to ask_open_file, described previously.



135
136
137
138
# File 'lib/blue_shoes/app.rb', line 135

def ask_save_file
  # returns a string
  throw NotImplementedError
end

#ask_save_folderObject

Pops up a “Save folder…” window, similiar to ask_open_folder, described previously. On OS X, this method currently behaves like an alias of ask_open_folder.



147
148
149
150
# File 'lib/blue_shoes/app.rb', line 147

def ask_save_folder
  # returns a string
  throw NotImplementedError
end

#background(pattern, style, &blk) ⇒ Object

Draws a Background element with a specific color (or pattern.) Patterns can be colors, gradients or images. Colors and images will tile across the background. Gradients stretch to fill the background.



369
370
371
372
373
# File 'lib/blue_shoes/app.rb', line 369

def background(pattern, style, &blk)
  background = Shoes::Background.new(pattern, style)
  @_main_window.add_widget background
  background
end

Creates a Banner text block. Shoes automatically styles this text to 48 pixels high.



376
377
378
379
# File 'lib/blue_shoes/app.rb', line 376

def banner(text)
  # returns  Shoes::Banner
  throw NotImplementedError
end

#before(&blk) ⇒ Object

Adds elements to a specific place in a slot, just before the element which is a child of the slot.



633
634
635
636
# File 'lib/blue_shoes/app.rb', line 633

def before(&blk)
  # returns self
  throw NotImplementedError
end

#border(text, opts = {}) ⇒ Object

Draws a Border element using a specific color (or pattern.) Patterns can be colors, gradients or images. Colors and images will tile across the border. Gradients stretch to fill the border.



382
383
384
385
# File 'lib/blue_shoes/app.rb', line 382

def border(text, opts={})
  # returns  Shoes::Border
  throw NotImplementedError
end

#button(txt, style = {}, &blk) ⇒ Object

Create a new button.



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/blue_shoes/app.rb', line 66

def button txt, style={}, &blk

  #create the button, don't forget to hook up that signal!
  b = Qt::PushButton.new txt do
    connect(SIGNAL :clicked) { blk.call } if blk
  end

  #add it to our widget list
  add_widget b

  #and we want to return it.
  b
end

#cap(how) ⇒ Object

Sets the line cap, which is the shape at the end of every line you draw. If set to :curve, the end is rounded. The default is :rect, a line which ends abruptly flat. The :project cap is also fat, but sticks out a bit longer.



264
265
266
267
# File 'lib/blue_shoes/app.rb', line 264

def cap(how)
  # returns self
  throw NotImplementedError
end

#caption(text) ⇒ Object

Creates a Caption text block. Shoes styles this text to 14 pixels high.



388
389
390
391
# File 'lib/blue_shoes/app.rb', line 388

def caption(text)
  # returns  Shoes::Caption
  throw NotImplementedError
end

#checkObject

Adds a check box.



394
395
396
397
# File 'lib/blue_shoes/app.rb', line 394

def check()
  # returns  Shoes::Check
  throw NotImplementedError
end

#clear(&blk) ⇒ Object

The clear method also takes an optional block. The block will be used to replace the contents of the slot.



639
640
641
642
# File 'lib/blue_shoes/app.rb', line 639

def clear(&blk)
  # returns self
  throw NotImplementedError
end

#click(&blk) ⇒ Object

The click block is called when a mouse button is clicked. The button is the number of the mouse button which has been pressed. The left and top are the mouse coordinates at which the click happened.



573
574
575
576
# File 'lib/blue_shoes/app.rb', line 573

def click(&blk)
  # returns self
  throw NotImplementedError
end

#closeObject

Closes the app window



213
214
215
# File 'lib/blue_shoes/app.rb', line 213

def close
  throw NotImplementedError
end

#code(text) ⇒ Object

Create a Code text fragment. This text defaults to a monospaced font.



400
401
402
403
# File 'lib/blue_shoes/app.rb', line 400

def code(text)
  # returns  Shoes::Code
  throw NotImplementedError
end

#confirm(question) ⇒ Object

Pops up a yes-or-no question. If the person at the computer, clicks yes, you’ll get back a true. If not, you’ll get back false.



153
154
155
156
# File 'lib/blue_shoes/app.rb', line 153

def confirm(question)
  # returns true or false
  throw NotImplementedError
end

#contentsObject

Lists all elements in a slot.



764
765
766
767
# File 'lib/blue_shoes/app.rb', line 764

def contents
  # returns an array of elements
  throw NotImplementedError
end

#debug(message) ⇒ Object

Sends a debug message to the Shoes console. You can bring up the Shoes console by pressing Alt-/ on any Shoes window (or ⌘-/ on OS X.)



159
160
161
162
# File 'lib/blue_shoes/app.rb', line 159

def debug(message)
  # returns a string
  throw NotImplementedError
end

#del(text) ⇒ Object

Creates a Del text fragment (short for “deleted”) which defaults to text with a single strikethrough in its middle.



406
407
408
409
# File 'lib/blue_shoes/app.rb', line 406

def del(text)
  # returns  Shoes::Del
  throw NotImplementedError
end

#dialog(styles) ⇒ Object

Opens a new app window (just like the window method does,) but the window is given a dialog box look.



412
413
414
415
# File 'lib/blue_shoes/app.rb', line 412

def dialog(styles)
  # returns  ... } » Shoes::App
  throw NotImplementedError
end

#displace(left, top) ⇒ Object

A shortcut method for setting the :displace_left and :displace_top styles. Displacing is a handy way of moving a slot without altering the layout. In fact, the top and left methods will not report displacement at all. So, generally, displacement is only for temporary animations. For example, jiggling a button in place.



657
658
659
660
# File 'lib/blue_shoes/app.rb', line 657

def displace(left, top)
  # returns self
  throw NotImplementedError
end

#download(url, opts = {}, &blk) ⇒ Object

starts a download thread



218
219
220
# File 'lib/blue_shoes/app.rb', line 218

def download url, opts={}, &blk
  throw NotImplementedError
end

#edit_box(text) ⇒ Object

Adds a large, multi-line textarea to this slot. The text is optional and should be a string that will start out the box. An optional block can be attached here which is called any type the user changes the text in the box.



418
419
420
421
# File 'lib/blue_shoes/app.rb', line 418

def edit_box(text)
  # returns  Shoes::EditBox
  throw NotImplementedError
end

#edit_line(text) ⇒ Object

Adds a single-line text box to this slot. The text is optional and should be a string that will start out the box. An optional block can be attached here which is called any type the user changes the text in the box.



424
425
426
427
# File 'lib/blue_shoes/app.rb', line 424

def edit_line(text)
  # returns  Shoes::EditLine
  throw NotImplementedError
end

#em(text) ⇒ Object

Creates an Em text fragment (short for “emphasized”) which, by default, is styled with italics.



430
431
432
433
# File 'lib/blue_shoes/app.rb', line 430

def em(text)
  # returns  Shoes::Em
  throw NotImplementedError
end

#error(message) ⇒ Object

Sends an error message to the Shoes console. This method should only be used to log errors. Try the debug method for logging messages to yourself.



165
166
167
168
# File 'lib/blue_shoes/app.rb', line 165

def error(message)
  # returns nil
  throw NotImplementedError
end

#every(seconds) ⇒ Object

A timer similar to the animation method, but much slower. This timer fires a given number of seconds, running the block attached. So, for example, if you need to check a web site every five minutes, you’d call every(300) with a block containing the code to actually ping the web site.



436
437
438
439
# File 'lib/blue_shoes/app.rb', line 436

def every(seconds)
  # returns Shoes::Every
  throw NotImplementedError
end

#fill(pattern) ⇒ Object

Sets the fill bucket to a specific color (or pattern.) Patterns can be colors, gradients or images. So, once the fill bucket is set, you can draw shapes and they will be colored in with the pattern you’ve chosen.



270
271
272
273
# File 'lib/blue_shoes/app.rb', line 270

def fill(pattern)
 # returns pattern
  throw NotimplementedError
end

#finish(&blk) ⇒ Object

When a slot is removed, it’s finish event occurs. The finish block is immediately handed self, the slot object which has been removed.



579
580
581
582
# File 'lib/blue_shoes/app.rb', line 579

def finish(&blk)
  # returns self
  throw NotImplementedError
end

#flow(style, &blk) ⇒ Object

A flow is an invisible box (or “slot”) in which you place Shoes elements. Both flows and stacks are explained in great detail on the main Slots page.



442
443
444
445
446
447
# File 'lib/blue_shoes/app.rb', line 442

def flow(style, &blk)
  flow = Shoes::Flow.new(style)
  add_widget flow
  instance_eval &blk
  flow
end

#font(message) ⇒ Object

Loads a TrueType (or other type of font) from a file. While TrueType is supported by all platforms, your platform may support other types of fonts. Shoes uses each operating system’s built-in font system to make this work.



171
172
173
174
# File 'lib/blue_shoes/app.rb', line 171

def font(message)
  # returns an array of font family names
  throw NotImplementedError
end

#gradient(color1, color2) ⇒ Object

Builds a linear gradient from two colors. For each color, you may pass in a Shoes::Color object or a string describing the color.



177
178
179
180
# File 'lib/blue_shoes/app.rb', line 177

def gradient(color1, color2)
  # returns Shoes::Pattern
  throw NotImplementedError
end

#gray(darkness, alpha) ⇒ Object

Create a grayscale color from a level of darkness and, optionally, an alpha level.



183
184
185
186
# File 'lib/blue_shoes/app.rb', line 183

def gray(darkness, alpha)
  # returns  Shoes::Color
  throw NotImplementedError
end

#gutterObject

The size of the scrollbar area. When Shoes needs to show a scrollbar, the scrollbar may end up covering up some elements that touch the edge of the window. The gutter tells you how many pixels to expect the scrollbar to cover.



663
664
665
666
# File 'lib/blue_shoes/app.rb', line 663

def gutter
  # returns a number
  throw NotImplementedError
end

#heightObject

The vertical size of the viewable slot in pixels. So, if this is a scrolling slot, you’ll need to use scroll_height() to get the full size of the slot.



669
670
671
672
# File 'lib/blue_shoes/app.rb', line 669

def height
  # returns a number
  throw NotImplementedError
end

#hideObject

Hides the slot, so that it can’t be seen. See also show and toggle.



675
676
677
678
# File 'lib/blue_shoes/app.rb', line 675

def hide
  #returns self
  throw NotImplementedError
end

#hover(&blk) ⇒ Object

The hover event happens when the mouse enters the slot. The block gets self, meaning the object which was hovered over.



585
586
587
588
# File 'lib/blue_shoes/app.rb', line 585

def hover(&blk)
  # returns self
  throw NotImplementedError
end

#image(path) ⇒ Object

Creates an Image element for displaying a picture. PNG, JPEG and GIF formats are allowed.



450
451
452
453
# File 'lib/blue_shoes/app.rb', line 450

def image(path)
  # returns  Shoes::Image
  throw NotImplementedError
end

#imagesize(path) ⇒ Object

Quickly grab the width and height of an image. The image won’t be loaded into the cache or displayed.



456
457
458
459
# File 'lib/blue_shoes/app.rb', line 456

def imagesize(path)
  # returns  [width, height]
  throw NotImplementedError
end

#info(message) ⇒ Object

Logs an informational message to the user in the Shoes console. So, where debug messages are designed to help the program figure out what’s happening, info messages tell the user extra information about the program.



189
190
191
192
# File 'lib/blue_shoes/app.rb', line 189

def info(message)
  # returns nil
  throw NotImplementedError
end

#ins(text) ⇒ Object

Creates an Ins text fragment (short for “inserted”) which Shoes styles with a single underline.



462
463
464
465
# File 'lib/blue_shoes/app.rb', line 462

def ins(text)
  # returns  Shoes::Ins
  throw NotImplementedError
end

#inscription(text) ⇒ Object

Creates an Inscription text block. Shoes styles this text at 10 pixels high.



468
469
470
471
# File 'lib/blue_shoes/app.rb', line 468

def inscription(text)
  # returns  Shoes::Inscription
  throw NotImplementedError
end

#keypress(&blk) ⇒ Object

Whenever a key (or combination of keys) is pressed, the block gets called. The block is sent a key which is a string representing the character (such as the letter or number) on the key. For special keys and key combos, a Ruby symbol is sent, rather than a string.



591
592
593
594
# File 'lib/blue_shoes/app.rb', line 591

def keypress(&blk)
  # returns self
  throw NotImplementedError
end

#leave(&blk) ⇒ Object

The leave event takes place when the mouse cursor exits a slot. The moment it no longer is inside the slot’s edges. When that takes place, the block is called with self, the slot object which is being left.



597
598
599
600
# File 'lib/blue_shoes/app.rb', line 597

def leave(&blk)
  # returns self
  throw NotImplementedError
end

#leftObject

The left pixel location of the slot. Also known as the x-axis coordinate.



681
682
683
684
# File 'lib/blue_shoes/app.rb', line 681

def left
  # returns a number
  throw NotImplementedError
end

#line(left, top, x2, y2) ⇒ Object

Draws a line using the current line color (aka “stroke”) starting at coordinates (left, top) and ending at coordinates (x2, y2).



288
289
290
291
# File 'lib/blue_shoes/app.rb', line 288

def line(left, top, x2, y2)
  # returns  Shoes::Shape
  throw NotImplementedError
end

Creates a Link text block, which Shoes styles with a single underline and colors with a #06E (blue) colored stroke.



474
475
476
477
# File 'lib/blue_shoes/app.rb', line 474

def link(text, opts)
  # returns  Shoes::Link
  throw NotImplementedError
end

#list_box(opts) ⇒ Object

Adds a drop-down list box containing entries for everything in the items array. An optional block may be attached, which is called if anything in the box becomes selected by the user.



480
481
482
483
# File 'lib/blue_shoes/app.rb', line 480

def list_box(opts)
  # returns  Shoes::ListBox
  throw NotImplementedError
end

#locationObject

Gets a string containing the URL of the current app.



223
224
225
# File 'lib/blue_shoes/app.rb', line 223

def location
  throw NotImplementedError
end

#motion(&blk) ⇒ Object

The motion block gets called every time the mouse moves around inside the slot. The block is handed the cursor’s left and top coordinates.



603
604
605
606
# File 'lib/blue_shoes/app.rb', line 603

def motion(&blk)
  # returns self
  throw NotImplementedError
end

#mouseObject

Identifies the mouse cursor’s location, along with which button is being pressed.



228
229
230
231
# File 'lib/blue_shoes/app.rb', line 228

def mouse
  # an array of numbers: button, left, top
  throw NotImplementedErrror
end

#move(left, top) ⇒ Object

Moves the slot to specific coordinates, the (left, top) being the upper left hand corner of the slot.



687
688
689
690
# File 'lib/blue_shoes/app.rb', line 687

def move(left, top)
  # returns self
  throw NotImplementedError
end

#nofillObject

Blanks the fill color, so that any shapes drawn will not be filled in. Instead, shapes will have only a lining, leaving the middle transparent.



276
277
278
279
# File 'lib/blue_shoes/app.rb', line 276

def nofill
  # returns self
  throw NotImplementedError
end

#nostrokeObject

Empties the line color. Shapes drawn will have no outer line. If nofill is also set, shapes drawn will not be visible.



282
283
284
285
# File 'lib/blue_shoes/app.rb', line 282

def nostroke
  # returns  self
  throw NotImplementedError
end

#oval(styles) ⇒ Object

Draw circular form using a style hash.



294
295
296
297
# File 'lib/blue_shoes/app.rb', line 294

def oval(left, top, radius)
  # returns  Shoes::Shape
  throw NotImplementedError
end

#ownerObject

Gets the app which launched this app. In most cases, this will be nil. But if this app was launched using the window method, the owner will be the app which called window.



234
235
236
237
# File 'lib/blue_shoes/app.rb', line 234

def owner
  #returns Shoes::App
  throw NotImplementedError
end

#para(text) ⇒ Object

Create a Para text block (short for “paragraph”) which Shoes styles at 12 pixels high.



492
493
494
495
496
# File 'lib/blue_shoes/app.rb', line 492

def para(text)
  para = Shoes::Para.new(text)
  add_widget para.to_label
  para
end

#parentObject

Gets the object for this element’s container.



770
771
772
773
# File 'lib/blue_shoes/app.rb', line 770

def parent
  # returns a Shoes::Stack or Shoes::Flow
  throw NotImplementedError
end

#prepend(&blk) ⇒ Object

Adds elements to the beginning of a slot.



651
652
653
654
# File 'lib/blue_shoes/app.rb', line 651

def prepend(&blk)
  # returns self
  throw NotImplementedError
end

#progressObject

Adds a progress bar.



486
487
488
489
# File 'lib/blue_shoes/app.rb', line 486

def progress
  # returns  Shoes::Progress
  throw NotImplementedError
end

#radio(group) ⇒ Object

Adds a radio button. If a group name is given, the radio button is considered part of a group. Among radio buttons in the same group, only one may be checked. (If no group name is given, the radio button is grouped with any other radio buttons in the same slot.)



499
500
501
502
# File 'lib/blue_shoes/app.rb', line 499

def radio(group)
  # returns  Shoes::Radio
  throw NotImplementedError
end

#rect(styles) ⇒ Object

Draw a rectangle using a style hash.



306
307
308
309
# File 'lib/blue_shoes/app.rb', line 306

def rect(top, left, width, height, corners = 0)
  # returns  Shoes::Shape
  throw NotImplementedError
end

#release(&blk) ⇒ Object

The release block runs whenever the mouse is unclicked (on mouse up). When the finger is lifted. The button is the number of the button that was depressed. The left and top are the coordinates of the mouse at the time the button was released.



609
610
611
612
# File 'lib/blue_shoes/app.rb', line 609

def release(&blk)
  # returns self
  throw NotImplementedError
end

#removeObject

Removes the slot. It will no longer be displayed and will not be listed in its parent’s contents. It’s gone.



693
694
695
696
# File 'lib/blue_shoes/app.rb', line 693

def remove
  # returns self
  throw NotImplementedError
end

#rgb(red, green, blue, alpha) ⇒ Object

Create a color from red, green and blue components. An alpha level (indicating transparency) can also be added, optionally. This method may also be called as Shoes.rgb.



196
197
198
199
# File 'lib/blue_shoes/app.rb', line 196

def rgb(red, green, blue, alpha)
  # returns Shoes::Color
  throw NotImplementedError
end

#rotate(degrees) ⇒ Object

Rotates the pen used for drawing by a certain number of degrees, so that any shapes will be drawn at that angle.



318
319
320
321
# File 'lib/blue_shoes/app.rb', line 318

def rotate(degrees)
  # returns  self
  throw NotImplementedError
end

#scrollObject

Is this slot allowed to show a scrollbar? True or false. The scrollbar will only appear if the height of the slot is also fixed.



699
700
701
702
# File 'lib/blue_shoes/app.rb', line 699

def scroll
  # returns true or false
  throw NotImplementedError
end

#scroll_heightObject

The vertical size of the full slot, including any of it which is hidden by scrolling.



705
706
707
708
# File 'lib/blue_shoes/app.rb', line 705

def scroll_height
  # returns a number
  throw NotImplementedError
end

#scroll_maxObject

The top coordinate which this slot can be scrolled down to. The top coordinate of a scroll bar is always zero. The bottom coordinate is the full height of the slot minus one page of scrolling. This bottom coordinate is what scroll_max returns.



711
712
713
714
# File 'lib/blue_shoes/app.rb', line 711

def scroll_max
  # returns a number
  throw NotImplementedError
end

#scroll_topObject

The top coordinate which this slot is scrolled down to. So, if the slot is scrolled down twenty pixels, this method will return 20.



717
718
719
720
# File 'lib/blue_shoes/app.rb', line 717

def scroll_top
  # returns a number
  throw NotImplementedError
end

#scroll_top=(number) ⇒ Object

Scrolls the slot to a certain coordinate. This must be between zero and scroll_max.



723
724
725
# File 'lib/blue_shoes/app.rb', line 723

def scroll_top=(number)
  throw NotImplementedErrror
end

#shape(left, top) ⇒ Object

Describes an arbitrary shape to draw, beginning at coordinates (left, top) and continued by calls to line_to, move_to, curve_to and arc_to inside the block. You can look at it as sketching a shape with a long line that curves and arcs and bends.



324
325
326
327
# File 'lib/blue_shoes/app.rb', line 324

def shape(left, top)
  # returns Shoes::Shape
  throw NotImplementedError
end

#showObject

Reveals the slot, if it is hidden. See also hide and toggle.



728
729
730
731
# File 'lib/blue_shoes/app.rb', line 728

def show
  # returns self
  throw NotImplementedError
end

#span(text) ⇒ Object

Creates a Span text fragment, unstyled by default.



505
506
507
508
# File 'lib/blue_shoes/app.rb', line 505

def span(text)
  # returns  Shoes::Span
  throw NotImplementedError
end

#stack(style, &blk) ⇒ Object

Creates a new stack. A stack is a type of slot. (See the main Slots page for a full explanation of both stacks and flows.)



511
512
513
514
515
516
# File 'lib/blue_shoes/app.rb', line 511

def stack(style, &blk)
  stack = Shoes::Stack.new
  add_widget stack
  instance_eval &blk
  stack
end

#star(left, top, points = 10, outer = 100.0, inner = 50.0) ⇒ Object

Draws a star using the stroke and fill colors. The star is positioned with its center point at coordinates (left, top) with a certain number of points. The outer width defines the full radius of the star; the inner width specifies the radius of the star’s middle, where points stem from.



330
331
332
333
# File 'lib/blue_shoes/app.rb', line 330

def star(left, top, points = 10, outer = 100.0, inner = 50.0)
  # returns  Shoes::Shape
  throw NotImplementedError
end

#start(&blk) ⇒ Object

The first time the slot is drawn, the start event fires. The block is handed self, the slot object which has just been drawn.



615
616
617
618
# File 'lib/blue_shoes/app.rb', line 615

def start(&blk)
  # returns self
  throw NotImplementedError
end

#started?Boolean

Has the window been fully constructed and displayed? This is useful for threaded code which may try to use the window before it is completely built. (Also see the start event which fires once the window is open.)

Returns:

  • (Boolean)


240
241
242
243
# File 'lib/blue_shoes/app.rb', line 240

def started?
  # returns true or false
  throw NotImplementedError
end

#stroke(pattern) ⇒ Object

Set the active line color for this slot. The pattern may be a color, a gradient or an image, all of which are categorized as “patterns.” The line color is then used to draw the borders of any subsequent shape.



336
337
338
339
# File 'lib/blue_shoes/app.rb', line 336

def stroke(pattern)
  # returns  pattern
  throw NotImplementedError
end

#strokewidth(number) ⇒ Object

Sets the line size for all drawing within this slot. Whereas the stroke method alters the line color, the strokewidth method alters the line size in pixels. Calling strokewidth(4) will cause lines to be drawn 4 pixels wide.



342
343
344
345
# File 'lib/blue_shoes/app.rb', line 342

def strokewidth(number)
  # returns  self
  throw NotImplementedError
end

#strong(text) ⇒ Object

Creates a Strong text fragment, styled in bold by default.



519
520
521
522
# File 'lib/blue_shoes/app.rb', line 519

def strong(text)
  strong = Shoes::Strong.new(text)
  strong
end

#style(styles) ⇒ Object

Alter the slot using a hash of style settings. Any of the methods on this page (aside from this method, of course) can be used as a style setting. So, for example, there is a width method, thus there is also a width style.



734
735
736
737
# File 'lib/blue_shoes/app.rb', line 734

def style
  # returns styles
  throw NotImplementedError
end

#sub(text) ⇒ Object

Creates a Sub text fragment (short for “subscript”) which defaults to lowering the text by 10 pixels and styling it in an x-small font.



525
526
527
528
# File 'lib/blue_shoes/app.rb', line 525

def sub(text)
  # returns  Shoes::Sub
  throw NotImplementedError
end

#subtitle(text) ⇒ Object

Creates a Subtitle text block. Shoes styles this text to 26 pixels high.



531
532
533
534
# File 'lib/blue_shoes/app.rb', line 531

def subtitle(text)
  # returns  Shoes::Subtitle
  throw NotImplementedError
end

#sup(text) ⇒ Object

Creates a Sup text fragment (short for “superscript”) which defaults to raising the text by 10 pixels and styling it in an x-small font.



537
538
539
540
# File 'lib/blue_shoes/app.rb', line 537

def sup(text)
  # returns  Shoes::Sup
  throw NotImplementedError
end

#tagline(text) ⇒ Object

Creates a Tagline text block. Shoes styles this text to 18 pixels high.



543
544
545
546
# File 'lib/blue_shoes/app.rb', line 543

def tagline(text)
  # returns  Shoes::Tagline
  throw NotImplementedError
end

#timer(seconds) ⇒ Object

A one-shot timer. If you want to schedule to run some code in a few seconds (or minutes, hours) you can attach the code as a block here.



549
550
551
552
# File 'lib/blue_shoes/app.rb', line 549

def timer(seconds)
  # returns Shoes::Timer
  throw NotImplementedError
end

#title(text) ⇒ Object

Creates a Title text block. Shoes styles these elements to 34 pixels high.



555
556
557
558
# File 'lib/blue_shoes/app.rb', line 555

def title(text)
  # returns  Shoes::Title
  throw NotImplementedError
end

#toggleObject

Hides the slot, if it is shown. Or shows the slot, if it is hidden.



746
747
748
749
# File 'lib/blue_shoes/app.rb', line 746

def toggle
  # returns self
  throw NotImplementedError
end

#topObject

The top pixel location of the slot. Also known as the y-axis coordinate.



752
753
754
755
# File 'lib/blue_shoes/app.rb', line 752

def top
  # returns a number
  throw NotImplementedError
end

#transform(where) ⇒ Object

Should transformations (such as skew and rotate) be performed around the center of the shape? Or the corner of the shape? Shoes defaults to :corner.



348
349
350
351
# File 'lib/blue_shoes/app.rb', line 348

def transform(where)
  # returns  self
  throw NotImplementedError
end

#translate(left, top) ⇒ Object

Moves the starting point of the drawing pen for this slot. Normally, the pen starts at (0, 0) in the top-left corner, so that all shapes are drawn from that point. With translate, if the starting point is moved to (10, 20) and a shape is drawn at (50, 60), then the shape is actually drawn at (60, 80) on the slot.



354
355
356
357
# File 'lib/blue_shoes/app.rb', line 354

def translate(left, top)
  # returns  self
  throw NotImplementedError
end

#video(url) ⇒ Object

Embeds a movie in this slot.



561
562
563
564
# File 'lib/blue_shoes/app.rb', line 561

def video(url)
  # returns  Shoes::Video
  throw NotImplementedError
end

#visit(url) ⇒ Object

Changes the location, in order to view a different Shoes URL.



247
248
249
# File 'lib/blue_shoes/app.rb', line 247

def visit url
  throw NotImplementedError
end

#warn(message) ⇒ Object

Logs a warning for the user. A warning is not a catastrophic error (see error for that.) It is just a notice that the program will be changing in the future or that certain parts of the program aren’t reliable yet.



203
204
205
206
# File 'lib/blue_shoes/app.rb', line 203

def warn(message)
  # returns nil
  throw NotImplementedError
end

#widthObject

The horizontal size of the slot in pixels.



758
759
760
761
# File 'lib/blue_shoes/app.rb', line 758

def width
  # returns a number
  throw NotImplementedError
end

#window(styles) ⇒ Object

Opens a new app window. This method is almost identical to the Shoes.app method used to start an app in the first place. The difference is that the window method sets the new window’s owner property. (A normal Shoes.app has its owner set to nil.)



567
568
569
570
# File 'lib/blue_shoes/app.rb', line 567

def window(styles)
  # returns Shoes::App
  throw NotImplementedError
end