Class: TkToplevel

Class | TkToplevel
In: | tk/lib/tkextlib/tktrans/tktrans.rb tk/lib/tk/toplevel.rb
Parent: | Object

### Methods

add_menu add_menubar bind bind_append bind_remove bindinfo database_class database_classname new specific_class tktrans_get_image tktrans_set_image

### Included Modules

Wm TkMenuSpec

### Constants

TkCommandNames | = | ['toplevel'.freeze].freeze
WidgetClassName | = | 'Toplevel'.freeze

### Public Class methods

bind(*args, &b)

[Source]

    # File tk/lib/tk/toplevel.rb, line 229
      def self.bind(*args, &b)
        if self == WidgetClassNames[WidgetClassName] || self.name == ''
          super(*args, &b)
        else
          TkDatabaseClass.new(self.name).bind(*args, &b)
        end
      end

bind_append(*args, &b)

[Source]

    # File tk/lib/tk/toplevel.rb, line 236
      def self.bind_append(*args, &b)
        if self == WidgetClassNames[WidgetClassName] || self.name == ''
          super(*args, &b)
        else
          TkDatabaseClass.new(self.name).bind_append(*args, &b)
        end
      end

bind_remove(*args)

[Source]

    # File tk/lib/tk/toplevel.rb, line 243
      def self.bind_remove(*args)
        if self == WidgetClassNames[WidgetClassName] || self.name == ''
          super(*args)
        else
          TkDatabaseClass.new(self.name).bind_remove(*args)
        end
      end

bindinfo(*args)

[Source]

    # File tk/lib/tk/toplevel.rb, line 250
      def self.bindinfo(*args)
        if self == WidgetClassNames[WidgetClassName] || self.name == ''
          super(*args)
        else
          TkDatabaseClass.new(self.name).bindinfo(*args)
        end
      end

database_class()

[Source]

    # File tk/lib/tk/toplevel.rb, line 218
      def self.database_class
        if self == WidgetClassNames[WidgetClassName] || self.name == ''
          self
        else
          TkDatabaseClass.new(self.name)
        end
      end

database_classname()

[Source]

    # File tk/lib/tk/toplevel.rb, line 225
      def self.database_classname
        self.database_class.name
      end

new(parent=nil, screen=nil, classname=nil, keys=nil)

[Source]

    # File tk/lib/tk/toplevel.rb, line 98
      def initialize(parent=nil, screen=nil, classname=nil, keys=nil)
        my_class_name = nil
        if self.class < WidgetClassNames[WidgetClassName]
          my_class_name = self.class.name
          my_class_name = nil if my_class_name == ''
        end
        if parent.kind_of? Hash
          keys = _symbolkey2str(parent)
          if keys.key?('classname')
            keys['class'] = keys.delete('classname')
          end
          @classname = keys['class']
          @colormap  = keys['colormap']
          @container = keys['container']
          @screen    = keys['screen']
          @use       = keys['use']
          @visual    = keys['visual']
          if !@classname && my_class_name
            keys['class'] = @classname = my_class_name
          end
          if @classname.kind_of? TkBindTag
            @db_class = @classname
            @classname = @classname.id
          elsif @classname
            @db_class = TkDatabaseClass.new(@classname)
          else
            @db_class = self.class
            @classname = @db_class::WidgetClassName
          end
          keys, cmds = _wm_command_option_chk(keys)
          super(keys)
          cmds.each{|k,v|
            if v.kind_of? Array
              self.__send__(k,*v)
            else
              self.__send__(k,v)
            end
          }
          return
        end

        if screen.kind_of? Hash
          keys = screen
        else
          @screen = screen
          if classname.kind_of? Hash
            keys = classname
          else
            @classname = classname
          end
        end
        if keys.kind_of? Hash
          keys = _symbolkey2str(keys)
          if keys.key?('classname')
            keys['class'] = keys.delete('classname')
          end
          @classname = keys['class']  unless @classname
          @colormap  = keys['colormap']
          @container = keys['container']
          @screen    = keys['screen'] unless @screen
          @use       = keys['use']
          @visual    = keys['visual']
        else
          keys = {}
        end
        if !@classname && my_class_name
          keys['class'] = @classname = my_class_name
        end
        if @classname.kind_of? TkBindTag
          @db_class = @classname
          @classname = @classname.id
        elsif @classname
          @db_class = TkDatabaseClass.new(@classname)
        else
          @db_class = self.class
          @classname = @db_class::WidgetClassName
        end
        keys, cmds = _wm_command_option_chk(keys)
        super(parent, keys)
        cmds.each{|k,v|
          if v.kind_of? Array
            self.send(k,*v)
          else
            self.send(k,v)
          end
        }
      end

### Public Instance methods

add_menu(menu_info, tearoff=false, opts=nil)

[Source]

    # File tk/lib/tk/toplevel.rb, line 199
      def add_menu(menu_info, tearoff=false, opts=nil)
        # See tk/menuspec.rb for menu_info.
        # opts is a hash of default configs for all of cascade menus.
        # Configs of menu_info can override it.
        if tearoff.kind_of?(Hash)
          opts = tearoff
          tearoff = false
        end
        _create_menubutton(self, menu_info, tearoff, opts)
      end

add_menubar(menu_spec, tearoff=false, opts=nil)

[Source]

    # File tk/lib/tk/toplevel.rb, line 210
      def add_menubar(menu_spec, tearoff=false, opts=nil)
        # See tk/menuspec.rb for menu_spec.
        # opts is a hash of default configs for all of cascade menus.
        # Configs of menu_spec can override it.
        menu_spec.each{|info| add_menu(info, tearoff, opts)}
        self.menu
      end

specific_class()

def create_self(keys)

      if keys and keys != None
        tk_call_without_enc('toplevel', @path, *hash_kv(keys, true))
      else
        tk_call_without_enc('toplevel', @path)
      end

end private :create_self

[Source]

    # File tk/lib/tk/toplevel.rb, line 195
      def specific_class
        @classname
      end

tktrans_get_image()

[Source]

    # File tk/lib/tkextlib/tktrans/tktrans.rb, line 61
      def tktrans_get_image()
        tk_send('tktrans::settoplevel', @path)
      end

tktrans_set_image(img)

[Source]

    # File tk/lib/tkextlib/tktrans/tktrans.rb, line 57
      def tktrans_set_image(img)
        tk_send('tktrans::settoplevel', @path, img)
        self
      end

[Validate]