/*! \file dockbook.cpp
** \brief Template File
**
-** $Id: dockbook.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+** $Id$
**
** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
+** This package 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
+** General Public License for more details.
** \endlegal
*/
/* ========================================================================= */
#include <gtkmm/eventbox.h>
#include <gtkmm/menu.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
DockBook::clear()
{
while(get_n_pages())
- {
remove(static_cast<Dockable&>(*get_nth_page(get_n_pages()-1)));
- }
}
void
context->drag_finish(true, false, time);
return;
}
-
+
context->drag_finish(false, false, time);
}
DockBook::add(Dockable& dockable, int position)
{
dockable.detach();
-
+
if(position==-1)
append_page(dockable, " ");
else
&dockable
)
);
-
+
dockable.parent_=this;
dockable.show();
//set_current_page(get_n_pages()-1);
-
+
signal_changed_();
}
DockBook::refresh_tab(Dockable* dockable)
{
Gtk::Widget* label(dockable->create_tab_label());
-
+
label->signal_button_press_event().connect(
sigc::bind(
sigc::mem_fun(
if(!deleting_)
{
signal_changed_();
-
+
if(get_n_pages()==0)
signal_empty()();
}
DockBook::get_local_contents()const
{
synfig::String ret;
-
+
for(int i(0);i!=const_cast<DockBook*>(this)->get_n_pages();i++)
{
Dockable& dockable(static_cast<Dockable&>(*const_cast<DockBook*>(this)->get_nth_page(i)));
-
+
if(i)
ret+=", ";
ret+=dockable.get_local_name();
}
-
+
return ret;
}
DockBook::get_contents()const
{
synfig::String ret;
-
+
for(int i(0);i!=const_cast<DockBook*>(this)->get_n_pages();i++)
{
Dockable& dockable(static_cast<Dockable&>(*const_cast<DockBook*>(this)->get_nth_page(i)));
-
+
if(i)
ret+=' ';
ret+=dockable.get_name();
}
-
+
return ret;
}
synfig::String str(x);
while(!str.empty())
{
- unsigned int separator=str.find_first_of(' ');
+ synfig::String::size_type separator=str.find_first_of(' ');
synfig::String dock;
if(separator==synfig::String::npos)
{
dock=String(str.begin(),str.begin()+separator);
str=String(str.begin()+separator+1,str.end());
}
-
+
try
{
add(App::dock_manager->find_dockable(dock));
{
if(event->button!=3)
return false;
-
+
Gtk::Menu *tabmenu=manage(new class Gtk::Menu());
-
+ tabmenu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), tabmenu));
+
tabmenu->items().push_back(
Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-close"),
sigc::mem_fun(*dockable,&Dockable::detach)
);
tabmenu->popup(event->button,gtk_get_current_event_time());
-
+
return true;
}