Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / object_viewer / value_gradient_dlg.h
blobe6af41e8fb5891b7fd7bee1f81c80f15c1ad18aa
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #if !defined(AFX_VALUE_GRADIENT_DLG_H__45A21D97_D65B_494E_B171_D53F71F4AFC7__INCLUDED_)
20 #define AFX_VALUE_GRADIENT_DLG_H__45A21D97_D65B_494E_B171_D53F71F4AFC7__INCLUDED_
22 #if _MSC_VER > 1000
23 #pragma once
24 #endif // _MSC_VER > 1000
25 // value_gradient_dlg.h : header file
28 /////////////////////////////////////////////////////////////////////////////
29 // CValueGradientDlg dialog
31 struct IPopupNotify;
33 #include "ps_wrapper.h"
34 #include "attrib_list_box.h"
35 #include "editable_range.h"
36 #include "particle_workspace.h"
38 class CEditAttribDlg;
41 /** This struct serves as an interface to manage the gradient.
42 * Deriver should provide the following methods.
45 struct IValueGradientDlgClient
47 /** must provide a dialog for the edition of one value
48 * ONLY ONE DIALOG WILL BE QUERRIED AT A TIME. the previous dialog is detroyed before this is called again
49 * \param index the index of the value in the dialog
50 * \grad the dlg that called this method (deriver can ask a redraw then)
52 virtual CEditAttribDlg *createDialog(uint index, CValueGradientDlg *grad, CParticleWorkspace::CNode *ownerNode) = 0;
54 /// this enumerate the action that we can apply on a gradient
55 enum TAction { Add, Insert, Delete, Up, Down };
57 /// a function that can add, remove, or insert a new element in the gradient
58 virtual void modifyGradient(TAction, uint index) = 0;
60 /// a function that can display a value in a gradient, with the given offset
61 virtual void displayValue(CDC *dc, uint index, sint x, sint y) = 0;
63 // return the number of values in a scheme
64 virtual uint32 getSchemeSize(void) const = 0;
66 // get the number of interpolation step
67 virtual uint32 getNbSteps(void) const = 0;
69 // set the number of interpolation steps
70 virtual void setNbSteps(uint32 value) = 0;
72 /// dtor
73 ~IValueGradientDlgClient() {}
77 class CValueGradientDlg : public CDialog
80 public:
83 /** construct the dialog. The user must provides an interface of type IValueGradientDlgClient
84 * and a pointer to the parent window
85 * \param destroyClientInterface When set to true, dlete will be called on the client interface when this obj dtor is called.
86 * \param canTuneNbStage The gradient is sampled, and the number of intermediate values can be tuned.
87 * When this is set to false, this is disabled.
88 * \param minSize The minimum number of elements that the gradient must have.
91 CValueGradientDlg(IValueGradientDlgClient *clientInterface,
92 CParticleWorkspace::CNode *ownerNode,
93 bool destroyClientInterface,
94 CWnd* pParent,
95 IPopupNotify *pn,
96 bool canTuneNbStages = true,
97 uint minSize = 2
100 /// invalidate the gradient list box
101 void invalidateGrad(void);
103 // non modal display
104 void init(CWnd *pParent);
106 /// dtor
107 ~CValueGradientDlg();
109 // Dialog Data
110 //{{AFX_DATA(CValueGradientDlg)
111 enum { IDD = IDD_GRADIENT_DLG };
112 CStatic m_NoSamples;
113 CAttribListBox m_GradientList;
114 CStatic m_Value;
115 CButton m_RemoveCtrl;
116 //}}AFX_DATA
119 // Overrides
120 // ClassWizard generated virtual function overrides
121 //{{AFX_VIRTUAL(CValueGradientDlg)
122 protected:
123 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
124 //}}AFX_VIRTUAL
126 // Implementation
127 protected:
128 // the minimum number of element in the gradient
129 uint _MinSize;
130 // false to disable the dialog that control the number of stages between each value
131 bool _CanTuneNbStages;
132 IValueGradientDlgClient *_ClientInterface;
133 bool _DestroyClientInterface;
134 // the dialog for edition of the current value
135 CEditAttribDlg *_EditValueDlg;
136 // the dialog to edit the current number of step for gradient interpolation
137 CEditableRangeUInt *_NbStepDlg;
138 // the current size of the gradient
139 uint _Size;
140 // interface to tells the parent that we have been closed
141 IPopupNotify *_PN;
142 // Owner node
143 CParticleWorkspace::CNode *_Node;
145 // Generated message map functions
146 //{{AFX_MSG(CValueGradientDlg)
147 afx_msg void OnAddValue();
148 afx_msg void OnInsertValue();
149 afx_msg void OnRemoveValue();
150 afx_msg void OnValueDown();
151 afx_msg void OnValueUp();
152 virtual BOOL OnInitDialog();
153 afx_msg void OnSelchangeGradientList();
154 afx_msg void OnClose();
155 //}}AFX_MSG
156 DECLARE_MESSAGE_MAP()
158 // a wrapper to tune the number of step
159 struct CNbStepWrapper :public IPSWrapperUInt
161 // the interface that was passed to the dialog this struct is part of
162 IValueGradientDlgClient *I;
163 uint32 get(void) const { return I->getNbSteps(); }
164 void set(const uint32 &nbSteps) { I->setNbSteps(nbSteps); }
166 } _NbStepWrapper;
169 //{{AFX_INSERT_LOCATION}}
170 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
172 #endif // !defined(AFX_VALUE_GRADIENT_DLG_H__45A21D97_D65B_494E_B171_D53F71F4AFC7__INCLUDED_)