Class: AMS::SketchupObserver Abstract

Inherits:
Object
  • Object
show all
Defined in:
Documentation/ams/sketchup_observer.rb

Overview

This class is abstract.
Note:

SWO events are capable of monitoring window events. SWP, in addition to monitoring, are also capable making decisions to the window events. Returning 1 for an SWP event will prevent the event from reaching the SketchUp window procedure; any other return value won't block the event. If more than one observers install SWP events and one of them returns 1, the event will be blocked, regardless of whether other observers wanted the event to be processed by the SketchUp window procedure.

Note:

An observer can be a class, a module, or a class instance. Your observer will work as long as the callback methods are public.

Note:

Including all observer methods into your class is not necessary. You may include/elude those as you wish.

Note:

Windows only!

SketchUpObserver allows monitoring and making decisions to the input events and messages reaching the SketchUp window procedure.

Examples:

Processing keyboard events:

class MySketchupObserver

  def swp_on_key_down(vk_name, vk_value, vk_char)
    puts "on_key_down: #{vk_name}"
    # ...
    # Returning 1 will prevent current pressed key from interacting with SU
    # window procedure.
    # Here, we'll return 1 to W,S,A,D keys, so we could use them for our own
    # purpose, rather than having shortcuts changing the tool.
    return %(w s a d).include?(vk_name) ? 1 : 0
  end

  def swp_on_key_extended(vk_name, vk_value, vk_char)
    puts "on_key_extended: #{vk_name}"
    # ...
    # If you return 1 for the on_key_down event, it's also preferred to
    # return 1 for the on_key_extended event, so the key doesn't stand a
    # chance to interact with SketchUp window procedure.
    return %(w s a d).include?(vk_name) ? 1 : 0
  end

  def swp_on_key_up(vk_name, vk_value, vk_char)
    puts "on_key_up: #{vk_name}"
    # ...
    # If you return 1 for the on_key_down event, it's also preferred to
    # return 1 for the on_key_up event, so the key doesn't stand a chance to
    # interact with SketchUp window procedure.
    return %(w s a d).include?(vk_name) ? 1 : 0
  end

end # class MySketchupObserver

AMS::Sketchup.add_observer(MySketchupObserver.new)

See Also:

Since:

  • 2.0.0

Observer Events collapse

Mouse Input Events collapse

Keybaord Input Events collapse

SketchUp Window Events collapse

SketchUp Window Post Events collapse

Instance Method Details

#swo_activateObject

Called whenever this observer is added.

Since:

  • 2.0.0


57
58
# File 'Documentation/ams/sketchup_observer.rb', line 57

def swo_activate
end

#swo_deactivateObject

Called whenever this observer is removed.

Since:

  • 2.0.0


61
62
# File 'Documentation/ams/sketchup_observer.rb', line 61

def swo_deactivate
end

#swo_error(e) ⇒ Object

Note:

An error will not force the observer to deactivate. If you want the observer to deactivate on error, then this is the observer method implement.

Note:

If this event is not implemented, by default, the error will be outputted in console.

Note:

If there is an error in this event, the error message will be outputted in console.

Triggered whenever there is an error in any of the observer methods, with exception to this, particular observer method.

Examples:

Deactivating an observer when an error occurs.

class MyMouseWheelObserver

  def swp_on_mouse_wheel_rotate(x, y, dir)
    puts "Mouse wheel rotated #{dir == 1 ? 'up' : 'down'}!"
    # 'yo' is undefined. Make this error on purpose.
    yo
  end

  def swo_error(e)
    puts e.message
    # Deactivate our observer
    AMS::Sketchup.remove_observer(self)
  end

end # class MyMouseWheelObserver

AMS::Sketchup.add_observer(MyMouseWheelObserver.new)
# In this example, after adding an observer and rotating a mouse wheel,
# which would trigger the swp_on_mouse_wheel_rotate event, the undefined
# 'yo', which is in the swp_on_mouse_wheel_rotate event, will throw an
# exception, which would be caught by the swo_error event. The swo_error
# event will output the error message into console and unregister the
# current observer.

Parameters:

  • e (Exception)

Since:

  • 2.0.0


98
99
# File 'Documentation/ams/sketchup_observer.rb', line 98

def swo_error(e)
end

#swo_on_blurObject

Called when main window is deactivated.

Since:

  • 2.0.0


326
327
# File 'Documentation/ams/sketchup_observer.rb', line 326

def swo_on_blur
end

#swo_on_caption_changed(text) ⇒ Object

Called when main window title text is changed.

Parameters:

  • text (String)

    New text

Since:

  • 2.0.0


351
352
# File 'Documentation/ams/sketchup_observer.rb', line 351

def swo_on_caption_changed(text)
end

#swo_on_enter_menuObject

Called when application enters the menu loop.

Since:

  • 2.0.0


296
297
# File 'Documentation/ams/sketchup_observer.rb', line 296

def swo_on_enter_menu
end

#swo_on_enter_size_move(x, y, w, h) ⇒ Object

Called when main window enters the state of being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 2.0.0


336
337
# File 'Documentation/ams/sketchup_observer.rb', line 336

def swo_on_enter_size_move(x, y, w,h)
end

#swo_on_exit_menuObject

Called when application exits the menu loop.

Since:

  • 2.0.0


300
301
# File 'Documentation/ams/sketchup_observer.rb', line 300

def swo_on_exit_menu
end

#swo_on_exit_size_move(x, y, w, h) ⇒ Object

Called when main window exits the state of being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 2.0.0


346
347
# File 'Documentation/ams/sketchup_observer.rb', line 346

def swo_on_exit_size_move(x, y, w,h)
end

#swo_on_focusObject

Called when main window is activated.

Since:

  • 2.0.0


322
323
# File 'Documentation/ams/sketchup_observer.rb', line 322

def swo_on_focus
end

#swo_on_maximizeObject

Called when main window is maximized.

Since:

  • 2.0.0


310
311
# File 'Documentation/ams/sketchup_observer.rb', line 310

def swo_on_maximize
end

#swo_on_menu_bar_changed(state) ⇒ Object

Called when main window menu bar is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the menu bar is set; a false value indicates the menu bar is removed.

Since:

  • 2.0.0


357
358
# File 'Documentation/ams/sketchup_observer.rb', line 357

def swo_on_menu_bar_changed(state)
end

#swo_on_minimizeObject

Called when main window is minimized.

Since:

  • 2.0.0


314
315
# File 'Documentation/ams/sketchup_observer.rb', line 314

def swo_on_minimize
end

#swo_on_page_selected(page1, page2, tab_index1, tab_index2) ⇒ Object

Note:

Two additional parameters, tab_index1 and tab_index2, were added in 3.5.0.

Called when a scenes page is selected.

Parameters:

  • page1 (Sketchup::Page)

    Originally selected page.

  • page2 (Sketchup::Page)

    New selected page.

  • tab_index1 (Fixnum)
  • tab_index2 (Fixnum)

Since:

  • 3.2.0


445
446
# File 'Documentation/ams/sketchup_observer.rb', line 445

def swo_on_page_selected(page1, page2, tab_index1, tab_index2)
end

#swo_on_post_blurObject

Called after main window is deactivated.

Since:

  • 3.0.0


513
514
# File 'Documentation/ams/sketchup_observer.rb', line 513

def swo_on_post_blur
end

#swo_on_post_caption_changed(text) ⇒ Object

Called after main window title text is changed.

Parameters:

  • text (String)

    New text

Since:

  • 3.0.0


542
543
# File 'Documentation/ams/sketchup_observer.rb', line 542

def swo_on_post_caption_changed(text)
end

#swo_on_post_enter_menuObject

Called after application enters the menu loop.

Since:

  • 3.0.0


476
477
# File 'Documentation/ams/sketchup_observer.rb', line 476

def swo_on_post_enter_menu
end

#swo_on_post_enter_size_move(x, y, w, h) ⇒ Object

Called after main window enters the state of being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 3.0.0


524
525
# File 'Documentation/ams/sketchup_observer.rb', line 524

def swo_on_post_enter_size_move(x, y, w,h)
end

#swo_on_post_exit_menuObject

Called after application exits the menu loop.

Since:

  • 3.0.0


481
482
# File 'Documentation/ams/sketchup_observer.rb', line 481

def swo_on_post_exit_menu
end

#swo_on_post_exit_size_move(x, y, w, h) ⇒ Object

Called after main window exits the state of being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 3.0.0


536
537
# File 'Documentation/ams/sketchup_observer.rb', line 536

def swo_on_post_exit_size_move(x, y, w,h)
end

#swo_on_post_focusObject

Called after main window is activated.

Since:

  • 3.0.0


508
509
# File 'Documentation/ams/sketchup_observer.rb', line 508

def swo_on_post_focus
end

#swo_on_post_maximizeObject

Called after main window is maximized.

Since:

  • 3.0.0


493
494
# File 'Documentation/ams/sketchup_observer.rb', line 493

def swo_on_post_maximize
end

#swo_on_post_menu_bar_changed(state) ⇒ Object

Called after main window menu bar is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the menu bar is set; a false value indicates the menu bar is removed.

Since:

  • 3.0.0


549
550
# File 'Documentation/ams/sketchup_observer.rb', line 549

def swo_on_post_menu_bar_changed(state)
end

#swo_on_post_minimizeObject

Called after main window is minimized.

Since:

  • 3.0.0


498
499
# File 'Documentation/ams/sketchup_observer.rb', line 498

def swo_on_post_minimize
end

#swo_on_post_restoreObject

Called after main window is set to normal placement.

Since:

  • 3.0.0


503
504
# File 'Documentation/ams/sketchup_observer.rb', line 503

def swo_on_post_restore
end

#swo_on_post_scenes_bar_emptiedObject

Called after scenes bar loses its last page.

Since:

  • 3.0.0


581
582
# File 'Documentation/ams/sketchup_observer.rb', line 581

def swo_on_post_scenes_bar_emptied
end

#swo_on_post_scenes_bar_filledObject

Called after scenes bar gets its first page.

Since:

  • 3.0.0


576
577
# File 'Documentation/ams/sketchup_observer.rb', line 576

def swo_on_post_scenes_bar_filled
end

#swo_on_post_scenes_bar_visibility_changed(state) ⇒ Object

Called after scenes bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates scenes bar is set visible; a false value indicates scenes bar is set hidden.

Since:

  • 3.0.0


571
572
# File 'Documentation/ams/sketchup_observer.rb', line 571

def swo_on_post_scenes_bar_visibility_changed(state)
end

#swo_on_post_size_move(x, y, w, h) ⇒ Object

Called after main window is being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 3.0.0


530
531
# File 'Documentation/ams/sketchup_observer.rb', line 530

def swo_on_post_size_move(x, y, w,h)
end

#swo_on_post_status_bar_visibility_changed(state) ⇒ Object

Called after status bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates status bar is set visible; a false value indicates status bar is set hidden.

Since:

  • 3.0.0


588
589
# File 'Documentation/ams/sketchup_observer.rb', line 588

def swo_on_post_status_bar_visibility_changed(state)
end

#swo_on_post_switch_full_screen(state) ⇒ Object

Called after main window is switched to/from full screen mode.

Parameters:

  • state (Boolean)

    A true value indicates the window is set full screen; a false value indicated the window is unset from full screen mode.

Since:

  • 3.0.0


488
489
# File 'Documentation/ams/sketchup_observer.rb', line 488

def swo_on_post_switch_full_screen(state)
end

#swo_on_post_toolbar_container_emptied(bar) ⇒ Object

Called after toolbar container is emptied.

Parameters:

  • bar (Fixnum)

    A container which was emptied. It can be one of the following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

Since:

  • 3.0.0


623
624
# File 'Documentation/ams/sketchup_observer.rb', line 623

def swo_on_post_toolbar_container_emptied(bar)
end

#swo_on_post_toolbar_container_filled(bar) ⇒ Object

Called after toolbar container is filled.

Parameters:

  • bar (Fixnum)

    A container which was filled. It can be one of the following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

Since:

  • 3.0.0


612
613
# File 'Documentation/ams/sketchup_observer.rb', line 612

def swo_on_post_toolbar_container_filled(bar)
end

#swo_on_post_toolbar_container_visibility_changed(bar, state) ⇒ Object

Called after toolbar container is shown or hidden.

Parameters:

  • bar (Fixnum)

    A container which visibility state was changed. It can be one following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

  • state (Boolean)

    A true value indicates toolbar container is set visible; a false value indicates toolbar container is set hidden.

Since:

  • 3.0.0


601
602
# File 'Documentation/ams/sketchup_observer.rb', line 601

def swo_on_post_toolbar_container_visibility_changed(bar, state)
end

#swo_on_post_viewport_border_changed(state) ⇒ Object

Called after view border, a thin edge surrounding the view, is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the edge is set; a false value indicates the edge is removed.

Since:

  • 3.0.0


564
565
# File 'Documentation/ams/sketchup_observer.rb', line 564

def swo_on_post_viewport_border_changed(state)
end

#swo_on_post_viewport_size(w, h) ⇒ Object

Called after the view window is sized.

Parameters:

  • w (Fixnum)

    View width in pixels.

  • h (Fixnum)

    View height in pixels.

Since:

  • 3.0.0


556
557
# File 'Documentation/ams/sketchup_observer.rb', line 556

def swo_on_post_viewport_size(w,h)
end

#swo_on_quitObject

Called right before SketchUp window is destroyed.

Since:

  • 2.0.0


292
293
# File 'Documentation/ams/sketchup_observer.rb', line 292

def swo_on_quit
end

#swo_on_restoreObject

Called when main window is set to normal placement.

Since:

  • 2.0.0


318
319
# File 'Documentation/ams/sketchup_observer.rb', line 318

def swo_on_restore
end

#swo_on_scenes_bar_emptiedObject

Called when scenes bar loses its last page.

Since:

  • 2.0.0


384
385
# File 'Documentation/ams/sketchup_observer.rb', line 384

def swo_on_scenes_bar_emptied
end

#swo_on_scenes_bar_filledObject

Called when scenes bar gets its first page.

Since:

  • 2.0.0


380
381
# File 'Documentation/ams/sketchup_observer.rb', line 380

def swo_on_scenes_bar_filled
end

#swo_on_scenes_bar_visibility_changed(state) ⇒ Object

Called when scenes bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates scenes bar is set visible; a false value indicates scenes bar is set hidden.

Since:

  • 2.0.0


376
377
# File 'Documentation/ams/sketchup_observer.rb', line 376

def swo_on_scenes_bar_visibility_changed(state)
end

#swo_on_size_move(x, y, w, h) ⇒ Object

Called when main window is being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 2.0.0


341
342
# File 'Documentation/ams/sketchup_observer.rb', line 341

def swo_on_size_move(x, y, w,h)
end

#swo_on_status_bar_visibility_changed(state) ⇒ Object

Called when status bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates status bar is set visible; a false value indicates status bar is set hidden.

Since:

  • 2.0.0


390
391
# File 'Documentation/ams/sketchup_observer.rb', line 390

def swo_on_status_bar_visibility_changed(state)
end

#swo_on_switch_full_screen(state) ⇒ Object

Called when main window is switched to/from full screen mode.

Parameters:

  • state (Boolean)

    A true value indicates the window is set full screen; a false value indicated the window is unset from full screen mode.

Since:

  • 2.0.0


306
307
# File 'Documentation/ams/sketchup_observer.rb', line 306

def swo_on_switch_full_screen(state)
end

#swo_on_toolbar_container_emptied(bar) ⇒ Object

Called when toolbar container is emptied.

Parameters:

  • bar (Fixnum)

    A container which was emptied. It can be one of the following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

Since:

  • 2.0.0


422
423
# File 'Documentation/ams/sketchup_observer.rb', line 422

def swo_on_toolbar_container_emptied(bar)
end

#swo_on_toolbar_container_filled(bar) ⇒ Object

Called when toolbar container is filled.

Parameters:

  • bar (Fixnum)

    A container which was filled. It can be one of the following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

Since:

  • 2.0.0


412
413
# File 'Documentation/ams/sketchup_observer.rb', line 412

def swo_on_toolbar_container_filled(bar)
end

#swo_on_toolbar_container_visibility_changed(bar, state) ⇒ Object

Called when toolbar container is shown or hidden.

Parameters:

  • bar (Fixnum)

    A container which visibility state was changed. It can be one following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

  • state (Boolean)

    A true value indicates toolbar container is set visible; a false value indicates toolbar container is set hidden.

Since:

  • 2.0.0


402
403
# File 'Documentation/ams/sketchup_observer.rb', line 402

def swo_on_toolbar_container_visibility_changed(bar, state)
end

#swo_on_user_message(sender_handle, id, user_data) ⇒ Object

Called when a user-sent message is received.

Parameters:

  • sender_handle (Fixnum)

    A handle to a SketchUp main window that sent a message.

  • id (Fixnum)

    A user-defined unique message identifier sent along with a message.

  • user_data (nil, Boolean, Fixnum, Bignum, Float, String, Symbol, Hash)

    User-defined information or data sent along with a message.

See Also:

Since:

  • 3.1.0


434
435
# File 'Documentation/ams/sketchup_observer.rb', line 434

def swo_on_user_message(sender_handle, id, user_data)
end

#swo_on_viewport_border_changed(state) ⇒ Object

Called when view border, a thin edge surrounding the view, is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the edge is set; a false value indicates the edge is removed.

Since:

  • 2.0.0


370
371
# File 'Documentation/ams/sketchup_observer.rb', line 370

def swo_on_viewport_border_changed(state)
end

#swo_on_viewport_size(w, h) ⇒ Object

Called when the view window is sized.

Parameters:

  • w (Fixnum)

    View width in pixels.

  • h (Fixnum)

    View height in pixels.

Since:

  • 2.0.0


363
364
# File 'Documentation/ams/sketchup_observer.rb', line 363

def swo_on_viewport_size(w,h)
end

#swp_on_command(id) ⇒ Fixnum

Note:

Since version 3.1.0, this event no longer triggers on 24214 command.

Called when SketchUp window procedure comes across the WM_COMMAND message. This event responds to Sketchup.send_action, as it too, generates WM_COMMAND messages. This event is usually called when a tool is activated.

Parameters:

  • id (Fixnum)

    Command identifier

Returns:

  • (Fixnum)

    A return value of 1 will prevent the command from reaching SketchUp window procedure; any other return value won't block the command.

Since:

  • 2.0.0


288
289
# File 'Documentation/ams/sketchup_observer.rb', line 288

def swp_on_command(id)
end

#swp_on_key_down(vk_name, vk_value, vk_char) ⇒ Fixnum

Called when key is pressed.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Fixnum)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Fixnum)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0


255
256
# File 'Documentation/ams/sketchup_observer.rb', line 255

def swp_on_key_down(vk_name, vk_value, vk_char)
end

#swp_on_key_extended(vk_name, vk_value, vk_char) ⇒ Fixnum

Called when key is held down.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Fixnum)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Fixnum)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0


265
266
# File 'Documentation/ams/sketchup_observer.rb', line 265

def swp_on_key_extended(vk_name, vk_value, vk_char)
end

#swp_on_key_up(vk_name, vk_value, vk_char) ⇒ Fixnum

Called when key is released.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Fixnum)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Fixnum)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0


275
276
# File 'Documentation/ams/sketchup_observer.rb', line 275

def swp_on_key_up(vk_name, vk_value, vk_char)
end

#swp_on_lbutton_double_click(x, y) ⇒ Fixnum

Called when left mouse button is double clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


124
125
# File 'Documentation/ams/sketchup_observer.rb', line 124

def swp_on_lbutton_double_click(x, y)
end

#swp_on_lbutton_down(x, y) ⇒ Fixnum

Called when left mouse button is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


112
113
# File 'Documentation/ams/sketchup_observer.rb', line 112

def swp_on_lbutton_down(x, y)
end

#swp_on_lbutton_up(x, y) ⇒ Fixnum

Called when left mouse button is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


118
119
# File 'Documentation/ams/sketchup_observer.rb', line 118

def swp_on_lbutton_up(x, y)
end

#swp_on_mbutton_double_click(x, y) ⇒ Fixnum

Called when middle mouse button is double clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


142
143
# File 'Documentation/ams/sketchup_observer.rb', line 142

def swp_on_mbutton_double_click(x, y)
end

#swp_on_mbutton_down(x, y) ⇒ Fixnum

Called when middle mouse button is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


148
149
# File 'Documentation/ams/sketchup_observer.rb', line 148

def swp_on_mbutton_down(x, y)
end

#swp_on_mbutton_up(x, y) ⇒ Fixnum

Called when middle mouse button is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


154
155
# File 'Documentation/ams/sketchup_observer.rb', line 154

def swp_on_mbutton_up(x, y)
end

#swp_on_mouse_enter(x, y) ⇒ Fixnum

Called when cursor enters the viewport client area.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.6.0


226
227
# File 'Documentation/ams/sketchup_observer.rb', line 226

def swp_on_mouse_enter(x, y)
end

#swp_on_mouse_leave(x, y) ⇒ Fixnum

Called when cursor leaves the viewport client area.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.6.0


233
234
# File 'Documentation/ams/sketchup_observer.rb', line 233

def swp_on_mouse_leave(x, y)
end

#swp_on_mouse_move(x, y) ⇒ Fixnum

Note:

Returning 1 doesn't prevent the mouse from moving, but it does prevent the cursor position change event from being sent to the viewport window.

Called when cursor is moved within the viewport client area.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.6.0


242
243
# File 'Documentation/ams/sketchup_observer.rb', line 242

def swp_on_mouse_move(x, y)
end

#swp_on_mouse_wheel_rotate(x, y, dir) ⇒ Fixnum

Called when mouse wheel is rotated.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

  • dir (Fixnum)

    A positive value (1) indicates that the wheel was rotated forward, away from the user; a negative value (-1) indicates that the wheel was rotated backward, toward the user.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


208
209
# File 'Documentation/ams/sketchup_observer.rb', line 208

def swp_on_mouse_wheel_rotate(x, y, dir)
end

#swp_on_mouse_wheel_tilt(x, y, dir) ⇒ Fixnum

Called when mouse wheel is tilted.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

  • dir (Fixnum)

    A positive value (1) indicates that the wheel was tilted right; a negative value (-1) indicates that the wheel was tilted left.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


219
220
# File 'Documentation/ams/sketchup_observer.rb', line 219

def swp_on_mouse_wheel_tilt(x, y, dir)
end

#swp_on_page_selected(page1, page2, tab_index1, tab_index2) ⇒ Fixnum

Note:

Unlike the swo_on_page_selected, this callback function allows preventing the activation of a page and is triggered only when the page is activated via selecting it from the scenes bar. Activating a page in any other way, through the API for instance, will not trigger this event.

Note:

This event is useful for creating custom scene transitions.

Called when a scenes page is selected.

Examples:

Activate scene tab without activating the associated page.

class MySWPObserver
  def swp_on_page_selected(page1, page2, tab_index1, tab_index2)
    AMS::Sketchup.activate_scenes_bar_tab(tab_index2)
    return 1
  end
end
AMS::Sketchup.add_observer(MySWPObserver.new)

Parameters:

  • page1 (Sketchup::Page)

    Originally selected page.

  • page2 (Sketchup::Page)

    New selected page.

  • tab_index1 (Fixnum)
  • tab_index2 (Fixnum)

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.5.0


468
469
# File 'Documentation/ams/sketchup_observer.rb', line 468

def swp_on_page_selected(page1, page2, tab_index1, tab_index2)
end

#swp_on_rbutton_down(x, y) ⇒ Fixnum

Called when right mouse button is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


130
131
# File 'Documentation/ams/sketchup_observer.rb', line 130

def swp_on_rbutton_down(x, y)
end

#swp_on_rbutton_up(x, y) ⇒ Fixnum

Called when right mouse button is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


136
137
# File 'Documentation/ams/sketchup_observer.rb', line 136

def swp_on_rbutton_up(x, y)
end

#swp_on_xbutton1_double_click(x, y) ⇒ Fixnum

Called when X mouse button 1 is double clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


178
179
# File 'Documentation/ams/sketchup_observer.rb', line 178

def swp_on_xbutton1_double_click(x, y)
end

#swp_on_xbutton1_down(x, y) ⇒ Fixnum

Called when X mouse button 1 is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


166
167
# File 'Documentation/ams/sketchup_observer.rb', line 166

def swp_on_xbutton1_down(x, y)
end

#swp_on_xbutton1_up(x, y) ⇒ Fixnum

Called when X mouse button 1 is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


172
173
# File 'Documentation/ams/sketchup_observer.rb', line 172

def swp_on_xbutton1_up(x, y)
end

#swp_on_xbutton2_double_click(x, y) ⇒ Fixnum

Called when X mouse button 2 is double clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


196
197
# File 'Documentation/ams/sketchup_observer.rb', line 196

def swp_on_xbutton2_double_click(x, y)
end

#swp_on_xbutton2_down(x, y) ⇒ Fixnum

Called when X mouse button 2 is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


184
185
# File 'Documentation/ams/sketchup_observer.rb', line 184

def swp_on_xbutton2_down(x, y)
end

#swp_on_xbutton2_up(x, y) ⇒ Fixnum

Called when X mouse button 2 is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0


190
191
# File 'Documentation/ams/sketchup_observer.rb', line 190

def swp_on_xbutton2_up(x, y)
end