Sha256: 4d63d632e5445dc2ef76556c09605c6eda7a09e22e395e60288507f8670b2845

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

module Netzke
  module Window
    # Ext.window.Window-based component. With +persistence+ option set to +true+, it will remember it's size, position, and maximized state.
    #
    # Example:
    #
    #     class MyWindow < Netke::Window::Base
    #       def configure
    #         super
    #         c.width = 800
    #         c.height = 600
    #         c.items = [:users] # nesting the `users` component declared below
    #       end
    #
    #       component :users
    #     end
    class Base < Netzke::Base
      client_class do |c|
        c.extend = "Ext.window.Window"
      end

      def configure_client(c)
        super
        [:x, :y, :width, :height].each { |p| c[p] = state[p].to_i if state[p] }
        c.maximized = state[:maximized] if state[:maximized]
      end

      endpoint :set_size_and_position do |params|
        [:x, :y, :width, :height].each {|p| state[p] = params[p].to_i}
      end

      endpoint :set_maximized do |maximized|
        maximized ? state[:maximized] = true : state.delete(:maximized)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
netzke-basepack-6.5.0.0 lib/netzke/window/base.rb
netzke-basepack-6.5.0.0.rc2 lib/netzke/window/base.rb
netzke-basepack-6.5.0.0.rc1 lib/netzke/window/base.rb
netzke-basepack-1.0.1.0 lib/netzke/window/base.rb
netzke-basepack-1.0.0.1 lib/netzke/window/base.rb
netzke-basepack-1.0.0.0 lib/netzke/window/base.rb
netzke-basepack-1.0.0.0.pre3 lib/netzke/window/base.rb
netzke-basepack-1.0.0.0.pre2 lib/netzke/window/base.rb
netzke-basepack-1.0.0.0.pre lib/netzke/window/base.rb