/* Copyright (c) 2009  Fabien Parent <parent.f@gmail.com>
 *
 * This file is part of gdlmm.
 *
 * gdlmm is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 2.1 of the License,
 * or (at your option) any later version.
 *
 * gdlmm is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <gdl/libgdltypebuiltins.h>

namespace Gdl
{

DockItem::DockItem(const Glib::ustring& name, const Glib::ustring& long_name, DockItemBehavior behavior)
:
  _CONSTRUCT("name", name.c_str(), "long-name", long_name.c_str(), "behavior", static_cast<GdlDockItemBehavior>(behavior))
{
  GdlDockItem* item = this->gobj();
  int flags = GDL_DOCK_OBJECT(item)->flags;
  flags &= ~GDL_DOCK_AUTOMATIC;
  GDL_DOCK_OBJECT(item)->flags = static_cast<GdlDockObjectFlags>(flags);
  gdl_dock_item_set_tablabel(item, gtk_label_new(long_name.c_str()));
}

DockItem::DockItem(const Glib::ustring& name, const Glib::ustring& long_name, const Gtk::StockID& stock_id, DockItemBehavior behavior)
:
  _CONSTRUCT("name", name.c_str(), "long-name", long_name.c_str(), "stock-id", stock_id.get_c_str(), "behavior", static_cast<GdlDockItemBehavior>(behavior))
{
  GdlDockItem* item = this->gobj();
  int flags = GDL_DOCK_OBJECT(item)->flags;
  flags &= ~GDL_DOCK_AUTOMATIC;
  GDL_DOCK_OBJECT(item)->flags = static_cast<GdlDockObjectFlags>(flags);
  gdl_dock_item_set_tablabel(item, gtk_label_new(long_name.c_str()));
}

void DockItem::dock_floating(int docking_param)
{
  gdl_dock_item_dock_to(gobj(), 0, GDL_DOCK_FLOATING, docking_param);
}

} // namespace Gdl
