nux-0.9.46
|
00001 /* 00002 * Copyright 2010 Inalogic® Inc. 00003 * 00004 * This program is free software: you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License, as 00006 * published by the Free Software Foundation; either version 2.1 or 3.0 00007 * of the License. 00008 * 00009 * This program is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranties of 00011 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 00012 * PURPOSE. See the applicable version of the GNU Lesser General Public 00013 * License for more details. 00014 * 00015 * You should have received a copy of both the GNU Lesser General Public 00016 * License along with this program. If not, see <http://www.gnu.org/licenses/> 00017 * 00018 * Authored by: Jay Taoko <jaytaoko@inalogic.com> 00019 * 00020 */ 00021 00022 00023 #ifndef MATRIX3EDITOR_H 00024 #define MATRIX3EDITOR_H 00025 00026 #include "EditTextBox.h" 00027 #include "StaticTextBox.h" 00028 #include "Layout.h" 00029 #include "HLayout.h" 00030 #include "VLayout.h" 00031 #include "PushButton.h" 00032 #include "TimerProc.h" 00033 00034 namespace nux 00035 { 00036 00037 class Matrix3Editor; 00038 class Matrix3Preview; 00039 00041 class Matrix3DialogProxy 00042 { 00043 public: 00044 Matrix3DialogProxy (bool ModalWindow); 00045 ~Matrix3DialogProxy(); 00046 00047 void RecvDialogOk (Matrix3Editor *matrixeditor); 00048 void RecvDialogCancel (Matrix3Editor *matrixeditor); 00049 void RecvDialogChange (Matrix3Editor *matrixeditor); 00050 00051 void Start(); 00052 bool IsActive(); 00053 void StopThreadMonitoring(); 00054 00055 Matrix3 GetMatrix() 00056 { 00057 return m_Matrix; 00058 } 00059 void SetMatrix (Matrix3 matrix) 00060 { 00061 m_Matrix = matrix; 00062 } 00063 00064 private: 00065 bool m_bDialogChange; 00066 bool m_bDialogRunning; 00067 00068 Matrix3 m_PreviousMatrix; 00069 Matrix3 m_Matrix; 00070 00071 bool m_ModalWindow; 00072 unsigned int m_DialogThreadID; 00073 NThread *m_Thread; 00074 00075 friend class Matrix3Preview; 00076 }; 00077 00078 00079 00081 00086 class Matrix3Editor : public View 00087 { 00088 public: 00089 Matrix3Editor (Matrix3 matrix = Matrix3::IDENTITY(), NUX_FILE_LINE_PROTO); 00090 ~Matrix3Editor(); 00091 virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); 00092 virtual void Draw (GraphicsEngine &GfxContext, bool force_draw); 00093 virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw); 00094 virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw); 00095 00096 void SetParameterName (const char *parameter_name); 00097 00098 void EmitButtonPress() {}; 00099 00101 // EMITTERS // 00103 void EmitIncrementComponent (int index); 00104 void EmitDecrementComponent (int index); 00105 void EmitComponentValue (float f, int index); 00106 00108 // RECEIVERS // 00110 00112 00118 void SetMatrix (Matrix3 matrix); 00119 00121 00127 Matrix3 GetMatrix() const; 00128 00129 00130 00132 // SIGNALS // 00134 //sigc::signal<void> sigClick; 00135 // sigc::signal<void, int> sigIncrementComponent; 00136 // sigc::signal<void, int> sigDecrementComponent; 00137 sigc::signal<void, int, char *> sigValidateKeyboarEntry; 00138 00139 sigc::signal<void, Matrix3Editor * > sigMatrixChanged; 00140 00141 private: 00142 00143 00144 void RecvIdentityMatrixCmd(); 00145 void RecvZeroMatrixCmd(); 00146 void RecvInverseMatrixCmd(); 00147 void RecvNegateMatrixCmd(); 00148 00149 void WriteMatrix(); 00150 00151 void RecvComponentInput (EditTextBox *textbox, const NString &text, int componentIndex); 00152 00153 private: 00154 VLayout *m_vlayout; 00155 VLayout *mtx_layout; 00156 HLayout *mtx_row_layout[3]; 00157 00158 EditTextBox *m_MtxInput[3][3]; 00159 00160 PushButton *m_IdentityMtxBtn; 00161 PushButton *m_ZeroMtxBtn; 00162 PushButton *m_InverseMtxBtn; 00163 PushButton *m_NegateMtxBtn; 00164 HLayout *m_MtxFunctionLayout; 00165 00166 Matrix3x3<float> m_Matrix; 00167 }; 00168 00169 } 00170 00171 #endif // MATRIX3EDITOR_H