# Purpose: Setup and initialize the core gui interfaces for the Dock panels
#
# $Id: dockpane.rb,v 1.2 2004/10/05 19:45:37 ljulliar Exp $
#
# Authors:  Laurent Julliard <laurent AT moldus DOT org>
# Contributors:
#
# This file is part of the FreeRIDE project
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the Ruby license defined in the
# COPYING file.
#
# Copyright (c) 200 Laurent Julliard. All rights reserved.
#

require 'rubyide_gui/component_manager'
require 'rubyide_gui/component'

module FreeRIDE
  module GUI

    ##
    # This is the manager class for dockpane components.
    #
    class DockPane < Component
      extend FreeBASE::StandardPlugin
      
      def DockPane.start(plugin)
        base_slot = plugin["/system/ui/components/DockPane"]
        ComponentManager.new(plugin, base_slot, DockPane)
        plugin.transition(FreeBASE::RUNNING)
      end
      
      def initialize(plugin, base_slot)
        setup(plugin, base_slot, nil)
      end
      
      ##
      # Dock this pane to the supplied dockbar
      #
      def dock(dockbar_name)
        @dockbar_name = dockbar_name
        dockbar_path = "/system/ui/components/DockBar/#{dockbar_name}"
        @bar = @base_slot[dockbar_path]
        @actions['dock'].invoke(dockbar_path)
        @bar.manager.show
      end
      
      def show
        @actions['show'].invoke
        @bar.manager.show
      end
      
      def hide
        @actions['hide'].invoke
        @bar.manager.hide
      end

      def current?
	@actions['current?'].invoke
      end

      ##
      # Undock this dockpane. Make it overlaping again
      #
      def undock
        @actions['undock'].invoke
      end
      
    end  # class DockPane
    
  end
end # module FreeRIDE
