//*****************************************************************************************
// Truevision - a 3d modeler for gnome and povray
//
// proppanel.cc
//
// Vincent LE PRINCE <vincentleprince@users.sourceforge.net>
// Copyright (C) 2000-2001 Vincent LE PRINCE
// This file is part of the TRUEVISION Package

//   This program 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.
//
//   This program 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.
//
//   You should have received a copy of the GNU General Public License
//   along with this program; if not, write to the Free Software
//   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ 
//*******************************************************************************************
#include "include/proppanel.h"
#include "include/objectlist.h"
#include "include/matlist.h"
#include "include/interface.h"


//***************************************************
// Constructeur
//***************************************************
PropPanel::PropPanel( app_objs *appref, GtkWidget *box )
{
app_ref = appref;
app_ref->proppanel = this;
OBJLIST_DEF 
TEXLIST_DEF
page_num = 0;

notebook = gtk_notebook_new();
gtk_widget_set_usize( notebook, 257, -1 );
gtk_notebook_set_scrollable( GTK_NOTEBOOK(notebook), TRUE );
gtk_box_pack_start( GTK_BOX(box), notebook, TRUE, TRUE, 4 );

GtkWidget *pbox = new_page( notebook, _(" Edit "), GDK_F5, (GdkModifierType)0 );
objlist->set_edit_widget( pbox );

pbox = new_page( notebook, _(" Select "), GDK_F6, (GdkModifierType)0 );
objlist->set_select_widget( pbox );

pbox = new_page( notebook, _(" Create "), GDK_F7, (GdkModifierType)0 );
objlist->set_create_widget( pbox );

pbox = new_page( notebook, _(" Materials "), GDK_F8, (GdkModifierType)0 );
texlist->set_select_widget( pbox );

}

//*****************************************************
// New Page
//*****************************************************
GtkWidget *PropPanel::new_page( GtkWidget *notebk, const gchar *titre, guint key, GdkModifierType key_mod )
{
// Keyboard shortcuts
INTERF_DEF

GtkWidget *vbox = gtk_vbox_new( FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER(vbox), 2 );
label_button[page_num] = gtk_button_new_with_label( titre );
gtk_signal_connect( GTK_OBJECT(label_button[page_num]), "clicked", GTK_SIGNAL_FUNC(sign_proppanel_clicked), this );

gtk_button_set_relief( GTK_BUTTON(label_button[page_num]), GTK_RELIEF_NONE );
gtk_widget_add_accelerator( label_button[page_num], "clicked", interf->get_accels(), key, key_mod, (GtkAccelFlags)0 );
gtk_notebook_append_page( GTK_NOTEBOOK(notebk), vbox, label_button[page_num]  );
page_num++;
return vbox;
}


void PropPanel::label_clicked( GtkWidget *wid )
{
int i = 0;
for (  i = 0 ; i < page_num ; i++ )
	if ( label_button[i] == wid ) break;
if ( label_button[i]  == NULL ) return;
set_page( i );
}
