nux-1.16.0
|
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 MATRIX4EDITOR_H 00024 #define MATRIX4EDITOR_H 00025 00026 #include "EditTextBox.h" 00027 #include "StaticTextBox.h" 00028 #include "Layout.h" 00029 #include "HLayout.h" 00030 #include "VLayout.h" 00031 #include "ToggleButton.h" 00032 #include "TimerProc.h" 00033 00034 namespace nux 00035 { 00036 00037 class Matrix4Editor; 00038 class Matrix4Preview; 00039 00041 class Matrix4DialogProxy 00042 { 00043 public: 00044 Matrix4DialogProxy (bool ModalWindow); 00045 ~Matrix4DialogProxy(); 00046 00047 void RecvDialogOk (Matrix4Editor *matrixeditor); 00048 void RecvDialogCancel (Matrix4Editor *matrixeditor); 00049 void RecvDialogChange (Matrix4Editor *matrixeditor); 00050 00051 void Start(); 00052 bool IsActive(); 00053 void StopThreadMonitoring(); 00054 00055 Matrix4 GetMatrix() 00056 { 00057 return m_Matrix; 00058 } 00059 void SetMatrix (Matrix4 matrix) 00060 { 00061 m_Matrix = matrix; 00062 } 00063 00064 private: 00065 bool m_bDialogChange; 00066 bool m_bDialogRunning; 00067 00068 Matrix4 m_PreviousMatrix; 00069 Matrix4 m_Matrix; 00070 00071 bool m_ModalWindow; 00072 unsigned int m_DialogThreadID; 00073 NThread *m_Thread; 00074 00075 friend class Matrix4Preview; 00076 }; 00077 00078 00080 00085 class Matrix4Editor : public View 00086 { 00087 public: 00088 Matrix4Editor (Matrix4 matrix = Matrix4::IDENTITY(), NUX_FILE_LINE_PROTO); 00089 ~Matrix4Editor(); 00090 Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type); 00091 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 00099 void EmitButtonPress() {}; 00100 00102 // EMITTERS // 00104 void EmitIncrementComponent (int index); 00105 void EmitDecrementComponent (int index); 00106 void EmitComponentValue (float f, int index); 00107 00109 // RECEIVERS // 00111 00113 00119 void SetMatrix (Matrix4 matrix); 00120 00122 00128 Matrix4 GetMatrix() const; 00129 00130 00131 00133 // SIGNALS // 00135 //sigc::signal<void> sigClick; 00136 // sigc::signal<void, int> sigIncrementComponent; 00137 // sigc::signal<void, int> sigDecrementComponent; 00138 sigc::signal<void, int, char *> sigValidateKeyboarEntry; 00139 00140 sigc::signal<void, Matrix4Editor * > sigMatrixChanged; 00141 00142 private: 00143 void RecvIdentityMatrixCmd(); 00144 void RecvZeroMatrixCmd(); 00145 void RecvInverseMatrixCmd(); 00146 void RecvNegateMatrixCmd(); 00147 00148 void WriteMatrix(); 00149 00150 void RecvComponentInput (EditTextBox *textbox, const NString &text, int componentIndex); 00151 00152 private: 00153 00154 VLayout *m_vlayout; 00155 VLayout *mtx_layout; 00156 HLayout *mtx_row_layout[4]; 00157 00158 00159 EditTextBox *m_MtxInput[4][4]; 00160 00161 ToggleButton *m_IdentityMtxBtn; 00162 ToggleButton *m_ZeroMtxBtn; 00163 ToggleButton *m_InverseMtxBtn; 00164 ToggleButton *m_NegateMtxBtn; 00165 HLayout *m_MtxFunctionLayout; 00166 00167 00168 // VLayout vlayout; 00169 // VLayout mtx_layout; 00170 // HLayout mtx_row_layout[4]; 00171 // 00172 // //StaticTextBox m_ParameterName; 00173 // 00174 // EditTextBox m_MtxInput[4][4]; 00175 // 00176 // PushButton m_IdentityMtxBtn; 00177 // PushButton m_ZeroMtxBtn; 00178 // PushButton m_InverseMtxBtn; 00179 // PushButton m_NegateMtxBtn; 00180 // HLayout m_MtxFunctionLayout; 00181 00182 Matrix4 m_Matrix; 00183 }; 00184 00185 } 00186 00187 #endif // MATRIX4EDITOR_H