~ubuntu-branches/ubuntu/trusty/plee-the-bear/trusty-proposed

« back to all changes in this revision

Viewing changes to bear-factory/level-editor/src/bf/properties_frame.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge, Julien Jorge
  • Date: 2010-11-17 20:13:34 UTC
  • mfrom: (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101117201334-o4dp7uq437to7oxb
Tags: 0.5.1-1
[ Julien Jorge ]
* New upstream release (Closes: #565062, #546514).
* Add armhf architecture (Closes: #604689).
* Remove patches integrated upstream: rpath-editors.diff, rpath-game.diff,
  editors-menu-section.diff.
* Bump the Standard-Version, no changes.
* Update my email address.
* Set build dependency of libclaw to 1.6.0.
* Add the missing ${misc:Depends} in debian/control.
* List gettext translations in bear-factory.install and plee-the-bear.install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    Bear Engine - Level editor
3
3
 
4
 
    Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
 
4
    Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
5
5
 
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__
31
31
 
32
 
#include "bf/item_field_edit.hpp"
33
 
#include "bf/windows_layout.hpp"
34
 
 
35
 
/**
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.
39
 
 */
40
 
#define DECLARE_PROXY_SET_FIELD_VALUE(type)                             \
41
 
  void set_field_value                                                  \
42
 
  ( item_instance& item, const std::string& name, const type& v );      \
43
 
                                                                        \
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>
 
35
#include <wx/panel.h>
 
36
#include <wx/stattext.h>
46
37
 
47
38
namespace bf
48
39
{
 
40
  class level_action;
 
41
  class item_field_edit;
 
42
  class item_instance;
 
43
  class type_field;
 
44
  class windows_layout;
 
45
  class delete_item_field_event;
 
46
  class request_item_id_event;
 
47
  template<typename T>
 
48
  class set_field_value_event;
 
49
 
49
50
  /**
50
51
   * \brief The properties window of our program.
51
52
   * \author Julien Jorge
52
53
   */
53
54
  class properties_frame:
54
 
    public wxPanel,
55
 
    public item_field_edit::proxy
 
55
    public wxPanel
56
56
  {
57
57
  public:
58
58
    /** \brief The identifiers of the controls. */
61
61
        IDC_ITEM_PROPERTIES,
62
62
        IDC_FIXED_STATE,
63
63
        IDC_TEXT_IDENTIFIER,
64
 
        IDC_CHANGE_ITEM_CLASS
 
64
        IDC_CHANGE_ITEM_CLASS,
 
65
        IDC_ITEM_CLASS_NAME
65
66
      }; // enum control_id
66
67
 
 
68
  private:
 
69
    template<typename T>
 
70
    struct field_deleter
 
71
    {
 
72
      level_action* operator()
 
73
        ( const item_field_edit& edit, const std::string& name ) const;
 
74
    }; // struct field_deleter
 
75
 
67
76
  public:
68
77
    properties_frame( wxWindow* parent );
69
78
 
70
79
    void set_window_layout( windows_layout& layout );
71
80
 
72
 
    void set_item( item_instance* item );
 
81
    void clear();
 
82
    void add_item( item_instance* item );
 
83
    void remove_item( item_instance* item );
 
84
 
 
85
    void refresh();
73
86
 
74
87
  private:
 
88
    void fill_controls();
75
89
    void update_controls();
76
90
    void create_controls();
77
91
 
78
 
    void delete_field( item_instance& item, const std::string& name );
79
92
    void get_item_identifiers( wxArrayString& id, const type_field& f );
80
93
 
81
94
    template<typename Type>
82
 
    void do_set_field_value
83
 
    ( item_instance& item, const std::string& name, const Type& v );
84
 
 
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 );
95
96
 
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 );
101
105
 
102
106
  private:
103
107
    /** \brief The control in which we display the class of the item. */
104
 
    wxStaticText* m_item_class;
 
108
    wxHyperlinkCtrl* m_item_class;
105
109
 
106
110
    /** \brief The list of properties available for this item. */
107
111
    item_field_edit* m_prop;
124
128
  }; // class properties_frame
125
129
} // namespace bf
126
130
 
127
 
#include "bf/impl/properties_frame.tpp"
128
 
 
129
131
#endif // __BF_PROPERTIES_FRAME_HPP__