Planeshift
eeditpartlisttoolbox.h
Go to the documentation of this file.
1 /*
2  * Author: Jorrit Tyberghein
3  *
4  * Copyright (C) 2010 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef EEDIT_PARTICLES_TOOLBOX_HEADER
21 #define EEDIT_PARTICLES_TOOLBOX_HEADER
22 
23 #include "eedittoolbox.h"
24 #include "paws/pawswidget.h"
25 #include "paws/pawsspinbox.h"
26 #include "paws/pawscombo.h"
27 #include "paws/pawscheckbox.h"
28 #include "paws/pawscrollbar.h"
29 
30 #include <csutil/weakref.h>
31 #include <imesh/particles.h>
32 
33 class pawsButton;
34 class pawsListBox;
35 struct iEngine;
36 struct iParticleEmitter;
37 struct iParticleEffector;
38 struct iMeshObjectFactory;
39 struct ParticleParameterRow;
40 
46 {
47  csString type;
48  csString text;
49  csStringArray choices;
51  ParameterData (csString type, float spinbox_min = 0, float spinbox_max = 1, float spinbox_step = .1) :
52  type (type), spinbox_min (spinbox_min), spinbox_max (spinbox_max), spinbox_step (spinbox_step)
53  { }
54 };
55 
56 
59 class EEditParticleListToolbox : public EEditToolbox, public pawsWidget, public scfImplementation0<EEditParticleListToolbox>
60 {
61 public:
65  virtual ~EEditParticleListToolbox();
66 
69  void FillList(iEngine* engine);
70  void RefreshEditList();
71  void FillParmList(iMeshObjectFactory* fact);
72  void FillParmList(iParticleEmitter* emit);
73  void FillParmList(iParticleEffector* eff);
74  void RefreshParmList();
75 
76  void CreateNewEmit (const char* string);
77  void CreateNewEffect (const char* string);
78 
79  // inheritted from EEditToolbox
80  virtual void Update(unsigned int elapsed);
81  virtual size_t GetType() const;
82  virtual const char * GetName() const;
83 
84  // inheritted from pawsWidget
85  virtual bool PostSetup();
86  virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
87  virtual bool OnButtonReleased( int button, int keyModifier, pawsWidget* widget);
88  virtual void OnListAction(pawsListBox* selected, int status);
89  virtual bool OnChange(pawsWidget* widget);
90  virtual bool OnScroll(int dir, pawsScrollBar* widget);
91 
92 private:
93  // used by pawsListBox to sort the listbox
94  static int SortTextBox(pawsWidget * widgetA, pawsWidget * widgetB);
95 
96  void HideValues ();
97  void ClearParmList ();
98  void UpdateParticleValue();
99  void SaveParticleSystem (const csString& name);
100  void ReloadParticleSystem (const csString& name);
101 
102  csArray<iParticleEmitter*> emitters;
103  csArray<iParticleEffector*> effectors;
104  csRef<iEngine> engine;
105 
106  int updatingParticleValue;
107  csWeakRef<iParticleSystemFactory> pfact;
108  csWeakRef<iMeshObjectFactory> objectFactory;
109 
110 public:
111  csPDelArray<ParticleParameterRow> parameterRows;
112 
139 };
140 
142 
145 #endif
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
A combination widget that has up and down arrows and a text label.
Definition: pawsspinbox.h:56
ParameterData(csString type, float spinbox_min=0, float spinbox_max=1, float spinbox_step=.1)
A combination widget that has a check box and a text label.
Definition: pawscheckbox.h:48
csPDelArray< ParticleParameterRow > parameterRows
const char * GetName(int id)
csStringArray choices
This allows you to open/edit particle systems.
A simple list box widget.
Definition: pawslistbox.h:202
A simple scroll bar widget.
Definition: pawscrollbar.h:64
CREATE_PAWS_FACTORY(EEditParticleListToolbox)
A base class for all eedit toolbox windows.
Definition: eedittoolbox.h:26
A simple button widget.
Definition: pawsbutton.h:43
A basic combo box widget.
Definition: pawscombo.h:53