2
2
Bear Engine - Level editor
4
Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
4
Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
6
6
This program is free software; you can redistribute it and/or modify it
7
7
under the terms of the GNU General Public License as published by the
29
29
#ifndef __BF_PROPERTIES_FRAME_HPP__
30
30
#define __BF_PROPERTIES_FRAME_HPP__
32
#include "bf/item_field_edit.hpp"
33
#include "bf/windows_layout.hpp"
36
* \brief Declare the item_field_edit::set_field_value() methods.
37
* \param type The type for which the method is implemented.
38
* \remark The method for std::list<type> v is also declared.
40
#define DECLARE_PROXY_SET_FIELD_VALUE(type) \
41
void set_field_value \
42
( item_instance& item, const std::string& name, const type& v ); \
44
void set_field_value \
45
( item_instance& item, const std::string& name, const std::list<type>& v )
32
#include <wx/checkbox.h>
33
#include <wx/hyperlink.h>
34
#include <wx/listctrl.h>
36
#include <wx/stattext.h>
41
class item_field_edit;
45
class delete_item_field_event;
46
class request_item_id_event;
48
class set_field_value_event;
50
51
* \brief The properties window of our program.
51
52
* \author Julien Jorge
53
54
class properties_frame:
55
public item_field_edit::proxy
58
58
/** \brief The identifiers of the controls. */
61
61
IDC_ITEM_PROPERTIES,
63
63
IDC_TEXT_IDENTIFIER,
64
IDC_CHANGE_ITEM_CLASS,
65
66
}; // enum control_id
72
level_action* operator()
73
( const item_field_edit& edit, const std::string& name ) const;
74
}; // struct field_deleter
68
77
properties_frame( wxWindow* parent );
70
79
void set_window_layout( windows_layout& layout );
72
void set_item( item_instance* item );
82
void add_item( item_instance* item );
83
void remove_item( item_instance* item );
75
89
void update_controls();
76
90
void create_controls();
78
void delete_field( item_instance& item, const std::string& name );
79
92
void get_item_identifiers( wxArrayString& id, const type_field& f );
81
94
template<typename Type>
82
void do_set_field_value
83
( item_instance& item, const std::string& name, const Type& v );
85
DECLARE_PROXY_SET_FIELD_VALUE( integer_type );
86
DECLARE_PROXY_SET_FIELD_VALUE( u_integer_type );
87
DECLARE_PROXY_SET_FIELD_VALUE( real_type );
88
DECLARE_PROXY_SET_FIELD_VALUE( bool_type );
89
DECLARE_PROXY_SET_FIELD_VALUE( string_type );
90
DECLARE_PROXY_SET_FIELD_VALUE( sprite );
91
DECLARE_PROXY_SET_FIELD_VALUE( animation_file_type );
92
DECLARE_PROXY_SET_FIELD_VALUE( item_reference_type );
93
DECLARE_PROXY_SET_FIELD_VALUE( font_file_type );
94
DECLARE_PROXY_SET_FIELD_VALUE( sample_file_type );
95
void on_set_field_value( set_field_value_event<Type>& e );
96
97
void on_close(wxCloseEvent& event);
97
98
void on_item_focused(wxListEvent& event);
98
99
void on_change_fixed(wxCommandEvent& event);
99
100
void on_validate_id(wxCommandEvent& event);
100
101
void on_change_item_class(wxCommandEvent& event);
102
void on_item_class_click(wxHyperlinkEvent& event);
103
void on_delete_field( delete_item_field_event& e );
104
void on_request_item_id( request_item_id_event& e );
103
107
/** \brief The control in which we display the class of the item. */
104
wxStaticText* m_item_class;
108
wxHyperlinkCtrl* m_item_class;
106
110
/** \brief The list of properties available for this item. */
107
111
item_field_edit* m_prop;