class Plugin::ChangeAccount::SubPartsTutorial

Constants

Button
ButtonBottom
ButtonLeft
ButtonMargin
ButtonRight
ButtonTop
OutsideOffset

Public Class Methods

new(*args) click to toggle source
Calls superclass method Gdk::SubParts.new
# File core/plugin/change_account/interactive.rb, line 44
def initialize(*args)
  super
  if message[:confirm]
    sid = helper.ssc(:click){ |this, e, x, y|
      ofsty = helper.mainpart_height
      helper.subparts.each{ |part|
        break if part == self
        ofsty += part.height }
      if ofsty <= y and (ofsty + height) >= y and 1 == e.button
        button = generate_buttons.find{|b| b.x < x and x < (b.x+b.width) }
        if button
          helper.signal_handler_disconnect(sid)
          message[:confirm] = nil
          helper.reset_height
          message[:confirm_callback].call(button.value) end end
      false } end
end

Public Instance Methods

height() click to toggle source
# File core/plugin/change_account/interactive.rb, line 74
def height
  buttons = generate_buttons
  return 0 if not buttons
  @height ||= (buttons.map{|b|b.layout.size[1]}.max / Pango::SCALE) + ButtonMargin*2 + ButtonTop + ButtonBottom end
render(context) click to toggle source
# File core/plugin/change_account/interactive.rb, line 62
def render(context)
  if helper.visible? and message and message[:confirm]
    context.save{
      buttons = generate_buttons(context)
      return if not buttons
      buttons.each{ |button|
        render_outline(context, button.x, button.y, *button.layout.size.map{|_|_/Pango::SCALE})
        context.save{
          context.translate(button.x + ButtonLeft, button.y + ButtonTop)
          context.set_source_rgb(*(UserConfig[:mumble_basic_color] || [0,0,0]).map{ |c| c.to_f / 65536 })
          context.show_pango_layout(button.layout) } } } end end