/*
 * Copyright 1998-2002 The gtkmm Development Team
 *
 * This library 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.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtk/gtk.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/label.h>
#include <gtkmm/box.h>
#include <gtkmm/image.h>

namespace Gtk
{

void
Bin::remove()
{
  auto child = get_child();
  if (child)
    Container::remove(*child);
}

void
Bin::add_label(const Glib::ustring& str, bool mnemonic,
	       Align x_align, Align y_align /* = ALIGN_CENTER */)
{
  auto label = manage(new Label(str, x_align, y_align, mnemonic));
  add(*label);
  label->show();
}

void
Bin::add_pixlabel(const std::string& pixfile,
      const Glib::ustring& str,
      Align x_align, Align y_align /* = ALIGN_CENTER */)
{
  //Create Image and Label widgets:
  auto pmap = manage(new Image(pixfile));
  auto label = manage(new Label(str, x_align, y_align));

  //Put them in a Box:
  auto hbox = manage(new Box(ORIENTATION_HORIZONTAL, 5));
  hbox->pack_start(*pmap, PACK_SHRINK);
  hbox->pack_start(*label);

  //And put that Box in this:
  add(*hbox);
}

} //namespace Gtk
