Status: | Needs review |
---|---|
Proposed branch: | lp:~haggai-eran/nux/rtl |
Merge into: | lp:nux |
Diff against target: |
138259 lines (+28058/-67159) 532 files modified
Nux/AbstractButton.cpp (+87/-51) Nux/AbstractButton.h (+102/-31) Nux/AbstractCheckedButton.cpp (+217/-0) Nux/AbstractCheckedButton.h (+110/-0) Nux/AbstractComboBox.cpp (+57/-57) Nux/AbstractComboBox.h (+9/-10) Nux/AbstractPaintLayer.cpp (+28/-28) Nux/AbstractPaintLayer.h (+11/-11) Nux/AbstractRadioButton.cpp (+0/-41) Nux/AbstractRadioButton.h (+0/-48) Nux/AbstractSeparator.cpp (+0/-70) Nux/AbstractSeparator.h (+0/-48) Nux/AbstractThread.cpp (+5/-5) Nux/AbstractThread.h (+11/-11) Nux/ActionItem.cpp (+42/-42) Nux/AnimatedTextureArea.cpp (+39/-44) Nux/AnimatedTextureArea.h (+8/-9) Nux/Area.cpp (+469/-442) Nux/Area.h (+224/-180) Nux/BaseWindow.cpp (+111/-181) Nux/BaseWindow.h (+41/-46) Nux/BezierCurveControl.cpp (+0/-343) Nux/BezierCurveControl.h (+0/-105) Nux/BezierCurveControl2.cpp (+0/-1046) Nux/BezierCurveControl2.h (+0/-145) Nux/Button.cpp (+421/-161) Nux/Button.h (+215/-22) Nux/Canvas.cpp (+17/-26) Nux/Canvas.h (+3/-6) Nux/CheckBox.cpp (+69/-86) Nux/CheckBox.h (+55/-19) Nux/ClientArea.cpp (+117/-134) Nux/ClientArea.h (+15/-16) Nux/ColorArea.cpp (+0/-68) Nux/ColorArea.h (+0/-46) Nux/ColorEditor.cpp (+609/-639) Nux/ColorEditor.h (+84/-55) Nux/ColorGradient.cpp (+0/-386) Nux/ColorGradient.h (+0/-417) Nux/ColorPickerDialog.cpp (+12/-12) Nux/ColorPickerDialog.h (+1/-1) Nux/ColorPreview.cpp (+47/-55) Nux/ColorPreview.h (+5/-6) Nux/ColorRangeValuator.cpp (+0/-77) Nux/ColorRangeValuator.h (+0/-56) Nux/ComboBoxComplex.cpp (+0/-337) Nux/ComboBoxComplex.h (+0/-95) Nux/ComboBoxSimple.cpp (+68/-185) Nux/ComboBoxSimple.h (+19/-23) Nux/CurveControl.cpp (+0/-172) Nux/CurveControl.h (+0/-57) Nux/D2DTextRenderer.cpp (+436/-0) Nux/D2DTextRenderer.h (+100/-0) Nux/Dialog.cpp (+23/-23) Nux/DoubleValidator.cpp (+21/-21) Nux/DoubleValidator.h (+14/-14) Nux/EditTextBox.cpp (+165/-172) Nux/EditTextBox.h (+59/-60) Nux/FileSelector.cpp (+59/-68) Nux/FileSelector.h (+7/-9) Nux/FloatingWindow.cpp (+110/-185) Nux/FloatingWindow.h (+18/-19) Nux/Focusable.cpp (+0/-117) Nux/Focusable.h (+0/-67) Nux/FolderTreeItem.cpp (+0/-109) Nux/FolderTreeItem.h (+0/-94) Nux/FunctionGraph.cpp (+0/-201) Nux/FunctionGraph.h (+0/-67) Nux/GridHLayout.cpp (+405/-208) Nux/GridHLayout.h (+33/-25) Nux/GridVLayout.cpp (+70/-80) Nux/GridVLayout.h (+18/-18) Nux/GroupBox.cpp (+63/-86) Nux/GroupBox.h (+8/-9) Nux/GroupBox2.cpp (+73/-87) Nux/GroupBox2.h (+8/-9) Nux/HLayout.cpp (+268/-225) Nux/HLayout.h (+6/-8) Nux/HScrollBar.cpp (+152/-164) Nux/HScrollBar.h (+33/-37) Nux/HSeparator.cpp (+0/-95) Nux/HSeparator.h (+0/-50) Nux/HSplitter.cpp (+168/-168) Nux/HSplitter.h (+19/-19) Nux/HToolBar.cpp (+0/-204) Nux/HToolBar.h (+0/-68) Nux/HexRegExpValidator.cpp (+26/-26) Nux/HexRegExpValidator.h (+10/-10) Nux/Histogram.cpp (+0/-201) Nux/Histogram.h (+0/-59) Nux/HueRangeValuator.cpp (+0/-130) Nux/HueRangeValuator.h (+0/-92) Nux/InputArea.cpp (+78/-100) Nux/InputArea.h (+71/-95) Nux/IntegerValidator.cpp (+26/-26) Nux/IntegerValidator.h (+10/-10) Nux/KeyboardHandler.cpp (+189/-183) Nux/KeyboardHandler.h (+36/-36) Nux/LayeredLayout.cpp (+242/-278) Nux/LayeredLayout.h (+70/-43) Nux/Layout.cpp (+221/-615) Nux/Layout.h (+114/-125) Nux/LinearLayout.cpp (+214/-0) Nux/LinearLayout.h (+86/-0) Nux/ListControl.cpp (+0/-47) Nux/ListControl.h (+0/-75) Nux/Makefile.am (+9/-125) Nux/Matrix3Editor.cpp (+0/-387) Nux/Matrix3Editor.h (+0/-170) Nux/Matrix3Preview.cpp (+0/-132) Nux/Matrix3Preview.h (+0/-66) Nux/Matrix4Editor.cpp (+0/-391) Nux/Matrix4Editor.h (+0/-187) Nux/Matrix4Preview.cpp (+0/-130) Nux/Matrix4Preview.h (+0/-65) Nux/MenuBar.cpp (+135/-183) Nux/MenuBar.h (+16/-17) Nux/MenuPage.cpp (+274/-352) Nux/MenuPage.h (+58/-61) Nux/MouseAreaCtrl.cpp (+30/-40) Nux/MouseAreaCtrl.h (+10/-11) Nux/MouseHandler.cpp (+18/-18) Nux/MouseHandler.h (+4/-4) Nux/NodeItem.cpp (+0/-518) Nux/NodeItem.h (+0/-133) Nux/NodeNetProtocol.cpp (+0/-587) Nux/NodeNetProtocol.h (+0/-200) Nux/NumericValuator.cpp (+54/-64) Nux/NumericValuator.h (+5/-6) Nux/Nux.cpp (+147/-129) Nux/Nux.h (+39/-30) Nux/NuxGlobalInitializer.cpp (+4/-4) Nux/NuxGlobalInitializer.h (+1/-1) Nux/PaintLayer.cpp (+47/-42) Nux/PaintLayer.h (+13/-12) Nux/Painter.cpp (+324/-282) Nux/Painter.h (+127/-77) Nux/Panel.cpp (+77/-139) Nux/Panel.h (+13/-16) Nux/PangoText.cpp (+104/-114) Nux/PangoText.h (+26/-27) Nux/PopUpWindow.cpp (+9/-9) Nux/PropertyItem/CheckBoxProperty.cpp (+0/-138) Nux/PropertyItem/CheckBoxProperty.h (+0/-51) Nux/PropertyItem/ColorGradientPropertyItem.cpp (+0/-122) Nux/PropertyItem/ColorGradientPropertyItem.h (+0/-51) Nux/PropertyItem/ColorPreviewPropertyItem.cpp (+0/-164) Nux/PropertyItem/ColorPreviewPropertyItem.h (+0/-60) Nux/PropertyItem/ComboBoxListPropertyItem.cpp (+0/-102) Nux/PropertyItem/ComboBoxListPropertyItem.h (+0/-48) Nux/PropertyItem/ComboBoxPropertyItem.cpp (+0/-188) Nux/PropertyItem/ComboBoxPropertyItem.h (+0/-51) Nux/PropertyItem/DoubleValuatorPropertyItem.cpp (+0/-164) Nux/PropertyItem/DoubleValuatorPropertyItem.h (+0/-50) Nux/PropertyItem/EditTextLinePropertyItem.cpp (+0/-127) Nux/PropertyItem/EditTextLinePropertyItem.h (+0/-50) Nux/PropertyItem/FilePropertyItem.cpp (+0/-105) Nux/PropertyItem/FilePropertyItem.h (+0/-48) Nux/PropertyItem/IntegerValuatorPropertyItem.cpp (+0/-162) Nux/PropertyItem/IntegerValuatorPropertyItem.h (+0/-49) Nux/PropertyItem/Matrix3PreviewPropertyItem.cpp (+0/-186) Nux/PropertyItem/Matrix3PreviewPropertyItem.h (+0/-48) Nux/PropertyItem/Matrix4PreviewPropertyItem.cpp (+0/-187) Nux/PropertyItem/Matrix4PreviewPropertyItem.h (+0/-48) Nux/PropertyItem/RGBAProperty.cpp (+0/-499) Nux/PropertyItem/RGBAProperty.h (+0/-126) Nux/PropertyItem/RGBProperty.cpp (+0/-465) Nux/PropertyItem/RGBProperty.h (+0/-119) Nux/PropertyItem/RangeValueIntegerPropertyItem.cpp (+0/-167) Nux/PropertyItem/RangeValueIntegerPropertyItem.h (+0/-52) Nux/PropertyItem/RangeValuePropertyItem.cpp (+0/-167) Nux/PropertyItem/RangeValuePropertyItem.h (+0/-51) Nux/PropertyItem/SpinBoxDoublePropertyItem.cpp (+0/-141) Nux/PropertyItem/SpinBoxDoublePropertyItem.h (+0/-50) Nux/PropertyItem/SpinBoxPropertyItem.cpp (+0/-141) Nux/PropertyItem/SpinBoxPropertyItem.h (+0/-51) Nux/PropertyItem/SplineCurvePropertyItem.cpp (+0/-170) Nux/PropertyItem/SplineCurvePropertyItem.h (+0/-48) Nux/PropertyItem/Vector3Property.cpp (+0/-210) Nux/PropertyItem/Vector3Property.h (+0/-86) Nux/PropertyItem/Vector3ValuatorPropertyItem.cpp (+0/-149) Nux/PropertyItem/Vector3ValuatorPropertyItem.h (+0/-51) Nux/PropertyItem/Vector4Property.cpp (+0/-240) Nux/PropertyItem/Vector4Property.h (+0/-99) Nux/PropertyList.cpp (+0/-98) Nux/PropertyList.h (+0/-246) Nux/RGBValuator.cpp (+595/-610) Nux/RGBValuator.h (+48/-36) Nux/RadioButton.cpp (+114/-258) Nux/RadioButton.h (+64/-60) Nux/RadioButtonGroup.cpp (+50/-38) Nux/RadioButtonGroup.h (+7/-7) Nux/RangeValue.cpp (+103/-120) Nux/RangeValue.h (+17/-18) Nux/RangeValueInteger.cpp (+82/-99) Nux/RangeValueInteger.h (+19/-20) Nux/ScrollBar.cpp (+4/-4) Nux/ScrollBar.h (+7/-7) Nux/ScrollView.cpp (+259/-314) Nux/ScrollView.h (+35/-33) Nux/SpinBox.cpp (+105/-115) Nux/SpinBox.h (+8/-9) Nux/SpinBoxDouble.cpp (+115/-125) Nux/SpinBoxDouble.h (+8/-9) Nux/SpinBox_Logic.cpp (+87/-87) Nux/SpinBox_Logic.h (+19/-20) Nux/SplineCurveDialog.cpp (+0/-101) Nux/SplineCurveDialog.h (+0/-73) Nux/SplineCurveEditor.cpp (+0/-606) Nux/SplineCurveEditor.h (+0/-384) Nux/SplineCurvePreview.cpp (+0/-450) Nux/SplineCurvePreview.h (+0/-121) Nux/StaticText.cpp (+757/-270) Nux/StaticText.h (+102/-38) Nux/StaticTextBox.cpp (+55/-63) Nux/StaticTextBox.h (+22/-23) Nux/SystemThread.cpp (+53/-53) Nux/SystemThread.h (+10/-10) Nux/TabView.cpp (+221/-247) Nux/TabView.h (+23/-24) Nux/TableCtrl.cpp (+0/-2373) Nux/TableCtrl.h (+0/-553) Nux/TableItem.cpp (+0/-281) Nux/TableItem.h (+0/-227) Nux/TextEntry.cpp (+105/-204) Nux/TextEntry.h (+26/-28) Nux/TextView/Sequence.cpp (+0/-1134) Nux/TextView/Sequence.h (+0/-450) Nux/TextView/TextDocument.cpp (+0/-1047) Nux/TextView/TextDocument.h (+0/-243) Nux/TextView/TextView.cpp (+0/-931) Nux/TextView/TextView.h (+0/-162) Nux/TextView/TextViewFile.cpp (+0/-70) Nux/TextView/TextViewFont.cpp (+0/-259) Nux/TextView/TextViewInternal.h (+0/-384) Nux/TextView/TextViewKeyNav.cpp (+0/-76) Nux/TextView/TextViewMouse.cpp (+0/-823) Nux/TextView/TextViewPaint.cpp (+0/-822) Nux/TextView/TextViewScroll.cpp (+0/-401) Nux/TextView/TextViewSyntax.cpp (+0/-202) Nux/TextView/TextViewUsp.cpp (+0/-155) Nux/TextView/TextViewWidget.cpp (+0/-808) Nux/TextView/TextViewWidget.h (+0/-227) Nux/TextView/Unicode.c (+0/-571) Nux/TextView/Unicode.cpp (+0/-584) Nux/TextView/Unicode.h (+0/-83) Nux/TextView/codepages.h (+0/-26) Nux/TextView/racursor.h (+0/-58) Nux/TextViewGCC/Sequence.cpp (+0/-1130) Nux/TextViewGCC/Sequence.h (+0/-447) Nux/TextViewGCC/TextDocument.cpp (+0/-1055) Nux/TextViewGCC/TextDocument.h (+0/-245) Nux/TextViewGCC/TextView.cpp (+0/-872) Nux/TextViewGCC/TextView.h (+0/-169) Nux/TextViewGCC/TextViewFile.cpp (+0/-65) Nux/TextViewGCC/TextViewInternal.h (+0/-378) Nux/TextViewGCC/TextViewKeyNav.cpp (+0/-70) Nux/TextViewGCC/TextViewMouse.cpp (+0/-826) Nux/TextViewGCC/TextViewPaint.cpp (+0/-819) Nux/TextViewGCC/TextViewScroll.cpp (+0/-396) Nux/TextViewGCC/TextViewSyntax.cpp (+0/-198) Nux/TextViewGCC/TextViewUsp.cpp (+0/-151) Nux/TextViewGCC/TextViewWidget.cpp (+0/-806) Nux/TextViewGCC/TextViewWidget.h (+0/-221) Nux/TextViewGCC/Unicode.c (+0/-571) Nux/TextViewGCC/Unicode.cpp (+0/-580) Nux/TextViewGCC/Unicode.h (+0/-88) Nux/TextViewGCC/codepages.h (+0/-26) Nux/TextViewGCC/racursor.h (+0/-53) Nux/TextureArea.cpp (+125/-87) Nux/TextureArea.h (+42/-16) Nux/Theme.cpp (+130/-130) Nux/Theme.h (+5/-5) Nux/TimeGraph.cpp (+0/-483) Nux/TimeGraph.h (+0/-118) Nux/Timeline.cpp (+47/-44) Nux/Timeline.h (+11/-11) Nux/TimelineEasings.cpp (+24/-24) Nux/TimelineEasings.h (+12/-12) Nux/TimerProc.cpp (+93/-93) Nux/TimerProc.h (+5/-5) Nux/ToggleButton.cpp (+22/-22) Nux/ToggleButton.h (+9/-6) Nux/ToolButton.cpp (+76/-84) Nux/ToolButton.h (+11/-11) Nux/TreeControl.cpp (+0/-274) Nux/TreeControl.h (+0/-60) Nux/Utils.cpp (+1/-1) Nux/Utils.h (+2/-2) Nux/VLayout.cpp (+185/-191) Nux/VLayout.h (+9/-11) Nux/VScrollBar.cpp (+156/-167) Nux/VScrollBar.h (+31/-36) Nux/VSeparator.cpp (+0/-96) Nux/VSeparator.h (+0/-49) Nux/VSplitter.cpp (+200/-200) Nux/VSplitter.h (+19/-19) Nux/VToolBar.cpp (+0/-189) Nux/VToolBar.h (+0/-71) Nux/Validator.cpp (+23/-8) Nux/Validator.h (+10/-5) Nux/Valuator.cpp (+0/-199) Nux/Valuator.h (+0/-85) Nux/ValuatorDouble.cpp (+0/-249) Nux/ValuatorDouble.h (+0/-73) Nux/ValuatorInt.cpp (+0/-246) Nux/ValuatorInt.h (+0/-73) Nux/Vector3Valuator.cpp (+0/-202) Nux/Vector3Valuator.h (+0/-95) Nux/Vector3ValuatorDouble.cpp (+0/-465) Nux/Vector3ValuatorDouble.h (+0/-91) Nux/View.cpp (+213/-430) Nux/View.h (+63/-121) Nux/WindowCompositor.cpp (+303/-342) Nux/WindowCompositor.h (+26/-27) Nux/WindowThread.cpp (+463/-490) Nux/WindowThread.h (+122/-97) Nux/nux.pc.in (+1/-1) NuxCore/CPU.cpp (+1/-1) NuxCore/CPU.h (+7/-7) NuxCore/CRC32.cpp (+9/-9) NuxCore/CRC32.h (+5/-5) NuxCore/Character/NAscii.cpp (+1/-1) NuxCore/Character/NUTF.cpp (+1/-1) NuxCore/Character/NUTF.h (+1/-1) NuxCore/Character/NUnicodeGNU.h (+2/-2) NuxCore/Color.cpp (+20/-20) NuxCore/FileIO.cpp (+9/-9) NuxCore/FileManager/NFileManagerGNU.cpp (+31/-31) NuxCore/FileManager/NFileManagerGNU.h (+23/-23) NuxCore/FileManager/NFileManagerGeneric.cpp (+9/-9) NuxCore/FileManager/NFileManagerGeneric.h (+2/-2) NuxCore/FileManager/NFileManagerStandardAnsi.cpp (+20/-20) NuxCore/FileManager/NFileManagerStandardAnsi.h (+27/-26) NuxCore/FileManager/NFileManagerWindows.cpp (+25/-25) NuxCore/FileManager/NFileManagerWindows.h (+19/-19) NuxCore/FileManager/NSerializer.cpp (+102/-102) NuxCore/FileManager/NSerializer.h (+80/-80) NuxCore/FileName.cpp (+17/-17) NuxCore/FilePath.cpp (+4/-4) NuxCore/Logger.cpp (+9/-2) NuxCore/Logger.h (+9/-6) NuxCore/Math/Bezier.cpp (+7/-7) NuxCore/Math/Bezier.h (+3/-3) NuxCore/Math/Complex.cpp (+34/-34) NuxCore/Math/Complex.h (+13/-13) NuxCore/Math/MathFunctions.cpp (+7/-7) NuxCore/Math/MathFunctions.h (+5/-5) NuxCore/Math/MathUtility.h (+14/-14) NuxCore/Math/Matrix2.h (+2/-2) NuxCore/Math/Matrix3.h (+2/-2) NuxCore/Math/Matrix4.h (+2/-2) NuxCore/Math/Vector2.h (+10/-10) NuxCore/Math/Vector3.h (+6/-6) NuxCore/Math/Vector4.h (+6/-6) NuxCore/Memory.cpp (+10/-10) NuxCore/Memory.h (+16/-16) NuxCore/NUniqueIndex.cpp (+1/-1) NuxCore/NUniqueIndex.h (+1/-1) NuxCore/NumberConversion.cpp (+8/-8) NuxCore/NumberConversion.h (+4/-4) NuxCore/NuxCore.cpp (+5/-5) NuxCore/NuxCore.h (+9/-10) NuxCore/Object.cpp (+20/-32) NuxCore/ObjectPtr.h (+3/-3) NuxCore/OutputDevice.cpp (+7/-7) NuxCore/Parsing.cpp (+7/-7) NuxCore/Parsing.h (+5/-5) NuxCore/Platform.cpp (+2/-2) NuxCore/Platform.h (+1/-1) NuxCore/PropertyOperators.h (+1/-1) NuxCore/PropertyTraits.h (+5/-0) NuxCore/Rect.cpp (+5/-0) NuxCore/Rect.h (+8/-6) NuxCore/System.h (+38/-38) NuxCore/SystemTypes.h (+40/-158) NuxCore/TextString.cpp (+309/-309) NuxCore/TextString.h (+163/-163) NuxCore/ThreadGNU.cpp (+14/-14) NuxCore/ThreadGNU.h (+16/-16) NuxCore/ThreadWin.cpp (+16/-23) NuxCore/ThreadWin.h (+19/-19) NuxCore/TimeFunctions.cpp (+11/-11) NuxCore/TimeFunctions.h (+2/-2) NuxCore/TinyXML/tinystr.cpp (+1/-1) NuxCore/Win32Dialogs/NWin32Clipboard.cpp (+1/-1) NuxCore/Win32Dialogs/NWin32CustomDialog.cpp (+8/-8) NuxCore/Win32Dialogs/NWin32CustomDialog.h (+4/-4) NuxCore/Win32Dialogs/NWin32MessageBox.cpp (+3/-3) NuxGraphics/Events.cpp (+16/-15) NuxGraphics/Events.h (+9/-11) NuxGraphics/FontRenderer.cpp (+145/-113) NuxGraphics/FontRenderer.h (+8/-8) NuxGraphics/FontTexture.cpp (+89/-84) NuxGraphics/FontTexture.h (+29/-29) NuxGraphics/GLDeviceFrameBufferObject.cpp (+98/-78) NuxGraphics/GLDeviceFrameBufferObject.h (+19/-19) NuxGraphics/GLDeviceObjects.cpp (+9/-9) NuxGraphics/GLError.cpp (+15/-11) NuxGraphics/GLError.h (+4/-4) NuxGraphics/GLPBuffer.cpp (+4/-0) NuxGraphics/GLPBuffer.h (+4/-0) NuxGraphics/GLRenderStates.cpp (+185/-183) NuxGraphics/GLRenderStates.h (+809/-772) NuxGraphics/GLResource.cpp (+27/-21) NuxGraphics/GLResource.h (+40/-14) NuxGraphics/GLResourceManager.cpp (+46/-46) NuxGraphics/GLResourceManager.h (+40/-40) NuxGraphics/GLSh_ColorPicker.cpp (+123/-102) NuxGraphics/GLSh_ColorPicker.h (+3/-3) NuxGraphics/GLSh_DrawFunction.cpp (+68/-65) NuxGraphics/GLSh_DrawFunction.h (+3/-3) NuxGraphics/GLSh_Fill.cpp (+28/-28) NuxGraphics/GLSh_Fill.h (+3/-3) NuxGraphics/GLShaderParameter.cpp (+9/-9) NuxGraphics/GLShaderParameter.h (+78/-78) NuxGraphics/GLTemplatePrimitiveBuffer.cpp (+169/-169) NuxGraphics/GLTemplatePrimitiveBuffer.h (+10/-10) NuxGraphics/GLTextureResourceManager.cpp (+299/-288) NuxGraphics/GLTextureResourceManager.h (+168/-164) NuxGraphics/GLTextureStates.cpp (+136/-98) NuxGraphics/GLTextureStates.h (+13/-13) NuxGraphics/GLTimer.cpp (+10/-10) NuxGraphics/GLVertexResourceManager.cpp (+72/-72) NuxGraphics/GLVertexResourceManager.h (+12/-12) NuxGraphics/GLWindowManager.cpp (+28/-22) NuxGraphics/GLWindowManager.h (+9/-5) NuxGraphics/GlobalGraphicsInitializer.cpp (+4/-4) NuxGraphics/GlobalGraphicsInitializer.h (+1/-1) NuxGraphics/GpuDevice.cpp (+386/-399) NuxGraphics/GpuDevice.h (+126/-108) NuxGraphics/GpuDeviceShader.cpp (+24/-24) NuxGraphics/GpuDeviceTexture.cpp (+74/-73) NuxGraphics/GpuDeviceVertex.cpp (+73/-71) NuxGraphics/GraphicsDisplay.h (+2/-2) NuxGraphics/GraphicsDisplayWin.cpp (+441/-382) NuxGraphics/GraphicsDisplayWin.h (+58/-45) NuxGraphics/GraphicsDisplayX11.cpp (+605/-487) NuxGraphics/GraphicsDisplayX11.h (+79/-65) NuxGraphics/GraphicsEngine.cpp (+455/-455) NuxGraphics/GraphicsEngine.h (+186/-186) NuxGraphics/IOpenGLAnimatedTexture.cpp (+25/-25) NuxGraphics/IOpenGLAnimatedTexture.h (+10/-10) NuxGraphics/IOpenGLAsmShader.cpp (+189/-170) NuxGraphics/IOpenGLAsmShader.h (+31/-31) NuxGraphics/IOpenGLBaseTexture.cpp (+131/-119) NuxGraphics/IOpenGLBaseTexture.h (+54/-54) NuxGraphics/IOpenGLCgShader.cpp (+50/-50) NuxGraphics/IOpenGLCgShader.h (+13/-13) NuxGraphics/IOpenGLCubeTexture.cpp (+29/-29) NuxGraphics/IOpenGLCubeTexture.h (+10/-10) NuxGraphics/IOpenGLFrameBufferObject.cpp (+74/-73) NuxGraphics/IOpenGLFrameBufferObject.h (+12/-12) NuxGraphics/IOpenGLGLSLShader.cpp (+552/-550) NuxGraphics/IOpenGLGLSLShader.h (+79/-79) NuxGraphics/IOpenGLIndexBuffer.cpp (+47/-36) NuxGraphics/IOpenGLIndexBuffer.h (+10/-10) NuxGraphics/IOpenGLPixelBufferOject.cpp (+44/-36) NuxGraphics/IOpenGLPixelBufferOject.h (+5/-5) NuxGraphics/IOpenGLQuery.cpp (+47/-38) NuxGraphics/IOpenGLQuery.h (+10/-10) NuxGraphics/IOpenGLRectangleTexture.cpp (+34/-31) NuxGraphics/IOpenGLRectangleTexture.h (+11/-11) NuxGraphics/IOpenGLResource.h (+6/-6) NuxGraphics/IOpenGLSurface.cpp (+217/-111) NuxGraphics/IOpenGLSurface.h (+17/-74) NuxGraphics/IOpenGLTexture2D.cpp (+44/-33) NuxGraphics/IOpenGLTexture2D.h (+14/-14) NuxGraphics/IOpenGLVertexBuffer.cpp (+43/-34) NuxGraphics/IOpenGLVertexBuffer.h (+10/-10) NuxGraphics/IOpenGLVertexDeclaration.cpp (+5/-5) NuxGraphics/IOpenGLVertexDeclaration.h (+1/-1) NuxGraphics/IOpenGLVolume.cpp (+96/-90) NuxGraphics/IOpenGLVolume.h (+10/-10) NuxGraphics/IOpenGLVolumeTexture.cpp (+46/-43) NuxGraphics/IOpenGLVolumeTexture.h (+13/-13) NuxGraphics/Makefile.am (+1/-0) NuxGraphics/MeshFileLoader-OBJ.cpp (+11/-11) NuxGraphics/NuxGraphics.cpp (+6/-2) NuxGraphics/NuxGraphics.h (+1/-1) NuxGraphics/NuxGraphicsResources.cpp (+163/-163) NuxGraphics/NuxGraphicsResources.h (+5/-5) NuxGraphics/OpenGLMapping.h (+129/-0) NuxGraphics/Readme.txt (+6/-6) NuxGraphics/RenderingPipe.cpp (+218/-181) NuxGraphics/RenderingPipe.h (+7/-7) NuxGraphics/RenderingPipeAsm.cpp (+899/-899) NuxGraphics/RenderingPipeGLSL.cpp (+1111/-1140) NuxGraphics/RenderingPipeTextureBlend.cpp (+85/-85) NuxGraphics/RunTimeStats.cpp (+51/-51) NuxGraphics/RunTimeStats.h (+32/-32) NuxGraphics/VirtualKeyCodes.h (+3/-3) NuxGraphics/XInputWindow.cpp (+28/-28) NuxGraphics/nux-graphics.pc.in (+1/-0) NuxImage/BitmapFormats.cpp (+60/-55) NuxImage/BitmapFormats.h (+10/-35) NuxImage/Bmp.cpp (+168/-168) NuxImage/Bmp.h (+4/-4) NuxImage/CairoGraphics.cpp (+96/-87) NuxImage/CairoGraphics.h (+10/-10) NuxImage/DDS.cpp (+58/-58) NuxImage/GdiImageLoader.cpp (+19/-19) NuxImage/GdiImageLoader.h (+1/-1) NuxImage/GdkGraphics.cpp (+1/-1) NuxImage/ImageSurface.cpp (+548/-550) NuxImage/ImageSurface.h (+174/-174) NuxImage/NAnimatedTexture.cpp (+51/-51) NuxImage/NAnimatedTexture.h (+3/-3) NuxImage/NITX.cpp (+341/-341) NuxImage/NITX.h (+13/-13) NuxImage/NPng.cpp (+132/-132) NuxImage/NPng.h (+4/-4) NuxImage/OpenEXR.cpp (+55/-55) NuxImage/OpenEXR.h (+1/-1) NuxImage/RGBE.cpp (+181/-181) NuxImage/RGBE.h (+7/-7) NuxImage/Tga.cpp (+179/-179) NuxImage/Tga.h (+2/-2) configure.ac (+24/-34) data/Makefile.am (+20/-21) data/UITextures/Painter.xml (+17/-17) examples/Makefile.am (+60/-58) examples/text_entry_focus.cpp (+0/-1) gputests/Makefile.am (+5/-1) gputests/framebufferobject.cpp (+2/-2) gputests/quad_2texmod.cpp (+2/-2) gputests/texture_blur.cpp (+2/-2) gputests/texture_copy_blur.cpp (+2/-2) gputests/texture_data.cpp (+2/-2) gputests/texture_power_of_2.cpp (+4/-20) tools/Makefile.am (+1/-1) tools/unity_support_test.c (+235/-12) |
To merge this branch: | bzr merge lp:~haggai-eran/nux/rtl |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Penhey (community) | Needs Fixing | ||
Jay Taoko | Pending | ||
Review via email: mp+71538@code.launchpad.net |
Commit message
Description of the change
Unity currently lacks support for right-to-left interface mirroring, for languages such as Hebrew and Arabic. These patches could facilitate such support. They add a GetDefaultDirection and SetDefaultDirection global function (modeled after GTK's gtk_widget_
The second patch implements interface mirroring for the HLayout class, when using a RightToLeft direction.
Haggai Eran (haggai-eran) wrote : | # |
Okay, I've sent the email.
Jay Taoko (jaytaoko) wrote : | # |
Haggai,
Sorry that I haven’t been able to review your branch yet. The reason for that is Nux trunk is being stabilized in anticipation of the release of Ubuntu Oneiric. Once we branch Nux for the next release, I will review your branch.
Jay
Haggai Eran (haggai-eran) wrote : | # |
That's too bad. I was hoping to get my patches for unity 2d into Oneiric.
- 417. By Haggai Eran
-
Merged trunk.
- 418. By Haggai Eran
-
Merge trunk.
Haggai Eran (haggai-eran) wrote : | # |
Hi,
Is there a chance you could review this branch for the Precise version? I would like to help Unity get RTL support in this version, especially since it is an LTS.
Jay Taoko (jaytaoko) wrote : | # |
Sure, your branch is on the agenda. There have been substantial changes to Nux, so I will have to adapt your branch to it.
Haggai Eran (haggai-eran) wrote : | # |
Thanks,
Let me know if I can help.
Jay Taoko (jaytaoko) wrote : | # |
Haggai
From your patch, it appears that an HLayout will be able to process their content from Right to Left (rather than only from Left to Right as it is at the moment). However, I think that this will give the same result as the current processing. Or am I missing something?
Did you also meant to have elements filled inside an Hlayout from Right to Left? (Currently HLayout are filled from Left to Right).
Jay
Haggai Eran (haggai-eran) wrote : | # |
Jay,
My intention was to have HLayout position it's elements from right to left (when in the right locale), instead of from left to right. This is similar to how GtkHBox behaves, for example.
I think that this is also what the implementation does. It starts with the last child in the HLayout's list, and lays it at the leftmost position, and then follows on to the previous child in the list, and so on.
Haggai
Tim Penhey (thumper) wrote : | # |
This is an absolutely massive branch. I see that some of the changes are pure whitespace changes.
Can these please be broken out separately from any actual code changes. Thanks.
Jay Taoko (jaytaoko) wrote : | # |
I am working on that branch. It isn't massive actually once you re-base it with on nux trunk. Only a few files have changed.
Jay Taoko (jaytaoko) wrote : | # |
Haggai
In the case of the Hlayout, the first element that is added to the list will be the left-most element inside the Hlayout. You are proposing that the first element added to the Hlayout, be the right-most element inside the HLayout. And when processing the sizes of the HLayout elements, we either start from left or right depending on the direction option you have added. Is that correct?
Can you re-base this branch on Nux trunk? Your changes will be more obvious. I believe you only have a few files that are different from Nux trunk.
Haggai Eran (haggai-eran) wrote : | # |
Jay, you are correct. In fact, when in right-to-left locale, I replaced the content distribution enum values, so that if it is set to eStackLeft, elements would actually be aligned to the right, and vice versa. Most of the changes in HLayout just change the order in which elements are packed.
I'll gladly rebase the branch. I probably should have done that in the first place, instead of merging the trunk, but I'm a little bit new to bazaar and launchpad. Should I use push --override to upload the results, or just create a new branch?
Jason Smith (jassmith) wrote : | # |
It is almost always better to create a new branch rather than do a bzr push --override. Sorry about the delayed answer. Seems your review got lost in the holiday shuffle.
Haggai Eran (haggai-eran) wrote : | # |
Thanks Jason. Eventually, I did create a new branch (lp:~haggai-eran/nux/rtl-rebased), but before it was merged I thought of a better way to implement the patch, so I created yet another branch (lp:~haggai-eran/nux/rtl-logical-packing). I thought I should delete this merge proposal, but launchpad said it would delete all the discussion, so I wasn't sure if that was the right thing to do.
Unmerged revisions
- 418. By Haggai Eran
-
Merge trunk.
- 417. By Haggai Eran
-
Merged trunk.
- 416. By Haggai Eran
-
Merged trunk changes.
- 415. By Haggai Eran
-
More HLayout changes toward right-to-left support.
- 414. By Haggai Eran
-
Add right-to-left mirroring support. Implement mirroring for HLayout.
Preview Diff
1 | === modified file 'Nux/AbstractButton.cpp' | |||
2 | --- Nux/AbstractButton.cpp 2011-10-05 20:56:39 +0000 | |||
3 | +++ Nux/AbstractButton.cpp 2011-10-25 21:32:25 +0000 | |||
4 | @@ -22,7 +22,7 @@ | |||
5 | 22 | 22 | ||
6 | 23 | #include "Nux.h" | 23 | #include "Nux.h" |
7 | 24 | #include "AbstractButton.h" | 24 | #include "AbstractButton.h" |
9 | 25 | #include "HLayout.h" | 25 | #include "StaticText.h" |
10 | 26 | 26 | ||
11 | 27 | namespace nux | 27 | namespace nux |
12 | 28 | { | 28 | { |
13 | @@ -30,20 +30,15 @@ | |||
14 | 30 | 30 | ||
15 | 31 | AbstractButton::AbstractButton(NUX_FILE_LINE_DECL) | 31 | AbstractButton::AbstractButton(NUX_FILE_LINE_DECL) |
16 | 32 | : View(NUX_FILE_LINE_PARAM) | 32 | : View(NUX_FILE_LINE_PARAM) |
31 | 33 | , state(NUX_STATE_NORMAL) | 33 | , visual_state_(VISUAL_STATE_NORMAL) |
32 | 34 | { | 34 | { |
33 | 35 | active = false; | 35 | active_ = false; |
34 | 36 | togglable_ = false; | 36 | mouse_pressed_ = false; |
35 | 37 | Init(); | 37 | static_text_ = NULL; |
36 | 38 | } | 38 | label_color_ = color::White; |
37 | 39 | 39 | same_size_as_content_ = false; | |
38 | 40 | AbstractButton::~AbstractButton() | 40 | label_font_size_ = 12; |
39 | 41 | { | 41 | |
26 | 42 | |||
27 | 43 | } | ||
28 | 44 | |||
29 | 45 | void AbstractButton::Init() | ||
30 | 46 | { | ||
40 | 47 | mouse_click.connect(sigc::mem_fun(this, &AbstractButton::RecvClick)); | 42 | mouse_click.connect(sigc::mem_fun(this, &AbstractButton::RecvClick)); |
41 | 48 | mouse_down.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseDown)); | 43 | mouse_down.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseDown)); |
42 | 49 | mouse_double_click.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseDown)); | 44 | mouse_double_click.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseDown)); |
43 | @@ -53,50 +48,50 @@ | |||
44 | 53 | mouse_leave.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseLeave)); | 48 | mouse_leave.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseLeave)); |
45 | 54 | } | 49 | } |
46 | 55 | 50 | ||
61 | 56 | long AbstractButton::ProcessEvent(IEvent &ievent, long TraverseInfo, long ProcessEventInfo) | 51 | AbstractButton::~AbstractButton() |
62 | 57 | { | 52 | { |
63 | 58 | return PostProcessEvent2 (ievent, TraverseInfo, ProcessEventInfo); | 53 | |
64 | 59 | } | 54 | } |
65 | 60 | 55 | ||
66 | 61 | void AbstractButton::RecvClick(int x, int y, unsigned long button_flags, unsigned long key_flags) | 56 | bool AbstractButton::Active() const |
67 | 62 | { | 57 | { |
68 | 63 | if (!IsViewActive()) | 58 | return active_; |
69 | 64 | return; | 59 | } |
70 | 65 | 60 | ||
71 | 66 | if(togglable_) | 61 | void AbstractButton::SetActive(bool active) |
72 | 67 | { | 62 | { |
73 | 68 | active = !active; | 63 | if (active) |
74 | 69 | } | 64 | Activate(); |
75 | 70 | else | 65 | else |
87 | 71 | { | 66 | Deactivate(); |
88 | 72 | active = true; | 67 | } |
89 | 73 | } | 68 | |
90 | 74 | 69 | ButtonVisualState AbstractButton::GetVisualState() | |
91 | 75 | if(togglable_ == false) | 70 | { |
92 | 76 | { | 71 | return visual_state_; |
82 | 77 | active = false; | ||
83 | 78 | } | ||
84 | 79 | |||
85 | 80 | activated.emit(this); | ||
86 | 81 | QueueDraw(); | ||
93 | 82 | } | 72 | } |
94 | 83 | 73 | ||
95 | 84 | void AbstractButton::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags) | 74 | void AbstractButton::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags) |
96 | 85 | { | 75 | { |
99 | 86 | if (!IsViewActive()) | 76 | if (IsMousePointerInside()) |
100 | 87 | return; | 77 | { |
101 | 78 | visual_state_ = VISUAL_STATE_PRELIGHT; | ||
102 | 79 | } | ||
103 | 80 | else | ||
104 | 81 | { | ||
105 | 82 | visual_state_ = VISUAL_STATE_NORMAL; | ||
106 | 83 | } | ||
107 | 88 | 84 | ||
110 | 89 | state = NUX_STATE_PRELIGHT; | 85 | mouse_pressed_ = false; |
111 | 90 | //state = 1; | 86 | visual_state_change.emit(this); |
112 | 91 | QueueDraw(); | 87 | QueueDraw(); |
113 | 92 | } | 88 | } |
114 | 93 | 89 | ||
115 | 94 | void AbstractButton::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags) | 90 | void AbstractButton::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags) |
116 | 95 | { | 91 | { |
121 | 96 | if (!IsViewActive()) | 92 | visual_state_ = VISUAL_STATE_PRESSED; |
122 | 97 | return; | 93 | mouse_pressed_ = true; |
123 | 98 | 94 | visual_state_change.emit(this); | |
120 | 99 | state = NUX_STATE_ACTIVE; | ||
124 | 100 | QueueDraw(); | 95 | QueueDraw(); |
125 | 101 | } | 96 | } |
126 | 102 | 97 | ||
127 | @@ -107,13 +102,54 @@ | |||
128 | 107 | 102 | ||
129 | 108 | void AbstractButton::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags) | 103 | void AbstractButton::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags) |
130 | 109 | { | 104 | { |
132 | 110 | state = NUX_STATE_PRELIGHT; | 105 | if (mouse_pressed_) |
133 | 106 | { | ||
134 | 107 | visual_state_ = VISUAL_STATE_PRESSED; | ||
135 | 108 | } | ||
136 | 109 | else | ||
137 | 110 | { | ||
138 | 111 | visual_state_ = VISUAL_STATE_PRELIGHT; | ||
139 | 112 | } | ||
140 | 113 | |||
141 | 114 | visual_state_change.emit(this); | ||
142 | 111 | QueueDraw(); | 115 | QueueDraw(); |
143 | 112 | } | 116 | } |
144 | 113 | 117 | ||
145 | 114 | void AbstractButton::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags) | 118 | void AbstractButton::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags) |
146 | 115 | { | 119 | { |
149 | 116 | state = NUX_STATE_NORMAL; | 120 | visual_state_ = VISUAL_STATE_NORMAL; |
150 | 117 | QueueDraw(); | 121 | visual_state_change.emit(this); |
151 | 122 | QueueDraw(); | ||
152 | 123 | } | ||
153 | 124 | |||
154 | 125 | void AbstractButton::SetLabelColor(const Color &color) | ||
155 | 126 | { | ||
156 | 127 | label_color_ = color; | ||
157 | 128 | if (static_text_) | ||
158 | 129 | static_text_->SetTextColor(label_color_); | ||
159 | 130 | QueueDraw(); | ||
160 | 131 | } | ||
161 | 132 | |||
162 | 133 | Color AbstractButton::GetLabelColor() | ||
163 | 134 | { | ||
164 | 135 | return label_color_; | ||
165 | 136 | } | ||
166 | 137 | |||
167 | 138 | ButtonVisualState AbstractButton::GetVisualState() const | ||
168 | 139 | { | ||
169 | 140 | return visual_state_; | ||
170 | 141 | } | ||
171 | 142 | |||
172 | 143 | void AbstractButton::SetLabelFontSize(int point) | ||
173 | 144 | { | ||
174 | 145 | if (point < 0) | ||
175 | 146 | return; | ||
176 | 147 | |||
177 | 148 | label_font_size_ = point; | ||
178 | 149 | } | ||
179 | 150 | |||
180 | 151 | int AbstractButton::GetLabelFontSize() const | ||
181 | 152 | { | ||
182 | 153 | return label_font_size_; | ||
183 | 118 | } | 154 | } |
184 | 119 | } | 155 | } |
185 | 120 | 156 | ||
186 | === modified file 'Nux/AbstractButton.h' | |||
187 | --- Nux/AbstractButton.h 2011-09-20 06:03:43 +0000 | |||
188 | +++ Nux/AbstractButton.h 2011-10-25 21:32:25 +0000 | |||
189 | @@ -27,47 +27,118 @@ | |||
190 | 27 | 27 | ||
191 | 28 | namespace nux | 28 | namespace nux |
192 | 29 | { | 29 | { |
194 | 30 | enum State | 30 | class StaticText; |
195 | 31 | |||
196 | 32 | enum ButtonVisualState | ||
197 | 31 | { | 33 | { |
203 | 32 | NUX_STATE_ACTIVE = 0, | 34 | VISUAL_STATE_PRESSED = 0, |
204 | 33 | NUX_STATE_NORMAL = 1, | 35 | VISUAL_STATE_NORMAL = 1, |
205 | 34 | NUX_STATE_PRELIGHT = 2, | 36 | VISUAL_STATE_PRELIGHT = 2, |
206 | 35 | NUX_STATE_SELECTED = 3, | 37 | VISUAL_STATE_DISABLED = 3 |
202 | 36 | NUX_STATE_INSENSITIVE = 4 | ||
207 | 37 | }; | 38 | }; |
208 | 38 | 39 | ||
210 | 39 | //! The base class of Button widgets. | 40 | //! The base class of button type widgets. |
211 | 41 | /*! | ||
212 | 42 | AbstractButton is the direct base class of Button, CheckBox and RadioButton. It is a base class for ToggleButton. | ||
213 | 43 | */ | ||
214 | 40 | class AbstractButton : public View | 44 | class AbstractButton : public View |
215 | 41 | { | 45 | { |
216 | 42 | NUX_DECLARE_OBJECT_TYPE(AbstractButton, View); | 46 | NUX_DECLARE_OBJECT_TYPE(AbstractButton, View); |
217 | 43 | public: | 47 | public: |
218 | 44 | AbstractButton(NUX_FILE_LINE_PROTO); | 48 | AbstractButton(NUX_FILE_LINE_PROTO); |
226 | 45 | ~AbstractButton(); | 49 | virtual ~AbstractButton(); |
227 | 46 | 50 | ||
228 | 47 | //! Signal emitted when the button is activated. | 51 | sigc::signal<void, AbstractButton*> visual_state_change; |
229 | 48 | Property<bool> active; | 52 | |
230 | 49 | 53 | //! Returns the visual state of the AbstractButton | |
231 | 50 | //! Signal emitted when the button is activated. | 54 | /*! |
232 | 51 | sigc::signal<void, AbstractButton*> activated; | 55 | Returns the visual state of the AbstractButton. |
233 | 56 | |||
234 | 57 | @return The visual state of the AbstractButton. | ||
235 | 58 | */ | ||
236 | 59 | ButtonVisualState GetVisualState(); | ||
237 | 60 | |||
238 | 61 | //! Return the active state of the button. | ||
239 | 62 | /*! | ||
240 | 63 | Return the active state of the button. A Button has a non-persistent active state. It always returns false. | ||
241 | 64 | CheckBox, RadionButton and ToggleButton return true if they are active. | ||
242 | 65 | |||
243 | 66 | @return True if the button object is in an active state. | ||
244 | 67 | */ | ||
245 | 68 | bool Active() const; | ||
246 | 69 | |||
247 | 70 | //! Activate the button. | ||
248 | 71 | /*! | ||
249 | 72 | Activate the button. If this object is a Button, then it has no persistent state and the function does nothing. | ||
250 | 73 | */ | ||
251 | 74 | virtual void Activate() = 0; | ||
252 | 75 | |||
253 | 76 | //! Deactivate the button. | ||
254 | 77 | /*! | ||
255 | 78 | Deactivate the button. If this object is a Button, then it has no persistent state and the function does nothing. | ||
256 | 79 | */ | ||
257 | 80 | virtual void Deactivate() = 0; | ||
258 | 81 | |||
259 | 82 | //! Set the state of the button. | ||
260 | 83 | /*! | ||
261 | 84 | Set the sate of the button. The button is either activated or deactivated. | ||
262 | 85 | |||
263 | 86 | @param active The button state. | ||
264 | 87 | */ | ||
265 | 88 | virtual void SetActive(bool active); | ||
266 | 89 | |||
267 | 90 | //! Set the text color. | ||
268 | 91 | /*! | ||
269 | 92 | Set the text color. | ||
270 | 93 | |||
271 | 94 | @param color the text color. | ||
272 | 95 | */ | ||
273 | 96 | void SetLabelColor(const Color &color); | ||
274 | 97 | |||
275 | 98 | //! Get the text color. | ||
276 | 99 | /*! | ||
277 | 100 | Get the text color. | ||
278 | 101 | |||
279 | 102 | @return The text color. | ||
280 | 103 | */ | ||
281 | 104 | Color GetLabelColor(); | ||
282 | 105 | |||
283 | 106 | //! Get the button visual state. | ||
284 | 107 | /*! | ||
285 | 108 | Get the button visual state. | ||
286 | 109 | |||
287 | 110 | @return The button visual state. | ||
288 | 111 | */ | ||
289 | 112 | ButtonVisualState GetVisualState() const; | ||
290 | 113 | |||
291 | 114 | virtual void SetLabelFontSize(int point); | ||
292 | 115 | int GetLabelFontSize() const; | ||
293 | 52 | 116 | ||
294 | 53 | protected: | 117 | protected: |
312 | 54 | bool togglable_; | 118 | //! The state of the AbstractButton. |
313 | 55 | 119 | bool active_; | |
314 | 56 | //! Button state property. | 120 | |
315 | 57 | // FIXME: Should be read only. | 121 | bool mouse_pressed_; |
316 | 58 | nux::Property<State> state; | 122 | |
317 | 59 | 123 | //! Visual state of the button object. | |
318 | 60 | virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); | 124 | ButtonVisualState visual_state_; |
319 | 61 | 125 | ||
320 | 62 | void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags); | 126 | |
321 | 63 | void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags); | 127 | // Common attribute for all the classes that inherit from AbstractButton. |
322 | 64 | void RecvMouseMove (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); | 128 | std::string label_; |
323 | 65 | void RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags); | 129 | Color label_color_; |
324 | 66 | void RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags); | 130 | StaticText *static_text_; |
325 | 67 | void RecvClick (int x, int y, unsigned long button_flags, unsigned long key_flags); | 131 | int label_font_size_; |
326 | 68 | 132 | bool same_size_as_content_; | |
327 | 69 | private: | 133 | int pre_layout_width_; |
328 | 70 | void Init (); | 134 | int pre_layout_height_; |
329 | 135 | |||
330 | 136 | virtual void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags); | ||
331 | 137 | virtual void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags); | ||
332 | 138 | virtual void RecvMouseMove (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); | ||
333 | 139 | virtual void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags); | ||
334 | 140 | virtual void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags); | ||
335 | 141 | virtual void RecvClick (int x, int y, unsigned long button_flags, unsigned long key_flags) = 0; | ||
336 | 71 | }; | 142 | }; |
337 | 72 | } | 143 | } |
338 | 73 | 144 | ||
339 | 74 | 145 | ||
340 | === added file 'Nux/AbstractCheckedButton.cpp' | |||
341 | --- Nux/AbstractCheckedButton.cpp 1970-01-01 00:00:00 +0000 | |||
342 | +++ Nux/AbstractCheckedButton.cpp 2011-10-25 21:32:25 +0000 | |||
343 | @@ -0,0 +1,217 @@ | |||
344 | 1 | /* | ||
345 | 2 | * Copyright 2010 Inalogic® Inc. | ||
346 | 3 | * | ||
347 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
348 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
349 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
350 | 7 | * of the License. | ||
351 | 8 | * | ||
352 | 9 | * This program is distributed in the hope that it will be useful, but | ||
353 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
354 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
355 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
356 | 13 | * License for more details. | ||
357 | 14 | * | ||
358 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
359 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
360 | 17 | * | ||
361 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
362 | 19 | * | ||
363 | 20 | */ | ||
364 | 21 | |||
365 | 22 | |||
366 | 23 | #include "Nux.h" | ||
367 | 24 | #include "HLayout.h" | ||
368 | 25 | #include "AbstractCheckedButton.h" | ||
369 | 26 | #include "StaticText.h" | ||
370 | 27 | |||
371 | 28 | namespace nux | ||
372 | 29 | { | ||
373 | 30 | NUX_IMPLEMENT_OBJECT_TYPE(AbstractCheckedButton); | ||
374 | 31 | |||
375 | 32 | AbstractCheckedButton::AbstractCheckedButton(const std::string &str, bool state, NUX_FILE_LINE_DECL) | ||
376 | 33 | : AbstractButton(NUX_FILE_LINE_PARAM) | ||
377 | 34 | { | ||
378 | 35 | label_ = str; | ||
379 | 36 | active_ = state; | ||
380 | 37 | hlayout_ = 0; | ||
381 | 38 | |||
382 | 39 | static_text_ = new StaticText(label_, NUX_TRACKER_LOCATION); | ||
383 | 40 | static_text_->SetTextColor(label_color_); | ||
384 | 41 | hlayout_ = new HLayout(NUX_TRACKER_LOCATION); | ||
385 | 42 | check_area_ = new InputArea(NUX_TRACKER_LOCATION); | ||
386 | 43 | |||
387 | 44 | check_area_->SetInputEventSensitivity(false); | ||
388 | 45 | static_text_->SetInputEventSensitivity(false); | ||
389 | 46 | |||
390 | 47 | // Set Geometry | ||
391 | 48 | check_area_->SetMinMaxSize(14, 14); | ||
392 | 49 | |||
393 | 50 | hlayout_->SetSpaceBetweenChildren(4); | ||
394 | 51 | hlayout_->SetContentDistribution(MAJOR_POSITION_LEFT); | ||
395 | 52 | hlayout_->AddView(check_area_, 0, MINOR_POSITION_CENTER, MINOR_SIZE_MATCHCONTENT); | ||
396 | 53 | hlayout_->AddView(static_text_, 1, MINOR_POSITION_CENTER, MINOR_SIZE_MATCHCONTENT); | ||
397 | 54 | |||
398 | 55 | // // This is convenient to make the layout and the AbstractCheckedButton fit the check area and the caption area. | ||
399 | 56 | // // Since the check area is bigger than 4x4, it will force the layout and the AbstractCheckedButton to grow. | ||
400 | 57 | // // This is useful if the AbstractCheckedButton is put in a vertical layout and it has a stretch factor of 0. Then the width of the AbstractCheckedButton | ||
401 | 58 | // // will be adjusted to fit the minimum width of the check area and the caption area. | ||
402 | 59 | // { | ||
403 | 60 | // hlayout_->SetMinimumSize(1, 1); | ||
404 | 61 | // SetMinimumSize(14, 14); | ||
405 | 62 | // ApplyMinWidth(); | ||
406 | 63 | // ApplyMinHeight(); | ||
407 | 64 | // } | ||
408 | 65 | |||
409 | 66 | hlayout_->SetScaleFactor(0); | ||
410 | 67 | SetLayout(hlayout_); | ||
411 | 68 | |||
412 | 69 | } | ||
413 | 70 | |||
414 | 71 | AbstractCheckedButton::~AbstractCheckedButton() | ||
415 | 72 | { | ||
416 | 73 | } | ||
417 | 74 | |||
418 | 75 | void AbstractCheckedButton::SetLabel(const std::string &checkbox_label) | ||
419 | 76 | { | ||
420 | 77 | label_ = checkbox_label; | ||
421 | 78 | static_text_->SetText(label_); | ||
422 | 79 | QueueDraw(); | ||
423 | 80 | } | ||
424 | 81 | |||
425 | 82 | std::string AbstractCheckedButton::GetLabel() const | ||
426 | 83 | { | ||
427 | 84 | return label_; | ||
428 | 85 | } | ||
429 | 86 | |||
430 | 87 | void AbstractCheckedButton::Draw(GraphicsEngine &graphics_engine, bool force_draw) | ||
431 | 88 | { | ||
432 | 89 | Geometry base = GetGeometry(); | ||
433 | 90 | graphics_engine.PushClippingRectangle(base); | ||
434 | 91 | |||
435 | 92 | GetPainter().PaintBackground(graphics_engine, base); | ||
436 | 93 | |||
437 | 94 | InteractState is; | ||
438 | 95 | is.is_on = active_; | ||
439 | 96 | |||
440 | 97 | if (visual_state_ == VISUAL_STATE_PRESSED) | ||
441 | 98 | { | ||
442 | 99 | is.is_focus = true; | ||
443 | 100 | } | ||
444 | 101 | else if (visual_state_ == VISUAL_STATE_PRELIGHT) | ||
445 | 102 | { | ||
446 | 103 | is.is_prelight = true; | ||
447 | 104 | } | ||
448 | 105 | else | ||
449 | 106 | { | ||
450 | 107 | is.is_focus = false; | ||
451 | 108 | is.is_prelight = false; | ||
452 | 109 | } | ||
453 | 110 | |||
454 | 111 | GetPainter().PushPaintLayerStack(); | ||
455 | 112 | { | ||
456 | 113 | GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometry(), is, Color(0xff000000)); | ||
457 | 114 | static_text_->ProcessDraw(graphics_engine, true); | ||
458 | 115 | } | ||
459 | 116 | GetPainter().PopPaintLayerStack(); | ||
460 | 117 | |||
461 | 118 | graphics_engine.PopClippingRectangle(); | ||
462 | 119 | } | ||
463 | 120 | |||
464 | 121 | long AbstractCheckedButton::ComputeContentSize() | ||
465 | 122 | { | ||
466 | 123 | if (view_layout_) | ||
467 | 124 | { | ||
468 | 125 | PreLayoutManagement(); | ||
469 | 126 | |||
470 | 127 | int old_width = GetBaseWidth(); | ||
471 | 128 | int old_height = GetBaseHeight(); | ||
472 | 129 | |||
473 | 130 | // Let the text view be as large as possible. | ||
474 | 131 | static_text_->SetMaximumWidth(AREA_MAX_WIDTH); | ||
475 | 132 | |||
476 | 133 | // Constrain the vertical expansion of the color selector. | ||
477 | 134 | view_layout_->SetBaseHeight(1); | ||
478 | 135 | long ret = view_layout_->ComputeContentSize(); | ||
479 | 136 | |||
480 | 137 | PostLayoutManagement(ret); | ||
481 | 138 | |||
482 | 139 | { | ||
483 | 140 | // Check if the text view goes out of the AbstractCheckedButton area. | ||
484 | 141 | Geometry base = GetGeometry(); | ||
485 | 142 | Geometry text_geo = static_text_->GetGeometry(); | ||
486 | 143 | |||
487 | 144 | // Intersect the AbstractCheckedButton and the text view | ||
488 | 145 | Geometry intersection = base.Intersect(text_geo); | ||
489 | 146 | if (intersection != text_geo) | ||
490 | 147 | { | ||
491 | 148 | // The text view goes outside of the AbstractCheckedButton area. We have to clip it | ||
492 | 149 | static_text_->SetMaximumWidth(intersection.width); | ||
493 | 150 | |||
494 | 151 | // Assign a size of 1 to the layout and call ComputeContentSize. | ||
495 | 152 | // Inside the StaticText::ComputeContentSize there is code that takes care of size negociation. | ||
496 | 153 | view_layout_->SetBaseWidth(1); | ||
497 | 154 | ret = view_layout_->ComputeContentSize(); | ||
498 | 155 | |||
499 | 156 | // Assign the layout geometry to the AbstractCheckedButton view. | ||
500 | 157 | PostLayoutManagement(ret); | ||
501 | 158 | } | ||
502 | 159 | } | ||
503 | 160 | |||
504 | 161 | int new_width = GetBaseWidth(); | ||
505 | 162 | int new_height = GetBaseHeight(); | ||
506 | 163 | |||
507 | 164 | long size_compliance = 0; | ||
508 | 165 | |||
509 | 166 | // The layout has been resized to tightly pack its content | ||
510 | 167 | if (new_width > old_width) | ||
511 | 168 | { | ||
512 | 169 | size_compliance |= eLargerWidth; // need scrollbar | ||
513 | 170 | } | ||
514 | 171 | else if (new_width < old_width) | ||
515 | 172 | { | ||
516 | 173 | size_compliance |= eSmallerWidth; | ||
517 | 174 | } | ||
518 | 175 | else | ||
519 | 176 | { | ||
520 | 177 | size_compliance |= eCompliantWidth; | ||
521 | 178 | } | ||
522 | 179 | |||
523 | 180 | // The layout has been resized to tightly pack its content | ||
524 | 181 | if (new_height > old_height) | ||
525 | 182 | { | ||
526 | 183 | size_compliance |= eLargerHeight; // need scrollbar | ||
527 | 184 | } | ||
528 | 185 | else if (new_height < old_height) | ||
529 | 186 | { | ||
530 | 187 | size_compliance |= eSmallerHeight; | ||
531 | 188 | } | ||
532 | 189 | else | ||
533 | 190 | { | ||
534 | 191 | size_compliance |= eCompliantHeight; | ||
535 | 192 | } | ||
536 | 193 | |||
537 | 194 | return size_compliance; | ||
538 | 195 | } | ||
539 | 196 | else | ||
540 | 197 | { | ||
541 | 198 | PreLayoutManagement(); | ||
542 | 199 | int ret = PostLayoutManagement(eCompliantHeight | eCompliantWidth); | ||
543 | 200 | return ret; | ||
544 | 201 | } | ||
545 | 202 | |||
546 | 203 | return 0; | ||
547 | 204 | } | ||
548 | 205 | |||
549 | 206 | void AbstractCheckedButton::SetLabelFontSize(int point) | ||
550 | 207 | { | ||
551 | 208 | AbstractButton::SetLabelFontSize(point); | ||
552 | 209 | if (static_text_ == NULL) | ||
553 | 210 | return; | ||
554 | 211 | |||
555 | 212 | static_text_->SetTextPointSize(point); | ||
556 | 213 | |||
557 | 214 | ComputeContentSize(); | ||
558 | 215 | QueueDraw(); | ||
559 | 216 | } | ||
560 | 217 | } | ||
561 | 0 | 218 | ||
562 | === added file 'Nux/AbstractCheckedButton.h' | |||
563 | --- Nux/AbstractCheckedButton.h 1970-01-01 00:00:00 +0000 | |||
564 | +++ Nux/AbstractCheckedButton.h 2011-10-25 21:32:25 +0000 | |||
565 | @@ -0,0 +1,110 @@ | |||
566 | 1 | /* | ||
567 | 2 | * Copyright 2010 Inalogic® Inc. | ||
568 | 3 | * | ||
569 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
570 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
571 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
572 | 7 | * of the License. | ||
573 | 8 | * | ||
574 | 9 | * This program is distributed in the hope that it will be useful, but | ||
575 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
576 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
577 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
578 | 13 | * License for more details. | ||
579 | 14 | * | ||
580 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
581 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
582 | 17 | * | ||
583 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
584 | 19 | * | ||
585 | 20 | */ | ||
586 | 21 | |||
587 | 22 | |||
588 | 23 | #ifndef ABSTRACTCHECKEDBUTTON_H | ||
589 | 24 | #define ABSTRACTCHECKEDBUTTON_H | ||
590 | 25 | |||
591 | 26 | #include "AbstractButton.h" | ||
592 | 27 | |||
593 | 28 | namespace nux | ||
594 | 29 | { | ||
595 | 30 | class HLayout; | ||
596 | 31 | class InputArea; | ||
597 | 32 | class StaticText; | ||
598 | 33 | |||
599 | 34 | //! AbstractCheckedButton class | ||
600 | 35 | /*! | ||
601 | 36 | Acts as a base class for CheckBox and radioButton.\n | ||
602 | 37 | */ | ||
603 | 38 | class AbstractCheckedButton: public AbstractButton | ||
604 | 39 | { | ||
605 | 40 | NUX_DECLARE_OBJECT_TYPE(AbstractCheckedButton, AbstractButton); | ||
606 | 41 | public: | ||
607 | 42 | AbstractCheckedButton(const std::string &str, bool state = false, NUX_FILE_LINE_PROTO); | ||
608 | 43 | virtual ~AbstractCheckedButton(); | ||
609 | 44 | |||
610 | 45 | //! Emitted when the button is clicked. | ||
611 | 46 | sigc::signal<void, AbstractCheckedButton*> click; | ||
612 | 47 | |||
613 | 48 | //! Emitted when the active state changes. | ||
614 | 49 | /*! | ||
615 | 50 | Emitted when the active state changes, as a result of a mouse click or an API call.\n | ||
616 | 51 | \sa Activate, Deactivate. | ||
617 | 52 | */ | ||
618 | 53 | sigc::signal<void, AbstractCheckedButton*> state_change; | ||
619 | 54 | |||
620 | 55 | //! Set the label. | ||
621 | 56 | /*! | ||
622 | 57 | Set the label of this AbstractCheckedButton. If the \a label argument is an empty string, then the the AbstractCheckedButton label is destroyed, | ||
623 | 58 | and the content of the AbstractCheckedButton is re-arranged accordingly. | ||
624 | 59 | |||
625 | 60 | @param label The label of the AbstractCheckedButton. | ||
626 | 61 | */ | ||
627 | 62 | void SetLabel(const std::string &checkbox_label); | ||
628 | 63 | |||
629 | 64 | //!Return the label of this AbstractCheckedButton. | ||
630 | 65 | /*! | ||
631 | 66 | Return the label of this AbstractCheckedButton. | ||
632 | 67 | |||
633 | 68 | @return The AbstractCheckedButton label string. | ||
634 | 69 | */ | ||
635 | 70 | std::string GetLabel() const; | ||
636 | 71 | |||
637 | 72 | //! Activate the check box. | ||
638 | 73 | /*! | ||
639 | 74 | Activate the check box. | ||
640 | 75 | */ | ||
641 | 76 | virtual void Activate() = 0; | ||
642 | 77 | |||
643 | 78 | //! Deactivate the check box. | ||
644 | 79 | /*! | ||
645 | 80 | Deactivate the check box. | ||
646 | 81 | */ | ||
647 | 82 | virtual void Deactivate() = 0; | ||
648 | 83 | |||
649 | 84 | virtual void SetLabelFontSize(int point); | ||
650 | 85 | |||
651 | 86 | protected: | ||
652 | 87 | virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw) = 0; | ||
653 | 88 | virtual void RecvClick(int x, int y, unsigned long button_flags, unsigned long key_flags) = 0; | ||
654 | 89 | virtual long ComputeContentSize(); | ||
655 | 90 | |||
656 | 91 | HLayout *hlayout_; | ||
657 | 92 | InputArea *check_area_; | ||
658 | 93 | |||
659 | 94 | private: | ||
660 | 95 | //! Override of Area::SetMinimumHeight and made private. | ||
661 | 96 | /*! | ||
662 | 97 | Prevent changing the minimum height of the StaticText view. | ||
663 | 98 | */ | ||
664 | 99 | virtual void SetMinimumHeight(){}; | ||
665 | 100 | |||
666 | 101 | //! Override of Area::SetMaximumHeight and made private. | ||
667 | 102 | /*! | ||
668 | 103 | Prevent changing the maximum height of the StaticText view. | ||
669 | 104 | */ | ||
670 | 105 | virtual void SetMaximumHeight(){}; | ||
671 | 106 | }; | ||
672 | 107 | |||
673 | 108 | } | ||
674 | 109 | |||
675 | 110 | #endif // ABSTRACTCHECKEDBUTTON_H | ||
676 | 0 | 111 | ||
677 | === modified file 'Nux/AbstractComboBox.cpp' | |||
678 | --- Nux/AbstractComboBox.cpp 2011-09-20 06:03:43 +0000 | |||
679 | +++ Nux/AbstractComboBox.cpp 2011-10-25 21:32:25 +0000 | |||
680 | @@ -28,94 +28,94 @@ | |||
681 | 28 | namespace nux | 28 | namespace nux |
682 | 29 | { | 29 | { |
683 | 30 | 30 | ||
687 | 31 | Color AbstractComboBox::m_sCOMBO_COLOR = Color (0x009F9F00); | 31 | Color AbstractComboBox::m_sCOMBO_COLOR = Color(0x009F9F00); |
688 | 32 | Color AbstractComboBox::m_sCOMBO_BUTTON_COLOR = Color (0x00FFFFFF); | 32 | Color AbstractComboBox::m_sCOMBO_BUTTON_COLOR = Color(0x00FFFFFF); |
689 | 33 | Color AbstractComboBox::m_sCOMBO_MOUSEOVER_COLOR = Color (0x55FFFFFF); | 33 | Color AbstractComboBox::m_sCOMBO_MOUSEOVER_COLOR = Color(0x55FFFFFF); |
690 | 34 | 34 | ||
694 | 35 | AbstractComboBox::AbstractComboBox (NUX_FILE_LINE_DECL) | 35 | AbstractComboBox::AbstractComboBox(NUX_FILE_LINE_DECL) |
695 | 36 | : View (NUX_FILE_LINE_PARAM) | 36 | : View(NUX_FILE_LINE_PARAM) |
696 | 37 | , m_MenuIsActive (false) | 37 | , m_MenuIsActive(false) |
697 | 38 | { | 38 | { |
698 | 39 | m_hlayout = new HLayout(NUX_TRACKER_LOCATION); | 39 | m_hlayout = new HLayout(NUX_TRACKER_LOCATION); |
699 | 40 | _combo_box_area = new InputArea(NUX_TRACKER_LOCATION); | 40 | _combo_box_area = new InputArea(NUX_TRACKER_LOCATION); |
700 | 41 | _combo_box_opening_area = new InputArea(NUX_TRACKER_LOCATION); | 41 | _combo_box_opening_area = new InputArea(NUX_TRACKER_LOCATION); |
701 | 42 | 42 | ||
717 | 43 | m_hlayout->AddView (_combo_box_area, 1); | 43 | m_hlayout->AddView(_combo_box_area, 1); |
718 | 44 | m_hlayout->AddView (_combo_box_opening_area, 0); | 44 | m_hlayout->AddView(_combo_box_opening_area, 0); |
719 | 45 | m_hlayout->SetHorizontalExternalMargin (0); | 45 | m_hlayout->SetHorizontalExternalMargin(0); |
720 | 46 | m_hlayout->SetVerticalExternalMargin (0); | 46 | m_hlayout->SetVerticalExternalMargin(0); |
721 | 47 | SetLayout (m_hlayout); | 47 | SetLayout(m_hlayout); |
722 | 48 | 48 | ||
723 | 49 | _combo_box_area->mouse_enter.connect (sigc::mem_fun (this, &AbstractComboBox::RecvMouseEnter) ); | 49 | _combo_box_area->mouse_enter.connect(sigc::mem_fun(this, &AbstractComboBox::RecvMouseEnter)); |
724 | 50 | _combo_box_area->mouse_leave.connect (sigc::mem_fun (this, &AbstractComboBox::RecvMouseLeave) ); | 50 | _combo_box_area->mouse_leave.connect(sigc::mem_fun(this, &AbstractComboBox::RecvMouseLeave)); |
725 | 51 | 51 | ||
726 | 52 | _combo_box_opening_area->mouse_enter.connect (sigc::mem_fun (this, &AbstractComboBox::RecvMouseEnter) ); | 52 | _combo_box_opening_area->mouse_enter.connect(sigc::mem_fun(this, &AbstractComboBox::RecvMouseEnter)); |
727 | 53 | _combo_box_opening_area->mouse_leave.connect (sigc::mem_fun (this, &AbstractComboBox::RecvMouseLeave) ); | 53 | _combo_box_opening_area->mouse_leave.connect(sigc::mem_fun(this, &AbstractComboBox::RecvMouseLeave)); |
728 | 54 | 54 | ||
729 | 55 | SetTextColor (color::Black); | 55 | SetTextColor(color::Black); |
730 | 56 | 56 | ||
731 | 57 | _pango_static_text = new StaticText (TEXT(""), NUX_TRACKER_LOCATION); | 57 | _pango_static_text = new StaticText("", NUX_TRACKER_LOCATION); |
732 | 58 | } | 58 | } |
733 | 59 | 59 | ||
734 | 60 | AbstractComboBox::~AbstractComboBox() | 60 | AbstractComboBox::~AbstractComboBox() |
735 | 61 | { | 61 | { |
736 | 62 | if (_pango_static_text) | 62 | if (_pango_static_text) |
738 | 63 | _pango_static_text->Dispose (); | 63 | _pango_static_text->Dispose(); |
739 | 64 | _pango_static_text = 0; | 64 | _pango_static_text = 0; |
740 | 65 | } | 65 | } |
741 | 66 | 66 | ||
743 | 67 | void AbstractComboBox::Draw (GraphicsEngine &GfxContext, bool force_draw) | 67 | void AbstractComboBox::Draw(GraphicsEngine &graphics_engine, bool force_draw) |
744 | 68 | { | 68 | { |
745 | 69 | Geometry base = GetGeometry(); | 69 | Geometry base = GetGeometry(); |
746 | 70 | 70 | ||
750 | 71 | GfxContext.PushClippingRectangle (base); | 71 | graphics_engine.PushClippingRectangle(base); |
751 | 72 | GetPainter().PaintBackground (GfxContext, base); | 72 | GetPainter().PaintBackground(graphics_engine, base); |
752 | 73 | GetPainter().PaintShape (GfxContext, base, m_sCOMBO_COLOR, eSHAPE_CORNER_ROUND4); | 73 | GetPainter().PaintShape(graphics_engine, base, m_sCOMBO_COLOR, eSHAPE_CORNER_ROUND4); |
753 | 74 | 74 | ||
754 | 75 | { | 75 | { |
758 | 76 | //GetPainter().PaintTextLineStatic (GfxContext, GetFont (), _combo_box_area->GetGeometry(), _combo_box_area->GetBaseString().GetTCharPtr(), GetTextColor(), eAlignTextLeft); | 76 | //GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), _combo_box_area->GetGeometry(), _combo_box_area->GetBaseString().GetTCharPtr(), GetTextColor(), eAlignTextLeft); |
759 | 77 | _pango_static_text->SetGeometry (_combo_box_area->GetGeometry ()); | 77 | _pango_static_text->SetGeometry(_combo_box_area->GetGeometry()); |
760 | 78 | _pango_static_text->ProcessDraw (GfxContext, true); | 78 | _pango_static_text->ProcessDraw(graphics_engine, true); |
761 | 79 | } | 79 | } |
762 | 80 | 80 | ||
763 | 81 | Geometry button_geo = _combo_box_opening_area->GetGeometry(); | 81 | Geometry button_geo = _combo_box_opening_area->GetGeometry(); |
766 | 82 | button_geo.OffsetSize (-5, -2); | 82 | button_geo.OffsetSize(-5, -2); |
767 | 83 | button_geo.OffsetPosition (+4, +1); | 83 | button_geo.OffsetPosition(+4, +1); |
768 | 84 | 84 | ||
771 | 85 | if (_combo_box_area->IsMouseInside() || _combo_box_opening_area->IsMouseInside() || GetFocused ()) | 85 | if (_combo_box_area->IsMouseInside() || _combo_box_opening_area->IsMouseInside()) |
772 | 86 | GetPainter().PaintShape (GfxContext, button_geo, m_sCOMBO_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4); | 86 | GetPainter().PaintShape(graphics_engine, button_geo, m_sCOMBO_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4); |
773 | 87 | else | 87 | else |
775 | 88 | GetPainter().PaintShape (GfxContext, button_geo, m_sCOMBO_BUTTON_COLOR, eSHAPE_CORNER_ROUND4); | 88 | GetPainter().PaintShape(graphics_engine, button_geo, m_sCOMBO_BUTTON_COLOR, eSHAPE_CORNER_ROUND4); |
776 | 89 | 89 | ||
780 | 90 | GeometryPositioning gp (eHACenter, eVACenter); | 90 | GeometryPositioning gp(eHACenter, eVACenter); |
781 | 91 | Geometry GeoPo = ComputeGeometryPositioning (button_geo, GetTheme().GetImageGeometry (eCOMBOBOX_OPEN_BUTTON), gp); | 91 | Geometry GeoPo = ComputeGeometryPositioning(button_geo, GetTheme().GetImageGeometry(eCOMBOBOX_OPEN_BUTTON), gp); |
782 | 92 | GetPainter().PaintShape (GfxContext, GeoPo, Color (0xFFFFFFFF), eCOMBOBOX_OPEN_BUTTON); | 92 | GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eCOMBOBOX_OPEN_BUTTON); |
783 | 93 | 93 | ||
784 | 94 | Geometry popup_geometry; | 94 | Geometry popup_geometry; |
804 | 95 | popup_geometry.SetX (_combo_box_area->GetBaseX() ); | 95 | popup_geometry.SetX(_combo_box_area->GetBaseX()); |
805 | 96 | popup_geometry.SetY (_combo_box_area->GetBaseY() + _combo_box_area->GetBaseHeight() ); | 96 | popup_geometry.SetY(_combo_box_area->GetBaseY() + _combo_box_area->GetBaseHeight()); |
806 | 97 | popup_geometry.SetWidth (_combo_box_area->GetBaseWidth() ); | 97 | popup_geometry.SetWidth(_combo_box_area->GetBaseWidth()); |
807 | 98 | popup_geometry.SetHeight (_combo_box_area->GetBaseHeight() ); | 98 | popup_geometry.SetHeight(_combo_box_area->GetBaseHeight()); |
808 | 99 | 99 | ||
809 | 100 | GfxContext.PopClippingRectangle (); | 100 | graphics_engine.PopClippingRectangle(); |
810 | 101 | } | 101 | } |
811 | 102 | 102 | ||
812 | 103 | void AbstractComboBox::DrawContent (GraphicsEngine &GfxContext, bool force_draw) | 103 | void AbstractComboBox::DrawContent(GraphicsEngine &graphics_engine, bool force_draw) |
813 | 104 | { | 104 | { |
814 | 105 | 105 | ||
815 | 106 | } | 106 | } |
816 | 107 | 107 | ||
817 | 108 | void AbstractComboBox::PostDraw (GraphicsEngine &GfxContext, bool force_draw) | 108 | void AbstractComboBox::PostDraw(GraphicsEngine &graphics_engine, bool force_draw) |
818 | 109 | { | 109 | { |
819 | 110 | 110 | ||
820 | 111 | } | 111 | } |
821 | 112 | 112 | ||
822 | 113 | void AbstractComboBox::RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags) | 113 | void AbstractComboBox::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags) |
823 | 114 | { | 114 | { |
824 | 115 | QueueDraw(); | 115 | QueueDraw(); |
825 | 116 | } | 116 | } |
826 | 117 | 117 | ||
828 | 118 | void AbstractComboBox::RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags) | 118 | void AbstractComboBox::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags) |
829 | 119 | { | 119 | { |
830 | 120 | QueueDraw(); | 120 | QueueDraw(); |
831 | 121 | } | 121 | } |
832 | 122 | 122 | ||
833 | === modified file 'Nux/AbstractComboBox.h' | |||
834 | --- Nux/AbstractComboBox.h 2011-04-06 21:54:09 +0000 | |||
835 | +++ Nux/AbstractComboBox.h 2011-10-25 21:32:25 +0000 | |||
836 | @@ -31,18 +31,17 @@ | |||
837 | 31 | class AbstractComboBox: public View | 31 | class AbstractComboBox: public View |
838 | 32 | { | 32 | { |
839 | 33 | public: | 33 | public: |
841 | 34 | AbstractComboBox (NUX_FILE_LINE_PROTO); | 34 | AbstractComboBox(NUX_FILE_LINE_PROTO); |
842 | 35 | virtual ~AbstractComboBox(); | 35 | virtual ~AbstractComboBox(); |
843 | 36 | 36 | ||
853 | 37 | virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) = 0; | 37 | virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw); |
854 | 38 | virtual void Draw (GraphicsEngine &GfxContext, bool force_draw); | 38 | virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw); |
855 | 39 | virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw); | 39 | virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw); |
856 | 40 | virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw); | 40 | |
857 | 41 | 41 | void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags); | |
858 | 42 | void RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags); | 42 | void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags); |
859 | 43 | void RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags); | 43 | |
860 | 44 | 44 | StaticText * GetStaticText() | |
852 | 45 | StaticText * GetStaticText () | ||
861 | 46 | { | 45 | { |
862 | 47 | return _pango_static_text; | 46 | return _pango_static_text; |
863 | 48 | } | 47 | } |
864 | 49 | 48 | ||
865 | === modified file 'Nux/AbstractPaintLayer.cpp' | |||
866 | --- Nux/AbstractPaintLayer.cpp 2011-09-20 06:03:43 +0000 | |||
867 | +++ Nux/AbstractPaintLayer.cpp 2011-10-25 21:32:25 +0000 | |||
868 | @@ -4,33 +4,33 @@ | |||
869 | 4 | 4 | ||
870 | 5 | namespace nux | 5 | namespace nux |
871 | 6 | { | 6 | { |
900 | 7 | AbstractPaintLayer::AbstractPaintLayer () | 7 | AbstractPaintLayer::AbstractPaintLayer() |
901 | 8 | { | 8 | { |
902 | 9 | 9 | ||
903 | 10 | } | 10 | } |
904 | 11 | 11 | ||
905 | 12 | AbstractPaintLayer::~AbstractPaintLayer () | 12 | AbstractPaintLayer::~AbstractPaintLayer() |
906 | 13 | { | 13 | { |
907 | 14 | 14 | ||
908 | 15 | } | 15 | } |
909 | 16 | 16 | ||
910 | 17 | void AbstractPaintLayer::SetGeometry (const Geometry &geo) | 17 | void AbstractPaintLayer::SetGeometry(const Geometry &geo) |
911 | 18 | { | 18 | { |
912 | 19 | _geometry = geo; | 19 | geometry_ = geo; |
913 | 20 | } | 20 | } |
914 | 21 | 21 | ||
915 | 22 | Geometry const& AbstractPaintLayer::GetGeometry () const | 22 | Geometry const& AbstractPaintLayer::GetGeometry() const |
916 | 23 | { | 23 | { |
917 | 24 | return _geometry; | 24 | return geometry_; |
918 | 25 | } | 25 | } |
919 | 26 | 26 | ||
920 | 27 | void AbstractPaintLayer::SetModelViewMatrix (const Matrix4 &mat) | 27 | void AbstractPaintLayer::SetModelViewMatrix(const Matrix4 &mat) |
921 | 28 | { | 28 | { |
922 | 29 | _model_view_matrix = mat; | 29 | model_view_matrix_ = mat; |
923 | 30 | } | 30 | } |
924 | 31 | 31 | ||
925 | 32 | Matrix4 AbstractPaintLayer::GetModelViewMatrix () | 32 | Matrix4 AbstractPaintLayer::GetModelViewMatrix() |
926 | 33 | { | 33 | { |
927 | 34 | return _model_view_matrix; | 34 | return model_view_matrix_; |
928 | 35 | } | 35 | } |
929 | 36 | } | 36 | } |
930 | 37 | 37 | ||
931 | === modified file 'Nux/AbstractPaintLayer.h' | |||
932 | --- Nux/AbstractPaintLayer.h 2011-09-20 06:03:43 +0000 | |||
933 | +++ Nux/AbstractPaintLayer.h 2011-10-25 21:32:25 +0000 | |||
934 | @@ -40,24 +40,24 @@ | |||
935 | 40 | PaintLayer_ImageStyle, | 40 | PaintLayer_ImageStyle, |
936 | 41 | }; | 41 | }; |
937 | 42 | 42 | ||
945 | 43 | AbstractPaintLayer (); | 43 | AbstractPaintLayer(); |
946 | 44 | virtual ~AbstractPaintLayer (); | 44 | virtual ~AbstractPaintLayer(); |
947 | 45 | virtual AbstractPaintLayer *Clone () const = 0; //Virtual Constructor Idiom | 45 | virtual AbstractPaintLayer *Clone() const = 0; //Virtual Constructor Idiom |
948 | 46 | 46 | ||
949 | 47 | virtual void Renderlayer (GraphicsEngine &GfxContext) = 0; | 47 | virtual void Renderlayer(GraphicsEngine &graphics_engine) = 0; |
950 | 48 | 48 | ||
951 | 49 | virtual void SetGeometry (const Geometry &geo); | 49 | virtual void SetGeometry(const Geometry &geo); |
952 | 50 | 50 | ||
953 | 51 | //! Preserve the model view matrix at the moment layer is pushed on the paint layer stack. See Painter class. | 51 | //! Preserve the model view matrix at the moment layer is pushed on the paint layer stack. See Painter class. |
955 | 52 | void SetModelViewMatrix (const Matrix4 &mat); | 52 | void SetModelViewMatrix(const Matrix4 &mat); |
956 | 53 | 53 | ||
958 | 54 | Matrix4 GetModelViewMatrix (); | 54 | Matrix4 GetModelViewMatrix(); |
959 | 55 | 55 | ||
960 | 56 | Geometry const& GetGeometry() const; | 56 | Geometry const& GetGeometry() const; |
961 | 57 | 57 | ||
962 | 58 | protected: | 58 | protected: |
965 | 59 | Geometry _geometry; | 59 | Geometry geometry_; |
966 | 60 | Matrix4 _model_view_matrix; | 60 | Matrix4 model_view_matrix_; |
967 | 61 | }; | 61 | }; |
968 | 62 | 62 | ||
969 | 63 | } | 63 | } |
970 | 64 | 64 | ||
971 | === removed file 'Nux/AbstractRadioButton.cpp' | |||
972 | --- Nux/AbstractRadioButton.cpp 2011-08-17 02:27:23 +0000 | |||
973 | +++ Nux/AbstractRadioButton.cpp 1970-01-01 00:00:00 +0000 | |||
974 | @@ -1,41 +0,0 @@ | |||
975 | 1 | /* | ||
976 | 2 | * Copyright 2010 Inalogic® Inc. | ||
977 | 3 | * | ||
978 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
979 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
980 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
981 | 7 | * of the License. | ||
982 | 8 | * | ||
983 | 9 | * This program is distributed in the hope that it will be useful, but | ||
984 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
985 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
986 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
987 | 13 | * License for more details. | ||
988 | 14 | * | ||
989 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
990 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
991 | 17 | * | ||
992 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
993 | 19 | * | ||
994 | 20 | */ | ||
995 | 21 | |||
996 | 22 | #include "Nux.h" | ||
997 | 23 | |||
998 | 24 | #include "AbstractRadioButton.h" | ||
999 | 25 | #include "HLayout.h" | ||
1000 | 26 | |||
1001 | 27 | namespace nux | ||
1002 | 28 | { | ||
1003 | 29 | NUX_IMPLEMENT_OBJECT_TYPE(AbstractRadioButton); | ||
1004 | 30 | |||
1005 | 31 | AbstractRadioButton::AbstractRadioButton (const TCHAR *Caption, NUX_FILE_LINE_DECL) | ||
1006 | 32 | : View (NUX_FILE_LINE_PARAM) | ||
1007 | 33 | { | ||
1008 | 34 | _state = false; | ||
1009 | 35 | } | ||
1010 | 36 | |||
1011 | 37 | AbstractRadioButton::~AbstractRadioButton() | ||
1012 | 38 | { | ||
1013 | 39 | |||
1014 | 40 | } | ||
1015 | 41 | } | ||
1016 | 42 | 0 | ||
1017 | === removed file 'Nux/AbstractRadioButton.h' | |||
1018 | --- Nux/AbstractRadioButton.h 2011-08-17 02:27:23 +0000 | |||
1019 | +++ Nux/AbstractRadioButton.h 1970-01-01 00:00:00 +0000 | |||
1020 | @@ -1,48 +0,0 @@ | |||
1021 | 1 | /* | ||
1022 | 2 | * Copyright 2010 Inalogic® Inc. | ||
1023 | 3 | * | ||
1024 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1025 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
1026 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
1027 | 7 | * of the License. | ||
1028 | 8 | * | ||
1029 | 9 | * This program is distributed in the hope that it will be useful, but | ||
1030 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1031 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
1032 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
1033 | 13 | * License for more details. | ||
1034 | 14 | * | ||
1035 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
1036 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
1037 | 17 | * | ||
1038 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
1039 | 19 | * | ||
1040 | 20 | */ | ||
1041 | 21 | |||
1042 | 22 | |||
1043 | 23 | #ifndef ABSTRACTRADIOBUTTON_H | ||
1044 | 24 | #define ABSTRACTRADIOBUTTON_H | ||
1045 | 25 | |||
1046 | 26 | namespace nux | ||
1047 | 27 | { | ||
1048 | 28 | //! The base class of Button, CheckBox, RadioButton and PushButton. | ||
1049 | 29 | class AbstractRadioButton : public View | ||
1050 | 30 | { | ||
1051 | 31 | NUX_DECLARE_OBJECT_TYPE (AbstractRadioButton, View); | ||
1052 | 32 | public: | ||
1053 | 33 | AbstractRadioButton (const TCHAR *Caption = TEXT (""), NUX_FILE_LINE_PROTO); | ||
1054 | 34 | ~AbstractRadioButton(); | ||
1055 | 35 | |||
1056 | 36 | virtual void SetCaption (const TCHAR *Caption) = 0; | ||
1057 | 37 | virtual const NString &GetCaption() const = 0; | ||
1058 | 38 | |||
1059 | 39 | virtual void SetState (bool b) = 0; | ||
1060 | 40 | virtual void SetState (bool State, bool EmitSignal) = 0; | ||
1061 | 41 | virtual bool GetState() const = 0; | ||
1062 | 42 | |||
1063 | 43 | protected: | ||
1064 | 44 | bool _state; | ||
1065 | 45 | }; | ||
1066 | 46 | } | ||
1067 | 47 | |||
1068 | 48 | #endif // ABSTRACTRADIOBUTTON_H | ||
1069 | 49 | 0 | ||
1070 | === removed file 'Nux/AbstractSeparator.cpp' | |||
1071 | --- Nux/AbstractSeparator.cpp 2011-04-06 21:54:09 +0000 | |||
1072 | +++ Nux/AbstractSeparator.cpp 1970-01-01 00:00:00 +0000 | |||
1073 | @@ -1,70 +0,0 @@ | |||
1074 | 1 | /* | ||
1075 | 2 | * Copyright 2010 Inalogic® Inc. | ||
1076 | 3 | * | ||
1077 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1078 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
1079 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
1080 | 7 | * of the License. | ||
1081 | 8 | * | ||
1082 | 9 | * This program is distributed in the hope that it will be useful, but | ||
1083 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1084 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
1085 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
1086 | 13 | * License for more details. | ||
1087 | 14 | * | ||
1088 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
1089 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
1090 | 17 | * | ||
1091 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
1092 | 19 | * | ||
1093 | 20 | */ | ||
1094 | 21 | |||
1095 | 22 | |||
1096 | 23 | #include "Nux.h" | ||
1097 | 24 | |||
1098 | 25 | #include "AbstractSeparator.h" | ||
1099 | 26 | |||
1100 | 27 | namespace nux | ||
1101 | 28 | { | ||
1102 | 29 | |||
1103 | 30 | AbstractSeparator::AbstractSeparator (NUX_FILE_LINE_DECL) | ||
1104 | 31 | : View (NUX_FILE_LINE_PARAM) | ||
1105 | 32 | , m_Color (0xFF888888) | ||
1106 | 33 | , m_Alpha0 (0.0f) | ||
1107 | 34 | , m_Alpha1 (0.592f) | ||
1108 | 35 | , m_BorderSize (10) | ||
1109 | 36 | { | ||
1110 | 37 | |||
1111 | 38 | } | ||
1112 | 39 | |||
1113 | 40 | AbstractSeparator::AbstractSeparator (const Color &color, float Alpha0, float Alpha1, int Border, NUX_FILE_LINE_DECL) | ||
1114 | 41 | : View (NUX_FILE_LINE_PARAM) | ||
1115 | 42 | , m_Color (color) | ||
1116 | 43 | , m_Alpha0 (Alpha0) | ||
1117 | 44 | , m_Alpha1 (Alpha1) | ||
1118 | 45 | , m_BorderSize (Border) | ||
1119 | 46 | { | ||
1120 | 47 | |||
1121 | 48 | } | ||
1122 | 49 | |||
1123 | 50 | AbstractSeparator::~AbstractSeparator() | ||
1124 | 51 | { | ||
1125 | 52 | |||
1126 | 53 | } | ||
1127 | 54 | |||
1128 | 55 | void AbstractSeparator::SetColor (const Color &color) | ||
1129 | 56 | { | ||
1130 | 57 | m_Color = color; | ||
1131 | 58 | } | ||
1132 | 59 | |||
1133 | 60 | void AbstractSeparator::SetAlpha (float Alpha0, float Alpha1) | ||
1134 | 61 | { | ||
1135 | 62 | m_Alpha0 = Alpha0; | ||
1136 | 63 | m_Alpha1 = Alpha1; | ||
1137 | 64 | } | ||
1138 | 65 | |||
1139 | 66 | void AbstractSeparator::SetBorderSize (int Border) | ||
1140 | 67 | { | ||
1141 | 68 | m_BorderSize = Border; | ||
1142 | 69 | } | ||
1143 | 70 | } | ||
1144 | 71 | 0 | ||
1145 | === removed file 'Nux/AbstractSeparator.h' | |||
1146 | --- Nux/AbstractSeparator.h 2011-04-06 21:54:09 +0000 | |||
1147 | +++ Nux/AbstractSeparator.h 1970-01-01 00:00:00 +0000 | |||
1148 | @@ -1,48 +0,0 @@ | |||
1149 | 1 | /* | ||
1150 | 2 | * Copyright 2010 Inalogic® Inc. | ||
1151 | 3 | * | ||
1152 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1153 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
1154 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
1155 | 7 | * of the License. | ||
1156 | 8 | * | ||
1157 | 9 | * This program is distributed in the hope that it will be useful, but | ||
1158 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1159 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
1160 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
1161 | 13 | * License for more details. | ||
1162 | 14 | * | ||
1163 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
1164 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
1165 | 17 | * | ||
1166 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
1167 | 19 | * | ||
1168 | 20 | */ | ||
1169 | 21 | |||
1170 | 22 | |||
1171 | 23 | #ifndef ABSTRACTSEPARATOR_H | ||
1172 | 24 | #define ABSTRACTSEPARATOR_H | ||
1173 | 25 | |||
1174 | 26 | namespace nux | ||
1175 | 27 | { | ||
1176 | 28 | |||
1177 | 29 | class AbstractSeparator: public View | ||
1178 | 30 | { | ||
1179 | 31 | public: | ||
1180 | 32 | AbstractSeparator (NUX_FILE_LINE_PROTO); | ||
1181 | 33 | AbstractSeparator (const Color &color, float Alpha0, float Alpha1, int Border, NUX_FILE_LINE_PROTO); | ||
1182 | 34 | ~AbstractSeparator(); | ||
1183 | 35 | void SetColor (const Color &color); | ||
1184 | 36 | void SetAlpha (float Alpha0, float Alpha1); | ||
1185 | 37 | void SetBorderSize (int Border); | ||
1186 | 38 | |||
1187 | 39 | protected: | ||
1188 | 40 | Color m_Color; | ||
1189 | 41 | float m_Alpha0; | ||
1190 | 42 | float m_Alpha1; | ||
1191 | 43 | int m_BorderSize; | ||
1192 | 44 | }; | ||
1193 | 45 | |||
1194 | 46 | } | ||
1195 | 47 | |||
1196 | 48 | #endif // ABSTRACTSEPARATOR_H | ||
1197 | 49 | 0 | ||
1198 | === modified file 'Nux/AbstractThread.cpp' | |||
1199 | --- Nux/AbstractThread.cpp 2011-04-06 21:54:09 +0000 | |||
1200 | +++ Nux/AbstractThread.cpp 2011-10-25 21:32:25 +0000 | |||
1201 | @@ -26,12 +26,12 @@ | |||
1202 | 26 | namespace nux | 26 | namespace nux |
1203 | 27 | { | 27 | { |
1204 | 28 | 28 | ||
1206 | 29 | NUX_IMPLEMENT_OBJECT_TYPE (AbstractThread); | 29 | NUX_IMPLEMENT_OBJECT_TYPE(AbstractThread); |
1207 | 30 | 30 | ||
1212 | 31 | AbstractThread::AbstractThread (AbstractThread *Parent) | 31 | AbstractThread::AbstractThread(AbstractThread *Parent) |
1213 | 32 | : m_Parent (Parent) | 32 | : m_Parent(Parent) |
1214 | 33 | , m_UserInitFunc (0) | 33 | , m_UserInitFunc(0) |
1215 | 34 | , m_UserExitFunc (0) | 34 | , m_UserExitFunc(0) |
1216 | 35 | { | 35 | { |
1217 | 36 | 36 | ||
1218 | 37 | } | 37 | } |
1219 | 38 | 38 | ||
1220 | === modified file 'Nux/AbstractThread.h' | |||
1221 | --- Nux/AbstractThread.h 2011-04-06 21:54:09 +0000 | |||
1222 | +++ Nux/AbstractThread.h 2011-10-25 21:32:25 +0000 | |||
1223 | @@ -26,25 +26,25 @@ | |||
1224 | 26 | namespace nux | 26 | namespace nux |
1225 | 27 | { | 27 | { |
1226 | 28 | 28 | ||
1230 | 29 | typedef void (*ThreadUserInitFunc) (NThread *, void *InitData); | 29 | typedef void(*ThreadUserInitFunc) (NThread *, void *InitData); |
1231 | 30 | typedef void (*ThreadUserExitFunc) (NThread *, void *ExitData); | 30 | typedef void(*ThreadUserExitFunc) (NThread *, void *ExitData); |
1232 | 31 | typedef void (*ThreadMainFunc) (NThread *, void *MainData); | 31 | typedef void(*ThreadMainFunc) (NThread *, void *MainData); |
1233 | 32 | 32 | ||
1234 | 33 | class AbstractThread: public NThread, public sigc::trackable | 33 | class AbstractThread: public NThread, public sigc::trackable |
1235 | 34 | { | 34 | { |
1237 | 35 | NUX_DECLARE_OBJECT_TYPE (AbstractThread, NThread); | 35 | NUX_DECLARE_OBJECT_TYPE(AbstractThread, NThread); |
1238 | 36 | 36 | ||
1239 | 37 | public: | 37 | public: |
1241 | 38 | AbstractThread (AbstractThread *Parent); | 38 | AbstractThread(AbstractThread *Parent); |
1242 | 39 | virtual ~AbstractThread(); | 39 | virtual ~AbstractThread(); |
1243 | 40 | 40 | ||
1244 | 41 | protected: | 41 | protected: |
1246 | 42 | virtual unsigned int Run (void *) = 0; | 42 | virtual unsigned int Run(void *) = 0; |
1247 | 43 | 43 | ||
1252 | 44 | virtual ThreadState StartChildThread (NThread *thread, bool Modal) = 0; | 44 | virtual ThreadState StartChildThread(NThread *thread, bool Modal) = 0; |
1253 | 45 | virtual void AddChildThread (NThread *) = 0; | 45 | virtual void AddChildThread(NThread *) = 0; |
1254 | 46 | virtual void RemoveChildThread (NThread *) = 0; | 46 | virtual void RemoveChildThread(NThread *) = 0; |
1255 | 47 | virtual void ChildHasFinished (NThread *app) = 0; | 47 | virtual void ChildHasFinished(NThread *app) = 0; |
1256 | 48 | virtual void TerminateAllChildThread() = 0; | 48 | virtual void TerminateAllChildThread() = 0; |
1257 | 49 | 49 | ||
1258 | 50 | std::list<NThread *> m_ChildThread; | 50 | std::list<NThread *> m_ChildThread; |
1259 | @@ -61,7 +61,7 @@ | |||
1260 | 61 | std::list<NThread *> m_ThreadList; | 61 | std::list<NThread *> m_ThreadList; |
1261 | 62 | 62 | ||
1262 | 63 | private: | 63 | private: |
1264 | 64 | AbstractThread (const AbstractThread &); | 64 | AbstractThread(const AbstractThread &); |
1265 | 65 | // Does not make sense for a singleton. This is a self assignment. | 65 | // Does not make sense for a singleton. This is a self assignment. |
1266 | 66 | AbstractThread &operator= (const AbstractThread &); | 66 | AbstractThread &operator= (const AbstractThread &); |
1267 | 67 | // Declare operator adress-of as private | 67 | // Declare operator adress-of as private |
1268 | 68 | 68 | ||
1269 | === modified file 'Nux/ActionItem.cpp' | |||
1270 | --- Nux/ActionItem.cpp 2011-09-20 06:03:43 +0000 | |||
1271 | +++ Nux/ActionItem.cpp 2011-10-25 21:32:25 +0000 | |||
1272 | @@ -27,86 +27,86 @@ | |||
1273 | 27 | namespace nux | 27 | namespace nux |
1274 | 28 | { | 28 | { |
1275 | 29 | 29 | ||
1277 | 30 | NUX_IMPLEMENT_OBJECT_TYPE (ActionItem); | 30 | NUX_IMPLEMENT_OBJECT_TYPE(ActionItem); |
1278 | 31 | 31 | ||
1286 | 32 | ActionItem::ActionItem (const TCHAR *label, int UserValue, NUX_FILE_LINE_DECL) | 32 | ActionItem::ActionItem(const char *label, int UserValue, NUX_FILE_LINE_DECL) |
1287 | 33 | : Object (true, NUX_FILE_LINE_PARAM) | 33 | : Object(true, NUX_FILE_LINE_PARAM) |
1288 | 34 | , m_UserValue (UserValue) | 34 | , m_UserValue(UserValue) |
1289 | 35 | , m_Label (TEXT ("") ) | 35 | , m_Label("") |
1290 | 36 | , m_IsActivated (true) | 36 | , m_IsActivated(true) |
1291 | 37 | , m_Menu (0) | 37 | , m_Menu(0) |
1292 | 38 | , m_Enable (true) | 38 | , m_Enable(true) |
1293 | 39 | { | 39 | { |
1294 | 40 | m_Icon = 0; | 40 | m_Icon = 0; |
1296 | 41 | SetLabel (label); | 41 | SetLabel(label); |
1297 | 42 | } | 42 | } |
1298 | 43 | 43 | ||
1299 | 44 | ActionItem::~ActionItem() | 44 | ActionItem::~ActionItem() |
1300 | 45 | { | 45 | { |
1302 | 46 | if(m_Icon) | 46 | if (m_Icon) |
1303 | 47 | m_Icon->UnReference(); | 47 | m_Icon->UnReference(); |
1304 | 48 | } | 48 | } |
1305 | 49 | 49 | ||
1307 | 50 | void ActionItem::DrawAsMenuItem (GraphicsEngine &GfxContext, InputArea &area, bool is_highlighted, bool draw_icone) | 50 | void ActionItem::DrawAsMenuItem(GraphicsEngine &graphics_engine, InputArea &area, bool is_highlighted, bool draw_icone) |
1308 | 51 | { | 51 | { |
1309 | 52 | Geometry geo = area.GetGeometry(); | 52 | Geometry geo = area.GetGeometry(); |
1311 | 53 | Geometry icon_geo (0, 0, 20, 20); | 53 | Geometry icon_geo(0, 0, 20, 20); |
1312 | 54 | Geometry text_geo = geo; | 54 | Geometry text_geo = geo; |
1313 | 55 | 55 | ||
1321 | 56 | text_geo.OffsetPosition (24, 2); | 56 | text_geo.OffsetPosition(24, 2); |
1322 | 57 | text_geo.OffsetSize (2 * 24, 2 * 2); | 57 | text_geo.OffsetSize(2 * 24, 2 * 2); |
1323 | 58 | 58 | ||
1324 | 59 | icon_geo.SetX (geo.x + 2); | 59 | icon_geo.SetX(geo.x + 2); |
1325 | 60 | icon_geo.SetY (geo.y + 2); | 60 | icon_geo.SetY(geo.y + 2); |
1326 | 61 | 61 | ||
1327 | 62 | const TCHAR *label = GetLabel(); | 62 | const char *label = GetLabel(); |
1328 | 63 | 63 | ||
1329 | 64 | if (is_highlighted) | 64 | if (is_highlighted) |
1330 | 65 | { | 65 | { |
1332 | 66 | GetPainter().Paint2DQuadColor (GfxContext, geo, Color (COLOR_FOREGROUND_SECONDARY) ); | 66 | GetPainter().Paint2DQuadColor(graphics_engine, geo, Color(COLOR_FOREGROUND_SECONDARY)); |
1333 | 67 | } | 67 | } |
1334 | 68 | 68 | ||
1337 | 69 | if(m_Icon) | 69 | if (m_Icon) |
1338 | 70 | GetPainter().Draw2DTextureAligned (GfxContext, m_Icon, icon_geo, TextureAlignmentStyle (eTACenter, eTACenter) ); | 70 | GetPainter().Draw2DTextureAligned(graphics_engine, m_Icon, icon_geo, TextureAlignmentStyle(eTACenter, eTACenter)); |
1339 | 71 | 71 | ||
1341 | 72 | GetPainter().PaintTextLineStatic (GfxContext, GetSysFont(), text_geo, std::string (label), Color (0xFF000000), eAlignTextLeft); | 72 | GetPainter().PaintTextLineStatic(graphics_engine, GetSysFont(), text_geo, std::string(label), Color(0xFF000000), eAlignTextLeft); |
1342 | 73 | } | 73 | } |
1343 | 74 | 74 | ||
1345 | 75 | void ActionItem::DrawAsToolButton (GraphicsEngine &GfxContext, InputArea &area) | 75 | void ActionItem::DrawAsToolButton(GraphicsEngine &graphics_engine, InputArea &area) |
1346 | 76 | { | 76 | { |
1347 | 77 | Geometry base = area.GetGeometry(); | 77 | Geometry base = area.GetGeometry(); |
1348 | 78 | 78 | ||
1350 | 79 | if (area.IsMouseOwner() ) | 79 | if (area.IsMouseOwner()) |
1351 | 80 | { | 80 | { |
1353 | 81 | if (area.IsMouseInside() ) | 81 | if (area.IsMouseInside()) |
1354 | 82 | { | 82 | { |
1357 | 83 | GetPainter().PaintShape (GfxContext, base, Color (COLOR_BACKGROUND_SECONDARY), eSHAPE_CORNER_ROUND2); | 83 | GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY), eSHAPE_CORNER_ROUND2); |
1358 | 84 | GetPainter().PaintShape (GfxContext, base, Color (COLOR_BLACK), eSTROKE_CORNER_ROUND2); | 84 | GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BLACK), eSTROKE_CORNER_ROUND2); |
1359 | 85 | } | 85 | } |
1360 | 86 | else | 86 | else |
1361 | 87 | { | 87 | { |
1364 | 88 | GetPainter().PaintShape (GfxContext, base, Color (COLOR_FOREGROUND_PRIMARY), eSHAPE_CORNER_ROUND2); | 88 | GetPainter().PaintShape(graphics_engine, base, Color(COLOR_FOREGROUND_PRIMARY), eSHAPE_CORNER_ROUND2); |
1365 | 89 | GetPainter().PaintShape (GfxContext, base, Color (COLOR_BLACK), eSTROKE_CORNER_ROUND2); | 89 | GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BLACK), eSTROKE_CORNER_ROUND2); |
1366 | 90 | } | 90 | } |
1367 | 91 | } | 91 | } |
1368 | 92 | else | 92 | else |
1369 | 93 | { | 93 | { |
1371 | 94 | if (area.IsMouseInside() && (!area.MouseFocusOnOtherArea() ) ) | 94 | if (area.IsMouseInside() && (!area.MouseFocusOnOtherArea())) |
1372 | 95 | { | 95 | { |
1375 | 96 | GetPainter().PaintShape (GfxContext, base, Color (COLOR_FOREGROUND_PRIMARY), eSHAPE_CORNER_ROUND2); | 96 | GetPainter().PaintShape(graphics_engine, base, Color(COLOR_FOREGROUND_PRIMARY), eSHAPE_CORNER_ROUND2); |
1376 | 97 | GetPainter().PaintShape (GfxContext, base, Color (COLOR_BLACK), eSTROKE_CORNER_ROUND2); | 97 | GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BLACK), eSTROKE_CORNER_ROUND2); |
1377 | 98 | } | 98 | } |
1378 | 99 | else | 99 | else |
1379 | 100 | { | 100 | { |
1382 | 101 | GetPainter().PaintShape (GfxContext, base, Color (COLOR_BACKGROUND_SECONDARY), eSHAPE_CORNER_ROUND2); | 101 | GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY), eSHAPE_CORNER_ROUND2); |
1383 | 102 | GetPainter().PaintShape (GfxContext, base, Color (COLOR_BLACK), eSTROKE_CORNER_ROUND2); | 102 | GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BLACK), eSTROKE_CORNER_ROUND2); |
1384 | 103 | } | 103 | } |
1385 | 104 | } | 104 | } |
1386 | 105 | 105 | ||
1388 | 106 | GetPainter().Draw2DTextureAligned (GfxContext, m_Icon, base, TextureAlignmentStyle (eTACenter, eTACenter) ); | 106 | GetPainter().Draw2DTextureAligned(graphics_engine, m_Icon, base, TextureAlignmentStyle(eTACenter, eTACenter)); |
1389 | 107 | } | 107 | } |
1390 | 108 | 108 | ||
1392 | 109 | void ActionItem::Activate (bool b) | 109 | void ActionItem::Activate(bool b) |
1393 | 110 | { | 110 | { |
1394 | 111 | m_IsActivated = b; | 111 | m_IsActivated = b; |
1395 | 112 | } | 112 | } |
1396 | @@ -116,7 +116,7 @@ | |||
1397 | 116 | sigAction.emit(); | 116 | sigAction.emit(); |
1398 | 117 | } | 117 | } |
1399 | 118 | 118 | ||
1401 | 119 | void ActionItem::Enable (bool b) | 119 | void ActionItem::Enable(bool b) |
1402 | 120 | { | 120 | { |
1403 | 121 | m_Enable = b; | 121 | m_Enable = b; |
1404 | 122 | } | 122 | } |
1405 | @@ -126,19 +126,19 @@ | |||
1406 | 126 | return m_Enable; | 126 | return m_Enable; |
1407 | 127 | } | 127 | } |
1408 | 128 | 128 | ||
1410 | 129 | void ActionItem::SetLabel (const TCHAR *label) | 129 | void ActionItem::SetLabel(const char *label) |
1411 | 130 | { | 130 | { |
1412 | 131 | m_Label = label; | 131 | m_Label = label; |
1413 | 132 | } | 132 | } |
1414 | 133 | 133 | ||
1416 | 134 | const TCHAR *ActionItem::GetLabel() const | 134 | const char *ActionItem::GetLabel() const |
1417 | 135 | { | 135 | { |
1418 | 136 | return m_Label.GetTCharPtr(); | 136 | return m_Label.GetTCharPtr(); |
1419 | 137 | } | 137 | } |
1420 | 138 | 138 | ||
1422 | 139 | void ActionItem::SetIcon (const BaseTexture* icon) | 139 | void ActionItem::SetIcon(const BaseTexture* icon) |
1423 | 140 | { | 140 | { |
1425 | 141 | if(m_Icon) | 141 | if (m_Icon) |
1426 | 142 | m_Icon->UnReference(); | 142 | m_Icon->UnReference(); |
1427 | 143 | m_Icon = icon->Clone(); | 143 | m_Icon = icon->Clone(); |
1428 | 144 | } | 144 | } |
1429 | 145 | 145 | ||
1430 | === modified file 'Nux/AnimatedTextureArea.cpp' | |||
1431 | --- Nux/AnimatedTextureArea.cpp 2011-09-20 06:03:43 +0000 | |||
1432 | +++ Nux/AnimatedTextureArea.cpp 2011-10-25 21:32:25 +0000 | |||
1433 | @@ -27,113 +27,108 @@ | |||
1434 | 27 | namespace nux | 27 | namespace nux |
1435 | 28 | { | 28 | { |
1436 | 29 | 29 | ||
1440 | 30 | AnimatedTextureArea::AnimatedTextureArea (NUX_FILE_LINE_DECL) | 30 | AnimatedTextureArea::AnimatedTextureArea(NUX_FILE_LINE_DECL) |
1441 | 31 | : View (NUX_FILE_LINE_PARAM) | 31 | : View(NUX_FILE_LINE_PARAM) |
1442 | 32 | , m_UserTexture (0) | 32 | , m_UserTexture(0) |
1443 | 33 | { | 33 | { |
1445 | 34 | SetMinMaxSize (32, 32); | 34 | SetMinMaxSize(32, 32); |
1446 | 35 | 35 | ||
1449 | 36 | mouse_down.connect (sigc::mem_fun (this, &AnimatedTextureArea::RecvMouseDown) ); | 36 | mouse_down.connect(sigc::mem_fun(this, &AnimatedTextureArea::RecvMouseDown)); |
1450 | 37 | mouse_drag.connect (sigc::mem_fun (this, &AnimatedTextureArea::RecvMouseDrag) ); | 37 | mouse_drag.connect(sigc::mem_fun(this, &AnimatedTextureArea::RecvMouseDrag)); |
1451 | 38 | 38 | ||
1452 | 39 | m_TimerFunctor = new TimerFunctor(); | 39 | m_TimerFunctor = new TimerFunctor(); |
1454 | 40 | m_TimerFunctor->OnTimerExpired.connect (sigc::mem_fun (this, &AnimatedTextureArea::TimerNextFrame) ); | 40 | m_TimerFunctor->time_expires.connect(sigc::mem_fun(this, &AnimatedTextureArea::TimerNextFrame)); |
1455 | 41 | } | 41 | } |
1456 | 42 | 42 | ||
1457 | 43 | AnimatedTextureArea::~AnimatedTextureArea() | 43 | AnimatedTextureArea::~AnimatedTextureArea() |
1458 | 44 | { | 44 | { |
1460 | 45 | GetTimer().RemoveTimerHandler (m_TimerHandler); | 45 | GetTimer().RemoveTimerHandler(m_TimerHandler); |
1461 | 46 | m_TimerHandler = 0; | 46 | m_TimerHandler = 0; |
1462 | 47 | delete m_TimerFunctor; | 47 | delete m_TimerFunctor; |
1463 | 48 | m_TimerFunctor = 0; | 48 | m_TimerFunctor = 0; |
1464 | 49 | } | 49 | } |
1465 | 50 | 50 | ||
1472 | 51 | long AnimatedTextureArea::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) | 51 | void AnimatedTextureArea::Draw(GraphicsEngine &graphics_engine, bool force_draw) |
1467 | 52 | { | ||
1468 | 53 | return PostProcessEvent2 (ievent, TraverseInfo, ProcessEventInfo); | ||
1469 | 54 | } | ||
1470 | 55 | |||
1471 | 56 | void AnimatedTextureArea::Draw (GraphicsEngine &GfxContext, bool force_draw) | ||
1473 | 57 | { | 52 | { |
1474 | 58 | if (m_UserTexture) | 53 | if (m_UserTexture) |
1475 | 59 | { | 54 | { |
1478 | 60 | GetPainter().PaintBackground (GfxContext, GetGeometry() ); | 55 | GetPainter().PaintBackground(graphics_engine, GetGeometry()); |
1479 | 61 | GfxContext.GetRenderStates().SetBlend (true, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 56 | graphics_engine.GetRenderStates().SetBlend(true, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
1480 | 62 | nux::Geometry base = GetGeometry(); | 57 | nux::Geometry base = GetGeometry(); |
1481 | 63 | nux::TexCoordXForm texxform; | 58 | nux::TexCoordXForm texxform; |
1483 | 64 | GfxContext.QRP_1Tex (base.x, base.y, base.width, base.height, m_UserTexture->GetDeviceTexture(), texxform, nux::color::White); | 59 | graphics_engine.QRP_1Tex(base.x, base.y, base.width, base.height, m_UserTexture->GetDeviceTexture(), texxform, nux::color::White); |
1484 | 65 | 60 | ||
1486 | 66 | GfxContext.GetRenderStates().SetBlend (false); | 61 | graphics_engine.GetRenderStates().SetBlend(false); |
1487 | 67 | } | 62 | } |
1488 | 68 | } | 63 | } |
1500 | 69 | void AnimatedTextureArea::DrawContent (GraphicsEngine &GfxContext, bool force_draw) | 64 | void AnimatedTextureArea::DrawContent(GraphicsEngine &graphics_engine, bool force_draw) |
1501 | 70 | { | 65 | { |
1502 | 71 | 66 | ||
1503 | 72 | } | 67 | } |
1504 | 73 | 68 | ||
1505 | 74 | void AnimatedTextureArea::PostDraw (GraphicsEngine &GfxContext, bool force_draw) | 69 | void AnimatedTextureArea::PostDraw(GraphicsEngine &graphics_engine, bool force_draw) |
1506 | 75 | { | 70 | { |
1507 | 76 | 71 | ||
1508 | 77 | } | 72 | } |
1509 | 78 | 73 | ||
1510 | 79 | void AnimatedTextureArea::SetTexture (TextureFrameAnimation *Texture) | 74 | void AnimatedTextureArea::SetTexture(TextureFrameAnimation *Texture) |
1511 | 80 | { | 75 | { |
1512 | 81 | m_UserTexture = Texture; | 76 | m_UserTexture = Texture; |
1513 | 82 | 77 | ||
1514 | 83 | if (m_UserTexture) | 78 | if (m_UserTexture) |
1515 | 84 | { | 79 | { |
1517 | 85 | ObjectPtr< CachedTextureFrameAnimation > Texture = GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource (m_UserTexture); | 80 | ObjectPtr< CachedTextureFrameAnimation > Texture = GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource(m_UserTexture); |
1518 | 86 | ObjectPtr<IOpenGLAnimatedTexture> AnimatedTexture = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>(); | 81 | ObjectPtr<IOpenGLAnimatedTexture> AnimatedTexture = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>(); |
1519 | 87 | ObjectPtr<IOpenGLBaseTexture> Texture2D = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>(); | 82 | ObjectPtr<IOpenGLBaseTexture> Texture2D = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>(); |
1520 | 88 | 83 | ||
1523 | 89 | AnimatedTexture->SetFiltering (GL_LINEAR, GL_LINEAR); | 84 | AnimatedTexture->SetFiltering(GL_LINEAR, GL_LINEAR); |
1524 | 90 | AnimatedTexture->SetWrap (GL_CLAMP, GL_CLAMP, GL_CLAMP); | 85 | AnimatedTexture->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP); |
1525 | 91 | } | 86 | } |
1526 | 92 | 87 | ||
1527 | 93 | QueueDraw(); | 88 | QueueDraw(); |
1528 | 94 | } | 89 | } |
1529 | 95 | 90 | ||
1531 | 96 | void AnimatedTextureArea::RecvMouseDown (int x, int y, long button_flags, long key_flags) | 91 | void AnimatedTextureArea::RecvMouseDown(int x, int y, long button_flags, long key_flags) |
1532 | 97 | { | 92 | { |
1534 | 98 | sigMouseDown.emit (x, y); | 93 | sigMouseDown.emit(x, y); |
1535 | 99 | } | 94 | } |
1536 | 100 | 95 | ||
1538 | 101 | void AnimatedTextureArea::RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags) | 96 | void AnimatedTextureArea::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags) |
1539 | 102 | { | 97 | { |
1541 | 103 | sigMouseDrag.emit (x, y); | 98 | sigMouseDrag.emit(x, y); |
1542 | 104 | } | 99 | } |
1543 | 105 | 100 | ||
1544 | 106 | void AnimatedTextureArea::StartAnimation() | 101 | void AnimatedTextureArea::StartAnimation() |
1545 | 107 | { | 102 | { |
1547 | 108 | if (m_TimerHandler.IsValid() ) | 103 | if (m_TimerHandler.IsValid()) |
1548 | 109 | { | 104 | { |
1550 | 110 | GetTimer().RemoveTimerHandler (m_TimerHandler); | 105 | GetTimer().RemoveTimerHandler(m_TimerHandler); |
1551 | 111 | m_TimerHandler = 0; | 106 | m_TimerHandler = 0; |
1552 | 112 | } | 107 | } |
1553 | 113 | 108 | ||
1555 | 114 | m_TimerHandler = GetTimer().AddTimerHandler (41, m_TimerFunctor, 0); | 109 | m_TimerHandler = GetTimer().AddTimerHandler(41, m_TimerFunctor, 0); |
1556 | 115 | QueueDraw(); | 110 | QueueDraw(); |
1557 | 116 | } | 111 | } |
1558 | 117 | 112 | ||
1559 | 118 | void AnimatedTextureArea::StopAnimation() | 113 | void AnimatedTextureArea::StopAnimation() |
1560 | 119 | { | 114 | { |
1562 | 120 | if (m_TimerHandler.IsValid() ) | 115 | if (m_TimerHandler.IsValid()) |
1563 | 121 | { | 116 | { |
1565 | 122 | GetTimer().RemoveTimerHandler (m_TimerHandler); | 117 | GetTimer().RemoveTimerHandler(m_TimerHandler); |
1566 | 123 | m_TimerHandler = 0; | 118 | m_TimerHandler = 0; |
1567 | 124 | } | 119 | } |
1568 | 125 | } | 120 | } |
1569 | 126 | 121 | ||
1571 | 127 | void AnimatedTextureArea::TimerNextFrame (void *v) | 122 | void AnimatedTextureArea::TimerNextFrame(void *v) |
1572 | 128 | { | 123 | { |
1573 | 129 | if (m_UserTexture) | 124 | if (m_UserTexture) |
1574 | 130 | { | 125 | { |
1576 | 131 | ObjectPtr< CachedTextureFrameAnimation > Texture = GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource (m_UserTexture); | 126 | ObjectPtr< CachedTextureFrameAnimation > Texture = GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource(m_UserTexture); |
1577 | 132 | ObjectPtr<IOpenGLAnimatedTexture> AnimatedTexture = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>(); | 127 | ObjectPtr<IOpenGLAnimatedTexture> AnimatedTexture = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>(); |
1578 | 133 | ObjectPtr<IOpenGLBaseTexture> Texture2D = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>(); | 128 | ObjectPtr<IOpenGLBaseTexture> Texture2D = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>(); |
1579 | 134 | 129 | ||
1580 | 135 | AnimatedTexture->PresentNextFrame(); | 130 | AnimatedTexture->PresentNextFrame(); |
1582 | 136 | m_TimerHandler = GetTimer().AddTimerHandler (41, m_TimerFunctor, 0); | 131 | m_TimerHandler = GetTimer().AddTimerHandler(41, m_TimerFunctor, 0); |
1583 | 137 | } | 132 | } |
1584 | 138 | 133 | ||
1585 | 139 | QueueDraw(); | 134 | QueueDraw(); |
1586 | 140 | 135 | ||
1587 | === modified file 'Nux/AnimatedTextureArea.h' | |||
1588 | --- Nux/AnimatedTextureArea.h 2011-09-20 06:03:43 +0000 | |||
1589 | +++ Nux/AnimatedTextureArea.h 2011-10-25 21:32:25 +0000 | |||
1590 | @@ -32,16 +32,15 @@ | |||
1591 | 32 | class AnimatedTextureArea : public View | 32 | class AnimatedTextureArea : public View |
1592 | 33 | { | 33 | { |
1593 | 34 | public: | 34 | public: |
1595 | 35 | AnimatedTextureArea (NUX_FILE_LINE_PROTO); | 35 | AnimatedTextureArea(NUX_FILE_LINE_PROTO); |
1596 | 36 | ~AnimatedTextureArea(); | 36 | ~AnimatedTextureArea(); |
1601 | 37 | virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); | 37 | virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw); |
1602 | 38 | virtual void Draw (GraphicsEngine &GfxContext, bool force_draw); | 38 | virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw); |
1603 | 39 | virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw); | 39 | virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw); |
1600 | 40 | virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw); | ||
1604 | 41 | 40 | ||
1608 | 42 | void SetTexture (TextureFrameAnimation *Texture); | 41 | void SetTexture(TextureFrameAnimation *Texture); |
1609 | 43 | void RecvMouseDown (int x, int y, long button_flags, long key_flags); | 42 | void RecvMouseDown(int x, int y, long button_flags, long key_flags); |
1610 | 44 | void RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); | 43 | void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); |
1611 | 45 | 44 | ||
1612 | 46 | sigc::signal<void, int, int> sigMouseDown; | 45 | sigc::signal<void, int, int> sigMouseDown; |
1613 | 47 | sigc::signal<void, int, int> sigMouseDrag; | 46 | sigc::signal<void, int, int> sigMouseDrag; |
1614 | @@ -51,7 +50,7 @@ | |||
1615 | 51 | 50 | ||
1616 | 52 | 51 | ||
1617 | 53 | private: | 52 | private: |
1619 | 54 | void TimerNextFrame (void *v); | 53 | void TimerNextFrame(void *v); |
1620 | 55 | TimerFunctor *m_TimerFunctor; | 54 | TimerFunctor *m_TimerFunctor; |
1621 | 56 | TimerHandle m_TimerHandler; | 55 | TimerHandle m_TimerHandler; |
1622 | 57 | 56 | ||
1623 | 58 | 57 | ||
1624 | === modified file 'Nux/Area.cpp' | |||
1625 | --- Nux/Area.cpp 2011-09-20 06:03:43 +0000 | |||
1626 | +++ Nux/Area.cpp 2011-10-25 21:32:25 +0000 | |||
1627 | @@ -32,38 +32,37 @@ | |||
1628 | 32 | namespace nux | 32 | namespace nux |
1629 | 33 | { | 33 | { |
1630 | 34 | 34 | ||
1632 | 35 | NUX_IMPLEMENT_OBJECT_TYPE (Area); | 35 | NUX_IMPLEMENT_OBJECT_TYPE(Area); |
1633 | 36 | 36 | ||
1634 | 37 | Area::Area (NUX_FILE_LINE_DECL) | 37 | Area::Area (NUX_FILE_LINE_DECL) |
1640 | 38 | : InitiallyUnownedObject (NUX_FILE_LINE_PARAM) | 38 | : InitiallyUnownedObject(NUX_FILE_LINE_PARAM) |
1641 | 39 | , _is_focused (0) | 39 | , geometry_(0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT) |
1642 | 40 | , _geometry (0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT) | 40 | , min_size_(AREA_MIN_WIDTH, AREA_MIN_HEIGHT) |
1643 | 41 | , _min_size (AREA_MIN_WIDTH, AREA_MIN_HEIGHT) | 41 | , max_size_(AREA_MAX_WIDTH, AREA_MAX_HEIGHT) |
1644 | 42 | , _max_size (AREA_MAX_WIDTH, AREA_MAX_HEIGHT) | 42 | , _direction (GetDefaultDirection()) |
1645 | 43 | { | 43 | { |
1647 | 44 | _parent_area = NULL; | 44 | visible_ = true; |
1648 | 45 | view_enabled_ = true; | ||
1649 | 46 | parent_area_ = NULL; | ||
1650 | 47 | |||
1651 | 45 | next_object_to_key_focus_area_ = NULL; | 48 | next_object_to_key_focus_area_ = NULL; |
1652 | 46 | has_key_focus_ = false; | 49 | has_key_focus_ = false; |
1653 | 47 | 50 | ||
1658 | 48 | _stretch_factor = 1; | 51 | scale_factor_ = 1; |
1659 | 49 | _layout_properties = NULL; | 52 | sensitive_ = true; |
1656 | 50 | _visible = true; | ||
1657 | 51 | _sensitive = true; | ||
1660 | 52 | 53 | ||
1662 | 53 | _on_geometry_changeg_reconfigure_parent_layout = true; | 54 | on_geometry_change_reconfigure_parent_layout_ = true; |
1663 | 54 | _accept_mouse_wheel_event = false; | 55 | _accept_mouse_wheel_event = false; |
1664 | 55 | _accept_keyboard_event = false; | 56 | _accept_keyboard_event = false; |
1665 | 56 | 57 | ||
1668 | 57 | _2d_xform.Identity (); | 58 | _2d_xform.Identity(); |
1669 | 58 | _3d_xform.Identity (); | 59 | _3d_xform.Identity(); |
1670 | 59 | _3d_area = false; | 60 | _3d_area = false; |
1671 | 60 | } | 61 | } |
1672 | 61 | 62 | ||
1673 | 62 | 63 | ||
1674 | 63 | Area::~Area() | 64 | Area::~Area() |
1675 | 64 | { | 65 | { |
1676 | 65 | if (_layout_properties) | ||
1677 | 66 | delete _layout_properties; | ||
1678 | 67 | } | 66 | } |
1679 | 68 | 67 | ||
1680 | 69 | const NString &Area::GetBaseString() const | 68 | const NString &Area::GetBaseString() const |
1681 | @@ -71,362 +70,360 @@ | |||
1682 | 71 | return _base_string; | 70 | return _base_string; |
1683 | 72 | } | 71 | } |
1684 | 73 | 72 | ||
1686 | 74 | void Area::SetBaseString (const TCHAR *Caption) | 73 | void Area::SetBaseString(const char *Caption) |
1687 | 75 | { | 74 | { |
1688 | 76 | _base_string = Caption; | 75 | _base_string = Caption; |
1689 | 77 | } | 76 | } |
1690 | 78 | 77 | ||
1691 | 79 | void Area::CheckMinSize() | 78 | void Area::CheckMinSize() |
1692 | 80 | { | 79 | { |
1694 | 81 | int w = _min_size.width; | 80 | int w = min_size_.width; |
1695 | 82 | w = Max<int>(AREA_MIN_WIDTH, w); | 81 | w = Max<int>(AREA_MIN_WIDTH, w); |
1697 | 83 | int h = _min_size.height; | 82 | int h = min_size_.height; |
1698 | 84 | h = Max<int>(AREA_MIN_HEIGHT, h); | 83 | h = Max<int>(AREA_MIN_HEIGHT, h); |
1699 | 85 | 84 | ||
1720 | 86 | _min_size = Size(w, h); | 85 | min_size_ = Size(w, h); |
1721 | 87 | 86 | ||
1722 | 88 | if (_min_size.width > _max_size.width) | 87 | if (min_size_.width > max_size_.width) |
1723 | 89 | { | 88 | { |
1724 | 90 | _max_size.width = _min_size.width; | 89 | max_size_.width = min_size_.width; |
1725 | 91 | } | 90 | } |
1726 | 92 | 91 | ||
1727 | 93 | if (_min_size.height > _max_size.height) | 92 | if (min_size_.height > max_size_.height) |
1728 | 94 | { | 93 | { |
1729 | 95 | _max_size.height = _min_size.height; | 94 | max_size_.height = min_size_.height; |
1730 | 96 | } | 95 | } |
1731 | 97 | 96 | ||
1732 | 98 | if (_geometry.width < _min_size.width) | 97 | if (geometry_.width < min_size_.width) |
1733 | 99 | { | 98 | { |
1734 | 100 | _geometry.width = _min_size.width; | 99 | geometry_.width = min_size_.width; |
1735 | 101 | } | 100 | } |
1736 | 102 | 101 | ||
1737 | 103 | if (_geometry.height < _min_size.height ) | 102 | if (geometry_.height < min_size_.height ) |
1738 | 104 | { | 103 | { |
1739 | 105 | _geometry.height = _min_size.height; | 104 | geometry_.height = min_size_.height; |
1740 | 106 | } | 105 | } |
1741 | 107 | } | 106 | } |
1742 | 108 | 107 | ||
1743 | 109 | void Area::CheckMaxSize() | 108 | void Area::CheckMaxSize() |
1744 | 110 | { | 109 | { |
1770 | 111 | int w = _max_size.width; | 110 | int w = max_size_.width; |
1771 | 112 | w = Min<int>(AREA_MAX_WIDTH, w); | 111 | w = w <= AREA_MAX_WIDTH ? w : AREA_MAX_WIDTH; |
1772 | 113 | int h = _max_size.height; | 112 | int h = max_size_.height; |
1773 | 114 | h = Min<int>(AREA_MAX_HEIGHT, h); | 113 | h = h <= AREA_MAX_HEIGHT ? h: AREA_MAX_HEIGHT; |
1774 | 115 | 114 | ||
1775 | 116 | _max_size = Size(w, h); | 115 | max_size_ = Size(w, h); |
1776 | 117 | 116 | ||
1777 | 118 | if (_min_size.width > _max_size.width) | 117 | if (min_size_.width > max_size_.width) |
1778 | 119 | { | 118 | { |
1779 | 120 | _min_size.width = _max_size.width; | 119 | min_size_.width = max_size_.width; |
1780 | 121 | } | 120 | } |
1781 | 122 | 121 | ||
1782 | 123 | if (_min_size.height > _max_size.height) | 122 | if (min_size_.height > max_size_.height) |
1783 | 124 | { | 123 | { |
1784 | 125 | _min_size.height = _max_size.height; | 124 | min_size_.height = max_size_.height; |
1785 | 126 | } | 125 | } |
1786 | 127 | 126 | ||
1787 | 128 | if (_geometry.width > _max_size.width) | 127 | if (geometry_.width > max_size_.width) |
1788 | 129 | { | 128 | { |
1789 | 130 | _geometry.width = _max_size.width; | 129 | geometry_.width = max_size_.width; |
1790 | 131 | } | 130 | } |
1791 | 132 | 131 | ||
1792 | 133 | if (_geometry.height > _max_size.height) | 132 | if (geometry_.height > max_size_.height) |
1793 | 134 | { | 133 | { |
1794 | 135 | _geometry.height = _max_size.height; | 134 | geometry_.height = max_size_.height; |
1795 | 136 | } | 135 | } |
1796 | 137 | } | 136 | } |
1797 | 138 | 137 | ||
1799 | 139 | void Area::SetMinimumSize (int w, int h) | 138 | void Area::SetMinimumSize(int w, int h) |
1800 | 140 | { | 139 | { |
1804 | 141 | nuxAssert (w >= 0); | 140 | nuxAssert(w >= 0); |
1805 | 142 | nuxAssert (h >= 0); | 141 | nuxAssert(h >= 0); |
1806 | 143 | _min_size = Size(w, h); | 142 | min_size_ = Size(w, h); |
1807 | 144 | 143 | ||
1808 | 145 | CheckMinSize(); | 144 | CheckMinSize(); |
1809 | 146 | 145 | ||
1810 | 147 | ReconfigureParentLayout(); | 146 | ReconfigureParentLayout(); |
1811 | 148 | } | 147 | } |
1812 | 149 | 148 | ||
1814 | 150 | void Area::SetMaximumSize (int w, int h) | 149 | void Area::SetMaximumSize(int w, int h) |
1815 | 151 | { | 150 | { |
1819 | 152 | nuxAssert (w >= 0); | 151 | nuxAssert(w >= 0); |
1820 | 153 | nuxAssert (h >= 0); | 152 | nuxAssert(h >= 0); |
1821 | 154 | _max_size = Size(w, h); | 153 | max_size_ = Size(w, h); |
1822 | 155 | 154 | ||
1823 | 156 | CheckMaxSize(); | 155 | CheckMaxSize(); |
1824 | 157 | 156 | ||
1825 | 158 | ReconfigureParentLayout(); | 157 | ReconfigureParentLayout(); |
1826 | 159 | } | 158 | } |
1827 | 160 | 159 | ||
1829 | 161 | void Area::SetMinMaxSize (int w, int h) | 160 | void Area::SetMinMaxSize(int w, int h) |
1830 | 162 | { | 161 | { |
1835 | 163 | nuxAssert (w >= 0); | 162 | nuxAssert(w >= 0); |
1836 | 164 | nuxAssert (h >= 0); | 163 | nuxAssert(h >= 0); |
1837 | 165 | SetMinimumSize (w, h); | 164 | SetMinimumSize(w, h); |
1838 | 166 | SetMaximumSize (w, h); | 165 | SetMaximumSize(w, h); |
1839 | 167 | 166 | ||
1840 | 168 | //ReconfigureParentLayout(); | 167 | //ReconfigureParentLayout(); |
1841 | 169 | } | 168 | } |
1842 | 170 | 169 | ||
1843 | 171 | void Area::ApplyMinWidth() | 170 | void Area::ApplyMinWidth() |
1844 | 172 | { | 171 | { |
1846 | 173 | _geometry.width = _min_size.width; | 172 | geometry_.width = min_size_.width; |
1847 | 174 | 173 | ||
1848 | 175 | ReconfigureParentLayout(); | 174 | ReconfigureParentLayout(); |
1849 | 176 | } | 175 | } |
1850 | 177 | 176 | ||
1851 | 178 | void Area::ApplyMinHeight() | 177 | void Area::ApplyMinHeight() |
1852 | 179 | { | 178 | { |
1854 | 180 | _geometry.height = _min_size.height; | 179 | geometry_.height = min_size_.height; |
1855 | 181 | 180 | ||
1856 | 182 | ReconfigureParentLayout(); | 181 | ReconfigureParentLayout(); |
1857 | 183 | } | 182 | } |
1858 | 184 | 183 | ||
1859 | 185 | void Area::ApplyMaxWidth() | 184 | void Area::ApplyMaxWidth() |
1860 | 186 | { | 185 | { |
1862 | 187 | _geometry.width = _max_size.width; | 186 | geometry_.width = max_size_.width; |
1863 | 188 | 187 | ||
1864 | 189 | ReconfigureParentLayout(); | 188 | ReconfigureParentLayout(); |
1865 | 190 | } | 189 | } |
1866 | 191 | 190 | ||
1867 | 192 | void Area::ApplyMaxHeight() | 191 | void Area::ApplyMaxHeight() |
1868 | 193 | { | 192 | { |
1870 | 194 | _geometry.height = _max_size.height; | 193 | geometry_.height = max_size_.height; |
1871 | 195 | 194 | ||
1872 | 196 | ReconfigureParentLayout(); | 195 | ReconfigureParentLayout(); |
1873 | 197 | } | 196 | } |
1874 | 198 | 197 | ||
1875 | 199 | Size Area::GetMinimumSize() const | 198 | Size Area::GetMinimumSize() const |
1876 | 200 | { | 199 | { |
1878 | 201 | return _min_size; | 200 | return min_size_; |
1879 | 202 | } | 201 | } |
1880 | 203 | 202 | ||
1881 | 204 | Size Area::GetMaximumSize() const | 203 | Size Area::GetMaximumSize() const |
1882 | 205 | { | 204 | { |
1884 | 206 | return _max_size; | 205 | return max_size_; |
1885 | 207 | } | 206 | } |
1886 | 208 | 207 | ||
1888 | 209 | void Area::SetMinimumWidth (int w) | 208 | void Area::SetMinimumWidth(int w) |
1889 | 210 | { | 209 | { |
1892 | 211 | nuxAssert (w >= 0); | 210 | nuxAssert(w >= 0); |
1893 | 212 | _min_size.width = w; | 211 | min_size_.width = w; |
1894 | 213 | CheckMinSize(); | 212 | CheckMinSize(); |
1895 | 214 | ReconfigureParentLayout(); | 213 | ReconfigureParentLayout(); |
1896 | 215 | } | 214 | } |
1897 | 216 | 215 | ||
1899 | 217 | void Area::SetMaximumWidth (int w) | 216 | void Area::SetMaximumWidth(int w) |
1900 | 218 | { | 217 | { |
1903 | 219 | nuxAssert (w >= 0); | 218 | nuxAssert(w >= 0); |
1904 | 220 | _max_size.width = w; | 219 | max_size_.width = w; |
1905 | 221 | CheckMaxSize(); | 220 | CheckMaxSize(); |
1906 | 222 | ReconfigureParentLayout(); | 221 | ReconfigureParentLayout(); |
1907 | 223 | } | 222 | } |
1908 | 224 | 223 | ||
1910 | 225 | void Area::SetMinimumHeight (int h) | 224 | void Area::SetMinimumHeight(int h) |
1911 | 226 | { | 225 | { |
1914 | 227 | nuxAssert (h >= 0); | 226 | nuxAssert(h >= 0); |
1915 | 228 | _min_size.height = h; | 227 | min_size_.height = h; |
1916 | 229 | CheckMinSize(); | 228 | CheckMinSize(); |
1917 | 230 | ReconfigureParentLayout(); | 229 | ReconfigureParentLayout(); |
1918 | 231 | } | 230 | } |
1919 | 232 | 231 | ||
1921 | 233 | void Area::SetMaximumHeight (int h) | 232 | void Area::SetMaximumHeight(int h) |
1922 | 234 | { | 233 | { |
1925 | 235 | nuxAssert (h >= 0); | 234 | nuxAssert(h >= 0); |
1926 | 236 | _max_size.height = h; | 235 | max_size_.height = h; |
1927 | 237 | CheckMaxSize(); | 236 | CheckMaxSize(); |
1928 | 238 | ReconfigureParentLayout(); | 237 | ReconfigureParentLayout(); |
1929 | 239 | } | 238 | } |
1930 | 240 | 239 | ||
1931 | 241 | int Area::GetMinimumWidth() const | 240 | int Area::GetMinimumWidth() const |
1932 | 242 | { | 241 | { |
1934 | 243 | return _min_size.width; | 242 | return min_size_.width; |
1935 | 244 | } | 243 | } |
1936 | 245 | 244 | ||
1937 | 246 | int Area::GetMaximumWidth() const | 245 | int Area::GetMaximumWidth() const |
1938 | 247 | { | 246 | { |
1940 | 248 | return _max_size.width; | 247 | return max_size_.width; |
1941 | 249 | } | 248 | } |
1942 | 250 | 249 | ||
1943 | 251 | int Area::GetMinimumHeight() const | 250 | int Area::GetMinimumHeight() const |
1944 | 252 | { | 251 | { |
1946 | 253 | return _min_size.height; | 252 | return min_size_.height; |
1947 | 254 | } | 253 | } |
1948 | 255 | 254 | ||
1949 | 256 | int Area::GetMaximumHeight() const | 255 | int Area::GetMaximumHeight() const |
1950 | 257 | { | 256 | { |
1952 | 258 | return _max_size.height; | 257 | return max_size_.height; |
1953 | 259 | } | 258 | } |
1954 | 260 | 259 | ||
1956 | 261 | unsigned int Area::GetStretchFactor() | 260 | unsigned int Area::GetScaleFactor() |
1957 | 262 | { | 261 | { |
1959 | 263 | return _stretch_factor; | 262 | return scale_factor_; |
1960 | 264 | } | 263 | } |
1961 | 265 | 264 | ||
1963 | 266 | void Area::SetStretchFactor (unsigned int sf) | 265 | void Area::SetScaleFactor(unsigned int sf) |
1964 | 267 | { | 266 | { |
1965 | 268 | // re implemented by Layout | 267 | // re implemented by Layout |
1967 | 269 | _stretch_factor = sf; | 268 | scale_factor_ = sf; |
1968 | 270 | } | 269 | } |
1969 | 271 | 270 | ||
1971 | 272 | void Area::SetParentObject (Area *bo) | 271 | bool Area::SetParentObject(Area *parent) |
1972 | 273 | { | 272 | { |
1986 | 274 | if (bo == 0) | 273 | if (parent == 0) |
1987 | 275 | { | 274 | { |
1988 | 276 | nuxAssertMsg (0, TEXT ("[Area::SetParentObject] Invalid parent obejct.") ); | 275 | nuxAssertMsg(0, "[Area::SetParentObject] Invalid parent obejct."); |
1989 | 277 | return; | 276 | return false; |
1990 | 278 | } | 277 | } |
1991 | 279 | 278 | ||
1992 | 280 | if (_parent_area) | 279 | if (parent_area_ && (parent_area_ != parent)) |
1993 | 281 | { | 280 | { |
1994 | 282 | nuxAssertMsg (0, TEXT ("[Area::SetParentObject] Object already has a parent. You must UnParent the object before you can parenting again.") ); | 281 | nuxAssertMsg(0, "[Area::SetParentObject] Object already has a parent. You must UnParent the object before you can parenting again."); |
1995 | 283 | return; | 282 | return false; |
1996 | 284 | } | 283 | } |
1997 | 285 | 284 | ||
1998 | 286 | _parent_area = bo; | 285 | if (parent_area_) |
1999 | 286 | { | ||
2000 | 287 | // Already parented to the same area. Return. | ||
2001 | 288 | return true; | ||
2002 | 289 | } | ||
2003 | 290 | |||
2004 | 291 | parent_area_ = parent; | ||
2005 | 287 | Reference(); | 292 | Reference(); |
2006 | 293 | |||
2007 | 294 | return true; | ||
2008 | 288 | } | 295 | } |
2009 | 289 | 296 | ||
2010 | 290 | void Area::UnParentObject() | 297 | void Area::UnParentObject() |
2011 | 291 | { | 298 | { |
2013 | 292 | if (_parent_area) | 299 | if (parent_area_) |
2014 | 293 | { | 300 | { |
2016 | 294 | _parent_area = 0; | 301 | parent_area_ = 0; |
2017 | 295 | UnReference(); | 302 | UnReference(); |
2018 | 296 | } | 303 | } |
2019 | 297 | } | 304 | } |
2020 | 298 | 305 | ||
2021 | 299 | Area *Area::GetParentObject() const | 306 | Area *Area::GetParentObject() const |
2022 | 300 | { | 307 | { |
2024 | 301 | return _parent_area; | 308 | return parent_area_; |
2025 | 302 | } | 309 | } |
2026 | 303 | 310 | ||
2027 | 304 | int Area::GetBaseX () const | 311 | int Area::GetBaseX () const |
2028 | 305 | { | 312 | { |
2030 | 306 | return _geometry.x; | 313 | return geometry_.x; |
2031 | 307 | } | 314 | } |
2032 | 308 | 315 | ||
2033 | 309 | int Area::GetBaseY () const | 316 | int Area::GetBaseY () const |
2034 | 310 | { | 317 | { |
2036 | 311 | return _geometry.y; | 318 | return geometry_.y; |
2037 | 312 | } | 319 | } |
2038 | 313 | 320 | ||
2039 | 314 | int Area::GetBaseWidth () const | 321 | int Area::GetBaseWidth () const |
2040 | 315 | { | 322 | { |
2042 | 316 | return _geometry.width; | 323 | return geometry_.width; |
2043 | 317 | } | 324 | } |
2044 | 318 | 325 | ||
2045 | 319 | int Area::GetBaseHeight () const | 326 | int Area::GetBaseHeight () const |
2046 | 320 | { | 327 | { |
2048 | 321 | return _geometry.height; | 328 | return geometry_.height; |
2049 | 322 | } | 329 | } |
2050 | 323 | 330 | ||
2051 | 324 | void Area::SetGeometry(int x, int y, int w, int h) | 331 | void Area::SetGeometry(int x, int y, int w, int h) |
2052 | 325 | { | 332 | { |
2055 | 326 | h = nux::Clamp<int> (h, _min_size.height, _max_size.height); | 333 | h = nux::Clamp<int> (h, min_size_.height, max_size_.height); |
2056 | 327 | w = nux::Clamp<int> (w, _min_size.width, _max_size.width); | 334 | w = nux::Clamp<int> (w, min_size_.width, max_size_.width); |
2057 | 328 | 335 | ||
2058 | 329 | nux::Geometry geometry(x, y, w, h); | 336 | nux::Geometry geometry(x, y, w, h); |
2060 | 330 | if (_geometry == geometry) | 337 | if (geometry_ == geometry) |
2061 | 331 | return; | 338 | return; |
2062 | 332 | 339 | ||
2063 | 333 | GeometryChangePending(); | 340 | GeometryChangePending(); |
2065 | 334 | _geometry = geometry; | 341 | geometry_ = geometry; |
2066 | 335 | ReconfigureParentLayout(); | 342 | ReconfigureParentLayout(); |
2067 | 336 | GeometryChanged(); | 343 | GeometryChanged(); |
2068 | 337 | 344 | ||
2070 | 338 | OnGeometryChanged.emit(this, _geometry); | 345 | OnGeometryChanged.emit(this, geometry_); |
2071 | 339 | } | 346 | } |
2072 | 340 | 347 | ||
2074 | 341 | void Area::SetGeometry (const Geometry &geo) | 348 | void Area::SetGeometry(const Geometry &geo) |
2075 | 342 | { | 349 | { |
2077 | 343 | SetGeometry (geo.x, geo.y, geo.width, geo.height); | 350 | SetGeometry(geo.x, geo.y, geo.width, geo.height); |
2078 | 344 | } | 351 | } |
2079 | 345 | 352 | ||
2080 | 346 | Geometry const& Area::GetGeometry() const | 353 | Geometry const& Area::GetGeometry() const |
2081 | 347 | { | 354 | { |
2083 | 348 | return _geometry; | 355 | return geometry_; |
2084 | 349 | } | 356 | } |
2085 | 350 | 357 | ||
2086 | 351 | void Area::SetBaseX(int x) | 358 | void Area::SetBaseX(int x) |
2087 | 352 | { | 359 | { |
2089 | 353 | SetGeometry(x, _geometry.y, _geometry.width, _geometry.height); | 360 | SetGeometry(x, geometry_.y, geometry_.width, geometry_.height); |
2090 | 354 | } | 361 | } |
2091 | 355 | 362 | ||
2092 | 356 | void Area::SetBaseY (int y) | 363 | void Area::SetBaseY (int y) |
2093 | 357 | { | 364 | { |
2095 | 358 | SetGeometry (_geometry.x, y, _geometry.width, _geometry.height); | 365 | SetGeometry(geometry_.x, y, geometry_.width, geometry_.height); |
2096 | 359 | } | 366 | } |
2097 | 360 | 367 | ||
2098 | 361 | void Area::SetBaseXY (int x, int y) | 368 | void Area::SetBaseXY (int x, int y) |
2099 | 362 | { | 369 | { |
2135 | 363 | SetGeometry (x, y, _geometry.width, _geometry.height); | 370 | SetGeometry(x, y, geometry_.width, geometry_.height); |
2136 | 364 | } | 371 | } |
2137 | 365 | 372 | ||
2138 | 366 | void Area::SetBaseSize (int w, int h) | 373 | void Area::SetBaseSize(int w, int h) |
2139 | 367 | { | 374 | { |
2140 | 368 | SetGeometry (_geometry.x, _geometry.y, w, h); | 375 | SetGeometry(geometry_.x, geometry_.y, w, h); |
2141 | 369 | } | 376 | } |
2142 | 370 | 377 | ||
2143 | 371 | void Area::SetBaseWidth (int w) | 378 | void Area::SetBaseWidth(int w) |
2144 | 372 | { | 379 | { |
2145 | 373 | SetGeometry (_geometry.x, _geometry.y, w, _geometry.height); | 380 | SetGeometry(geometry_.x, geometry_.y, w, geometry_.height); |
2146 | 374 | } | 381 | } |
2147 | 375 | 382 | ||
2148 | 376 | void Area::SetBaseHeight (int h) | 383 | void Area::SetBaseHeight(int h) |
2149 | 377 | { | 384 | { |
2150 | 378 | SetGeometry (_geometry.x, _geometry.y, _geometry.width, h); | 385 | SetGeometry(geometry_.x, geometry_.y, geometry_.width, h); |
2151 | 379 | } | 386 | } |
2152 | 380 | 387 | ||
2153 | 381 | void Area::IncreaseSize (int x, int y) | 388 | void Area::IncreaseSize(int x, int y) |
2154 | 382 | { | 389 | { |
2155 | 383 | _geometry.OffsetPosition (x, y); | 390 | geometry_.OffsetPosition(x, y); |
2156 | 384 | OnResize.emit (_geometry.x, _geometry.y, _geometry.width, _geometry.height ); | 391 | OnResize.emit(geometry_.x, geometry_.y, geometry_.width, geometry_.height ); |
2157 | 385 | } | 392 | } |
2158 | 386 | 393 | ||
2159 | 387 | long Area::ComputeChildLayout() | 394 | long Area::ComputeContentSize() |
2125 | 388 | { | ||
2126 | 389 | return 0; | ||
2127 | 390 | } | ||
2128 | 391 | |||
2129 | 392 | void Area::PositionChildLayout (float offsetX, float offsetY) | ||
2130 | 393 | { | ||
2131 | 394 | |||
2132 | 395 | } | ||
2133 | 396 | |||
2134 | 397 | long Area::ComputeLayout2() | ||
2160 | 398 | { | 395 | { |
2161 | 399 | return (eCompliantWidth | eCompliantHeight); | 396 | return (eCompliantWidth | eCompliantHeight); |
2162 | 400 | } | 397 | } |
2163 | 401 | 398 | ||
2165 | 402 | void Area::ComputePosition2 (float offsetX, float offsetY) | 399 | void Area::ComputeContentPosition(float offsetX, float offsetY) |
2166 | 403 | { | 400 | { |
2167 | 404 | 401 | ||
2168 | 405 | } | 402 | } |
2169 | 406 | 403 | ||
2170 | 407 | void Area::SetReconfigureParentLayoutOnGeometryChange(bool reconfigure_parent_layout) | 404 | void Area::SetReconfigureParentLayoutOnGeometryChange(bool reconfigure_parent_layout) |
2171 | 408 | { | 405 | { |
2173 | 409 | _on_geometry_changeg_reconfigure_parent_layout = reconfigure_parent_layout; | 406 | on_geometry_change_reconfigure_parent_layout_ = reconfigure_parent_layout; |
2174 | 410 | } | 407 | } |
2175 | 411 | 408 | ||
2176 | 412 | bool Area::ReconfigureParentLayoutOnGeometryChange() | 409 | bool Area::ReconfigureParentLayoutOnGeometryChange() |
2177 | 413 | { | 410 | { |
2179 | 414 | return _on_geometry_changeg_reconfigure_parent_layout; | 411 | return on_geometry_change_reconfigure_parent_layout_; |
2180 | 415 | } | 412 | } |
2181 | 416 | 413 | ||
2182 | 417 | void Area::ReconfigureParentLayout(Area *child) | 414 | void Area::ReconfigureParentLayout(Area *child) |
2183 | 418 | { | 415 | { |
2185 | 419 | if(_on_geometry_changeg_reconfigure_parent_layout == false) | 416 | if (on_geometry_change_reconfigure_parent_layout_ == false) |
2186 | 420 | return; | 417 | return; |
2187 | 421 | 418 | ||
2189 | 422 | if (GetWindowThread ()->IsComputingLayout() ) | 419 | if (GetWindowThread() && GetWindowThread()->IsComputingLayout()) |
2190 | 423 | { | 420 | { |
2191 | 424 | // there is no need to do the following while we are already computing the layout. | 421 | // there is no need to do the following while we are already computing the layout. |
2192 | 425 | // If we do, we will end up in an infinite loop. | 422 | // If we do, we will end up in an infinite loop. |
2193 | 426 | return; | 423 | return; |
2194 | 427 | } | 424 | } |
2195 | 428 | 425 | ||
2197 | 429 | if (this->Type().IsDerivedFromType (View::StaticObjectType) ) | 426 | if (this->Type().IsDerivedFromType(View::StaticObjectType)) |
2198 | 430 | { | 427 | { |
2199 | 431 | // The object that is being resized is a View object and it has a parent. | 428 | // The object that is being resized is a View object and it has a parent. |
2200 | 432 | if (this->OwnsTheReference() == false && this->GetParentObject()) | 429 | if (this->OwnsTheReference() == false && this->GetParentObject()) |
2201 | @@ -437,29 +434,29 @@ | |||
2202 | 437 | 434 | ||
2203 | 438 | View *ic = static_cast<View *>(this); | 435 | View *ic = static_cast<View *>(this); |
2204 | 439 | 436 | ||
2206 | 440 | if (ic->CanBreakLayout() ) | 437 | if (ic->CanBreakLayout()) |
2207 | 441 | { | 438 | { |
2208 | 442 | 439 | ||
2211 | 443 | if ( (child != 0) && | 440 | if ((child != 0) && |
2212 | 444 | (ic->Type().IsObjectType (VSplitter::StaticObjectType) || ic->Type().IsObjectType (HSplitter::StaticObjectType) ) ) | 441 | (ic->Type().IsObjectType(VSplitter::StaticObjectType) || ic->Type().IsObjectType(HSplitter::StaticObjectType))) |
2213 | 445 | { | 442 | { |
2214 | 446 | // If this element is a Splitter, then we submit its child to the refresh list. We don't want to submit the | 443 | // If this element is a Splitter, then we submit its child to the refresh list. We don't want to submit the |
2217 | 447 | // splitter because this will cause a redraw of all parts of the splitter (costly and unnecessary). | 444 | // splitter because this will cause a redraw of all parts of the splitter(costly and unnecessary). |
2218 | 448 | GetWindowThread ()->QueueObjectLayout (child); | 445 | GetWindowThread()->QueueObjectLayout(child); |
2219 | 449 | } | 446 | } |
2220 | 450 | else | 447 | else |
2221 | 451 | { | 448 | { |
2223 | 452 | GetWindowThread ()->QueueObjectLayout (ic); | 449 | GetWindowThread()->QueueObjectLayout(ic); |
2224 | 453 | } | 450 | } |
2225 | 454 | } | 451 | } |
2228 | 455 | else if (ic->_parent_area) | 452 | else if (ic->parent_area_) |
2229 | 456 | ic->_parent_area->ReconfigureParentLayout (this); | 453 | ic->parent_area_->ReconfigureParentLayout(this); |
2230 | 457 | else | 454 | else |
2231 | 458 | { | 455 | { |
2233 | 459 | GetWindowThread ()->QueueObjectLayout (ic); | 456 | GetWindowThread()->QueueObjectLayout(ic); |
2234 | 460 | } | 457 | } |
2235 | 461 | } | 458 | } |
2237 | 462 | else if (this->Type().IsDerivedFromType (Layout::StaticObjectType) ) | 459 | else if (this->Type().IsDerivedFromType(Layout::StaticObjectType)) |
2238 | 463 | { | 460 | { |
2239 | 464 | // The object that is being resized is a View object and it has a parent. | 461 | // The object that is being resized is a View object and it has a parent. |
2240 | 465 | if (this->OwnsTheReference() == false && this->GetParentObject()) | 462 | if (this->OwnsTheReference() == false && this->GetParentObject()) |
2241 | @@ -470,47 +467,47 @@ | |||
2242 | 470 | 467 | ||
2243 | 471 | Layout *layout = static_cast<Layout *>(this); | 468 | Layout *layout = static_cast<Layout *>(this); |
2244 | 472 | 469 | ||
2246 | 473 | if (layout->_parent_area) | 470 | if (layout->parent_area_) |
2247 | 474 | { | 471 | { |
2249 | 475 | if (layout->_parent_area->Type().IsDerivedFromType (View::StaticObjectType) ) | 472 | if (layout->parent_area_->Type().IsDerivedFromType(View::StaticObjectType)) |
2250 | 476 | { | 473 | { |
2252 | 477 | View *ic = (View *) (layout->_parent_area); | 474 | View *ic = (View *) (layout->parent_area_); |
2253 | 478 | 475 | ||
2255 | 479 | if (ic->CanBreakLayout() ) | 476 | if (ic->CanBreakLayout()) |
2256 | 480 | { | 477 | { |
2259 | 481 | if ( (child != 0) && | 478 | if ((child != 0) && |
2260 | 482 | (ic->Type().IsObjectType (VSplitter::StaticObjectType) || ic->Type().IsObjectType (HSplitter::StaticObjectType) ) ) | 479 | (ic->Type().IsObjectType(VSplitter::StaticObjectType) || ic->Type().IsObjectType(HSplitter::StaticObjectType))) |
2261 | 483 | { | 480 | { |
2262 | 484 | // If the parent of this element is a splitter, then we submit its child to the refresh list. We don't want to submit the | 481 | // If the parent of this element is a splitter, then we submit its child to the refresh list. We don't want to submit the |
2265 | 485 | // splitter because this will cause a redraw of all parts of the splitter (costly and unnecessary). | 482 | // splitter because this will cause a redraw of all parts of the splitter(costly and unnecessary). |
2266 | 486 | GetWindowThread ()->QueueObjectLayout (this); | 483 | GetWindowThread()->QueueObjectLayout(this); |
2267 | 487 | } | 484 | } |
2268 | 488 | else | 485 | else |
2269 | 489 | { | 486 | { |
2271 | 490 | GetWindowThread ()->QueueObjectLayout (ic); | 487 | GetWindowThread()->QueueObjectLayout(ic); |
2272 | 491 | } | 488 | } |
2273 | 492 | } | 489 | } |
2274 | 493 | else | 490 | else |
2275 | 494 | { | 491 | { |
2276 | 495 | // The parent object of an object of type View is a Layout object type. | 492 | // The parent object of an object of type View is a Layout object type. |
2278 | 496 | layout->_parent_area->ReconfigureParentLayout (this); | 493 | layout->parent_area_->ReconfigureParentLayout(this); |
2279 | 497 | } | 494 | } |
2280 | 498 | } | 495 | } |
2281 | 499 | else | 496 | else |
2282 | 500 | { | 497 | { |
2284 | 501 | layout->_parent_area->ReconfigureParentLayout (this); | 498 | layout->parent_area_->ReconfigureParentLayout(this); |
2285 | 502 | } | 499 | } |
2286 | 503 | } | 500 | } |
2287 | 504 | else | 501 | else |
2288 | 505 | { | 502 | { |
2291 | 506 | // This is possibly the Main layout or the layout of a floating object (popup for example) unless the layout is not part of the object tree. | 503 | // This is possibly the Main layout or the layout of a floating object(popup for example) unless the layout is not part of the object tree. |
2292 | 507 | GetWindowThread ()->QueueObjectLayout (layout); | 504 | GetWindowThread()->QueueObjectLayout(layout); |
2293 | 508 | } | 505 | } |
2294 | 509 | } | 506 | } |
2295 | 510 | else | 507 | else |
2296 | 511 | { | 508 | { |
2297 | 512 | // The object that is being resized is a InputArea object. | 509 | // The object that is being resized is a InputArea object. |
2299 | 513 | if (this->_parent_area) | 510 | if (this->parent_area_) |
2300 | 514 | { | 511 | { |
2301 | 515 | // The object that is being resized is a View object and it has a parent. | 512 | // The object that is being resized is a View object and it has a parent. |
2302 | 516 | if (this->OwnsTheReference() == false && this->GetParentObject()) | 513 | if (this->OwnsTheReference() == false && this->GetParentObject()) |
2303 | @@ -520,125 +517,128 @@ | |||
2304 | 520 | } | 517 | } |
2305 | 521 | 518 | ||
2306 | 522 | // The parent object of an object of type InputArea is a Layout object type. | 519 | // The parent object of an object of type InputArea is a Layout object type. |
2308 | 523 | this->_parent_area->ReconfigureParentLayout (this); | 520 | this->parent_area_->ReconfigureParentLayout(this); |
2309 | 524 | } | 521 | } |
2310 | 525 | } | 522 | } |
2311 | 526 | } | 523 | } |
2312 | 527 | 524 | ||
2314 | 528 | void Area::RequestBottomUpLayoutComputation (Area *bo_initiator) | 525 | void Area::RequestBottomUpLayoutComputation(Area *bo_initiator) |
2315 | 529 | { | 526 | { |
2317 | 530 | if (_parent_area && _parent_area->IsLayout() ) | 527 | if (parent_area_ && parent_area_->IsLayout()) |
2318 | 531 | { | 528 | { |
2320 | 532 | _parent_area->RequestBottomUpLayoutComputation (bo_initiator); | 529 | parent_area_->RequestBottomUpLayoutComputation(bo_initiator); |
2321 | 533 | } | 530 | } |
2322 | 534 | } | 531 | } |
2323 | 535 | 532 | ||
2365 | 536 | void Area::SetLayoutProperties (LayoutProperties *properties) | 533 | void Area::SetVisible(bool visible) |
2366 | 537 | { | 534 | { |
2367 | 538 | if (_layout_properties) | 535 | if (IsLayout()) |
2368 | 539 | delete _layout_properties; | 536 | return; |
2369 | 540 | 537 | ||
2370 | 541 | _layout_properties = properties; | 538 | if (visible_ == visible) |
2371 | 542 | } | 539 | return; |
2372 | 543 | 540 | ||
2373 | 544 | Area::LayoutProperties * Area::GetLayoutProperties () | 541 | visible_ = visible; |
2374 | 545 | { | 542 | |
2375 | 546 | return _layout_properties; | 543 | OnVisibleChanged.emit(this, visible_); |
2376 | 547 | } | 544 | } |
2377 | 548 | 545 | ||
2378 | 549 | void Area::SetVisible (bool visible) | 546 | bool Area::IsVisible() |
2379 | 550 | { | 547 | { |
2380 | 551 | if (_visible == visible) | 548 | return visible_; |
2381 | 552 | return; | 549 | } |
2382 | 553 | 550 | ||
2383 | 554 | _visible = visible; | 551 | void Area::SetSensitive(bool sensitive) |
2384 | 555 | 552 | { | |
2385 | 556 | OnVisibleChanged.emit (this, _visible); | 553 | SetInputEventSensitivity(sensitive); |
2386 | 557 | } | 554 | } |
2387 | 558 | 555 | ||
2388 | 559 | bool Area::IsVisible () | 556 | void Area::SetInputEventSensitivity(bool sensitive) |
2389 | 560 | { | 557 | { |
2390 | 561 | return _visible; | 558 | if (IsLayout()) |
2391 | 562 | } | 559 | return; |
2392 | 563 | 560 | ||
2393 | 564 | void Area::SetSensitive (bool sensitive) | 561 | if (sensitive_ == sensitive) |
2394 | 565 | { | 562 | return; |
2395 | 566 | if (_sensitive == sensitive) | 563 | |
2396 | 567 | return; | 564 | sensitive_ = sensitive; |
2397 | 568 | 565 | ||
2398 | 569 | _sensitive = sensitive; | 566 | OnSensitiveChanged.emit(this, sensitive_); |
2399 | 570 | 567 | } | |
2400 | 571 | OnSensitiveChanged.emit (this, _sensitive); | 568 | |
2401 | 572 | } | 569 | bool Area::IsSensitive() const |
2402 | 573 | 570 | { | |
2403 | 574 | bool Area::IsSensitive () | 571 | return GetInputEventSensitivity(); |
2404 | 575 | { | 572 | } |
2405 | 576 | return _sensitive; | 573 | |
2406 | 574 | bool Area::GetInputEventSensitivity() const | ||
2407 | 575 | { | ||
2408 | 576 | return sensitive_; | ||
2409 | 577 | } | 577 | } |
2410 | 578 | 578 | ||
2411 | 579 | MinorDimensionPosition Area::GetPositioning() | 579 | MinorDimensionPosition Area::GetPositioning() |
2412 | 580 | { | 580 | { |
2414 | 581 | return _positioning; | 581 | return minor_axis_position_; |
2415 | 582 | } | 582 | } |
2416 | 583 | 583 | ||
2418 | 584 | void Area::SetPositioning (MinorDimensionPosition p) | 584 | void Area::SetPositioning(MinorDimensionPosition p) |
2419 | 585 | { | 585 | { |
2421 | 586 | _positioning = p; | 586 | minor_axis_position_ = p; |
2422 | 587 | } | 587 | } |
2423 | 588 | 588 | ||
2424 | 589 | MinorDimensionSize Area::GetExtend() | 589 | MinorDimensionSize Area::GetExtend() |
2425 | 590 | { | 590 | { |
2427 | 591 | return _extend; | 591 | return minor_axis_size_; |
2428 | 592 | } | 592 | } |
2429 | 593 | 593 | ||
2431 | 594 | void Area::SetExtend (MinorDimensionSize ext) | 594 | void Area::SetExtend(MinorDimensionSize ext) |
2432 | 595 | { | 595 | { |
2434 | 596 | _extend = ext; | 596 | minor_axis_size_ = ext; |
2435 | 597 | } | 597 | } |
2436 | 598 | 598 | ||
2437 | 599 | float Area::GetPercentage() | 599 | float Area::GetPercentage() |
2438 | 600 | { | 600 | { |
2440 | 601 | return _percentage; | 601 | return minor_axis_size_scale_; |
2441 | 602 | } | 602 | } |
2442 | 603 | 603 | ||
2444 | 604 | void Area::SetPercentage (float p) | 604 | void Area::SetPercentage(float p) |
2445 | 605 | { | 605 | { |
2447 | 606 | _percentage = p; | 606 | minor_axis_size_scale_ = p; |
2448 | 607 | } | 607 | } |
2449 | 608 | 608 | ||
2450 | 609 | bool Area::IsLayoutDone() | 609 | bool Area::IsLayoutDone() |
2451 | 610 | { | 610 | { |
2483 | 611 | return _layout_done; | 611 | return layout_done_; |
2484 | 612 | } | 612 | } |
2485 | 613 | 613 | ||
2486 | 614 | void Area::SetLayoutDone (bool b) | 614 | void Area::SetLayoutDone(bool b) |
2487 | 615 | { | 615 | { |
2488 | 616 | _layout_done = b; | 616 | layout_done_ = b; |
2489 | 617 | } | 617 | } |
2490 | 618 | 618 | ||
2491 | 619 | bool Area::IsArea () const | 619 | bool Area::IsArea() const |
2492 | 620 | { | 620 | { |
2493 | 621 | return this->Type ().IsDerivedFromType (Area::StaticObjectType);; | 621 | return this->Type().IsDerivedFromType(Area::StaticObjectType);; |
2494 | 622 | } | 622 | } |
2495 | 623 | 623 | ||
2496 | 624 | bool Area::IsInputArea () const | 624 | bool Area::IsInputArea() const |
2497 | 625 | { | 625 | { |
2498 | 626 | return this->Type ().IsDerivedFromType (InputArea::StaticObjectType);; | 626 | return this->Type().IsDerivedFromType(InputArea::StaticObjectType);; |
2499 | 627 | } | 627 | } |
2500 | 628 | 628 | ||
2501 | 629 | bool Area::IsView () const | 629 | bool Area::IsView() const |
2502 | 630 | { | 630 | { |
2503 | 631 | return this->Type ().IsDerivedFromType (View::StaticObjectType);; | 631 | return this->Type().IsDerivedFromType(View::StaticObjectType);; |
2504 | 632 | } | 632 | } |
2505 | 633 | 633 | ||
2506 | 634 | bool Area::IsLayout () const | 634 | bool Area::IsLayout() const |
2507 | 635 | { | 635 | { |
2508 | 636 | return this->Type ().IsDerivedFromType (Layout::StaticObjectType); | 636 | return this->Type().IsDerivedFromType(Layout::StaticObjectType); |
2509 | 637 | } | 637 | } |
2510 | 638 | 638 | ||
2511 | 639 | bool Area::IsViewWindow () const | 639 | bool Area::IsViewWindow() const |
2512 | 640 | { | 640 | { |
2513 | 641 | return this->Type ().IsDerivedFromType (BaseWindow::StaticObjectType); | 641 | return this->Type().IsDerivedFromType(BaseWindow::StaticObjectType); |
2514 | 642 | } | 642 | } |
2515 | 643 | 643 | ||
2516 | 644 | bool Area::IsSpaceLayout() const | 644 | bool Area::IsSpaceLayout() const |
2517 | @@ -646,113 +646,113 @@ | |||
2518 | 646 | return this->Type().IsDerivedFromType(SpaceLayout::StaticObjectType);; | 646 | return this->Type().IsDerivedFromType(SpaceLayout::StaticObjectType);; |
2519 | 647 | } | 647 | } |
2520 | 648 | 648 | ||
2522 | 649 | void Area::Set2DMatrix (const Matrix4 &mat) | 649 | void Area::Set2DMatrix(const Matrix4 &mat) |
2523 | 650 | { | 650 | { |
2524 | 651 | _2d_xform = mat; | 651 | _2d_xform = mat; |
2525 | 652 | } | 652 | } |
2526 | 653 | 653 | ||
2528 | 654 | void Area::Set2DTranslation (float tx, float ty, float tz) | 654 | void Area::Set2DTranslation(float tx, float ty, float tz) |
2529 | 655 | { | 655 | { |
2531 | 656 | _2d_xform.Translate (tx, ty, tz); | 656 | _2d_xform.Translate(tx, ty, tz); |
2532 | 657 | } | 657 | } |
2533 | 658 | 658 | ||
2535 | 659 | Matrix4 Area::Get2DMatrix () const | 659 | Matrix4 Area::Get2DMatrix() const |
2536 | 660 | { | 660 | { |
2537 | 661 | return _2d_xform; | 661 | return _2d_xform; |
2538 | 662 | } | 662 | } |
2539 | 663 | 663 | ||
2541 | 664 | Matrix4 Area::Get3DMatrix () const | 664 | Matrix4 Area::Get3DMatrix() const |
2542 | 665 | { | 665 | { |
2543 | 666 | return _3d_xform; | 666 | return _3d_xform; |
2544 | 667 | } | 667 | } |
2545 | 668 | 668 | ||
2547 | 669 | bool Area::Is3DArea () const | 669 | bool Area::Is3DArea() const |
2548 | 670 | { | 670 | { |
2549 | 671 | return _3d_area; | 671 | return _3d_area; |
2550 | 672 | } | 672 | } |
2551 | 673 | 673 | ||
2553 | 674 | static void MatrixXFormGeometry (const Matrix4 &matrix, Geometry &geo) | 674 | static void MatrixXFormGeometry(const Matrix4 &matrix, Geometry &geo) |
2554 | 675 | { | 675 | { |
2556 | 676 | Vector4 in (geo.x, geo.y, 0, 1); | 676 | Vector4 in(geo.x, geo.y, 0, 1); |
2557 | 677 | // This is mean only for translation matrices. It will not work with matrices containing rotations or scalings. | 677 | // This is mean only for translation matrices. It will not work with matrices containing rotations or scalings. |
2558 | 678 | Vector4 out = matrix * in; | 678 | Vector4 out = matrix * in; |
2559 | 679 | geo.x = out.x; | 679 | geo.x = out.x; |
2560 | 680 | geo.y = out.y; | 680 | geo.y = out.y; |
2561 | 681 | } | 681 | } |
2562 | 682 | 682 | ||
2564 | 683 | void Area::InnerGetAbsoluteGeometry (Geometry &geometry) | 683 | void Area::InnerGetAbsoluteGeometry(Geometry &geometry) |
2565 | 684 | { | 684 | { |
2567 | 685 | if (this->Type ().IsDerivedFromType (BaseWindow::StaticObjectType) || (this == GetWindowThread ()->GetMainLayout ())) | 685 | if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout())) |
2568 | 686 | { | 686 | { |
2570 | 687 | geometry.OffsetPosition (_geometry.x, _geometry.y); | 687 | geometry.OffsetPosition(geometry_.x, geometry_.y); |
2571 | 688 | return; | 688 | return; |
2572 | 689 | } | 689 | } |
2573 | 690 | 690 | ||
2575 | 691 | MatrixXFormGeometry (_2d_xform, geometry); | 691 | MatrixXFormGeometry(_2d_xform, geometry); |
2576 | 692 | 692 | ||
2578 | 693 | Area *parent = GetParentObject (); | 693 | Area *parent = GetParentObject(); |
2579 | 694 | if (parent) | 694 | if (parent) |
2581 | 695 | parent->InnerGetAbsoluteGeometry (geometry); | 695 | parent->InnerGetAbsoluteGeometry(geometry); |
2582 | 696 | } | 696 | } |
2583 | 697 | 697 | ||
2585 | 698 | Geometry Area::GetAbsoluteGeometry () const | 698 | Geometry Area::GetAbsoluteGeometry() const |
2586 | 699 | { | 699 | { |
2587 | 700 | if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || | 700 | if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || |
2588 | 701 | Type().IsDerivedFromType(MenuPage::StaticObjectType) || | 701 | Type().IsDerivedFromType(MenuPage::StaticObjectType) || |
2589 | 702 | (this == GetWindowThread()->GetMainLayout())) | 702 | (this == GetWindowThread()->GetMainLayout())) |
2590 | 703 | { | 703 | { |
2591 | 704 | // Do not apply the _2D_xform matrix to a BaseWindow or the main layout | 704 | // Do not apply the _2D_xform matrix to a BaseWindow or the main layout |
2593 | 705 | return _geometry; | 705 | return geometry_; |
2594 | 706 | } | 706 | } |
2595 | 707 | else | 707 | else |
2596 | 708 | { | 708 | { |
2599 | 709 | nux::Geometry geo = _geometry; | 709 | nux::Geometry geo = geometry_; |
2600 | 710 | MatrixXFormGeometry (_2d_xform, geo); | 710 | MatrixXFormGeometry(_2d_xform, geo); |
2601 | 711 | 711 | ||
2603 | 712 | Area *parent = GetParentObject (); | 712 | Area *parent = GetParentObject(); |
2604 | 713 | if (parent) | 713 | if (parent) |
2606 | 714 | parent->InnerGetAbsoluteGeometry (geo); | 714 | parent->InnerGetAbsoluteGeometry(geo); |
2607 | 715 | 715 | ||
2608 | 716 | return geo; | 716 | return geo; |
2609 | 717 | } | 717 | } |
2610 | 718 | } | 718 | } |
2611 | 719 | 719 | ||
2635 | 720 | int Area::GetAbsoluteX () const | 720 | int Area::GetAbsoluteX() const |
2636 | 721 | { | 721 | { |
2637 | 722 | return GetAbsoluteGeometry ().x; | 722 | return GetAbsoluteGeometry().x; |
2638 | 723 | } | 723 | } |
2639 | 724 | 724 | ||
2640 | 725 | int Area::GetAbsoluteY () const | 725 | int Area::GetAbsoluteY() const |
2641 | 726 | { | 726 | { |
2642 | 727 | return GetAbsoluteGeometry ().y; | 727 | return GetAbsoluteGeometry().y; |
2643 | 728 | } | 728 | } |
2644 | 729 | 729 | ||
2645 | 730 | int Area::GetAbsoluteWidth () const | 730 | int Area::GetAbsoluteWidth() const |
2646 | 731 | { | 731 | { |
2647 | 732 | return GetAbsoluteGeometry ().width; | 732 | return GetAbsoluteGeometry().width; |
2648 | 733 | } | 733 | } |
2649 | 734 | 734 | ||
2650 | 735 | int Area::GetAbsoluteHeight () const | 735 | int Area::GetAbsoluteHeight() const |
2651 | 736 | { | 736 | { |
2652 | 737 | return GetAbsoluteGeometry ().height; | 737 | return GetAbsoluteGeometry().height; |
2653 | 738 | } | 738 | } |
2654 | 739 | 739 | ||
2655 | 740 | void Area::InnerGetRootGeometry (Geometry &geometry) | 740 | void Area::InnerGetRootGeometry(Geometry &geometry) |
2656 | 741 | { | 741 | { |
2657 | 742 | if (this->Type ().IsDerivedFromType (BaseWindow::StaticObjectType) || (this == GetWindowThread ()->GetMainLayout ())) | 742 | if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout())) |
2658 | 743 | return; | 743 | return; |
2659 | 744 | 744 | ||
2661 | 745 | MatrixXFormGeometry (_2d_xform, geometry); | 745 | MatrixXFormGeometry(_2d_xform, geometry); |
2662 | 746 | 746 | ||
2664 | 747 | Area *parent = GetParentObject (); | 747 | Area *parent = GetParentObject(); |
2665 | 748 | if (parent) | 748 | if (parent) |
2667 | 749 | parent->InnerGetRootGeometry (geometry); | 749 | parent->InnerGetRootGeometry(geometry); |
2668 | 750 | } | 750 | } |
2669 | 751 | 751 | ||
2671 | 752 | Geometry Area::GetRootGeometry () const | 752 | Geometry Area::GetRootGeometry() const |
2672 | 753 | { | 753 | { |
2675 | 754 | nux::Geometry geo = _geometry; | 754 | nux::Geometry geo = geometry_; |
2676 | 755 | MatrixXFormGeometry (_2d_xform, geo); | 755 | MatrixXFormGeometry(_2d_xform, geo); |
2677 | 756 | 756 | ||
2678 | 757 | if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout())) | 757 | if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout())) |
2679 | 758 | { | 758 | { |
2680 | @@ -760,62 +760,67 @@ | |||
2681 | 760 | } | 760 | } |
2682 | 761 | else | 761 | else |
2683 | 762 | { | 762 | { |
2685 | 763 | Area *parent = GetParentObject (); | 763 | Area *parent = GetParentObject(); |
2686 | 764 | if (parent) | 764 | if (parent) |
2688 | 765 | parent->InnerGetRootGeometry (geo); | 765 | parent->InnerGetRootGeometry(geo); |
2689 | 766 | 766 | ||
2690 | 767 | return geo; | 767 | return geo; |
2691 | 768 | } | 768 | } |
2692 | 769 | } | 769 | } |
2693 | 770 | 770 | ||
2717 | 771 | int Area::GetRootX () const | 771 | int Area::GetRootX() const |
2718 | 772 | { | 772 | { |
2719 | 773 | return GetRootGeometry ().x; | 773 | return GetRootGeometry().x; |
2720 | 774 | } | 774 | } |
2721 | 775 | 775 | ||
2722 | 776 | int Area::GetRootY () const | 776 | int Area::GetRootY() const |
2723 | 777 | { | 777 | { |
2724 | 778 | return GetRootGeometry ().y; | 778 | return GetRootGeometry().y; |
2725 | 779 | } | 779 | } |
2726 | 780 | 780 | ||
2727 | 781 | int Area::GetRootWidth () const | 781 | int Area::GetRootWidth() const |
2728 | 782 | { | 782 | { |
2729 | 783 | return GetRootGeometry ().width; | 783 | return GetRootGeometry().width; |
2730 | 784 | } | 784 | } |
2731 | 785 | 785 | ||
2732 | 786 | int Area::GetRootHeight () const | 786 | int Area::GetRootHeight() const |
2733 | 787 | { | 787 | { |
2734 | 788 | return GetRootGeometry ().height; | 788 | return GetRootGeometry().height; |
2735 | 789 | } | 789 | } |
2736 | 790 | 790 | ||
2737 | 791 | Area* Area::GetToplevel () | 791 | Area* Area::GetToplevel() |
2738 | 792 | { | 792 | { |
2739 | 793 | if (Type ().IsDerivedFromType (BaseWindow::StaticObjectType) || (this == GetWindowThread ()->GetMainLayout ())) | 793 | return GetRootParent(); |
2740 | 794 | } | ||
2741 | 795 | |||
2742 | 796 | Area* Area::GetRootParent() | ||
2743 | 797 | { | ||
2744 | 798 | if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout())) | ||
2745 | 794 | { | 799 | { |
2746 | 795 | return this; | 800 | return this; |
2747 | 796 | } | 801 | } |
2748 | 797 | 802 | ||
2750 | 798 | Area* parent = GetParentObject (); | 803 | Area* parent = GetParentObject(); |
2751 | 799 | if (!parent) //we didn't find a way to salvation! | 804 | if (!parent) //we didn't find a way to salvation! |
2752 | 800 | { | 805 | { |
2753 | 801 | return 0; | 806 | return 0; |
2754 | 802 | } | 807 | } |
2756 | 803 | return parent->GetToplevel (); | 808 | return parent->GetRootParent(); |
2757 | 804 | } | 809 | } |
2758 | 805 | 810 | ||
2760 | 806 | Area* Area::GetTopLevelViewWindow () | 811 | Area* Area::GetTopLevelViewWindow() |
2761 | 807 | { | 812 | { |
2763 | 808 | Area* area = GetToplevel (); | 813 | Area* area = GetRootParent(); |
2764 | 809 | 814 | ||
2766 | 810 | if (area && area->IsViewWindow ()) | 815 | if (area && area->IsViewWindow()) |
2767 | 811 | return area; | 816 | return area; |
2768 | 812 | 817 | ||
2769 | 813 | return NULL; | 818 | return NULL; |
2770 | 814 | } | 819 | } |
2771 | 815 | 820 | ||
2773 | 816 | bool Area::HasTopLevelParent () | 821 | bool Area::HasTopLevelParent() |
2774 | 817 | { | 822 | { |
2776 | 818 | if (GetToplevel ()) | 823 | if (GetRootParent()) |
2777 | 819 | { | 824 | { |
2778 | 820 | return true; | 825 | return true; |
2779 | 821 | } | 826 | } |
2780 | @@ -827,42 +832,15 @@ | |||
2781 | 827 | if (this == parent) | 832 | if (this == parent) |
2782 | 828 | return true; | 833 | return true; |
2783 | 829 | 834 | ||
2785 | 830 | if (!parent || !_parent_area) | 835 | if (!parent || !parent_area_) |
2786 | 831 | return false; | 836 | return false; |
2787 | 832 | 837 | ||
2821 | 833 | return _parent_area->IsChildOf(parent); | 838 | return parent_area_->IsChildOf(parent); |
2822 | 834 | } | 839 | } |
2823 | 835 | 840 | ||
2824 | 836 | /* handles our focusable code */ | 841 | void Area::QueueRelayout() |
2825 | 837 | bool Area::DoGetFocused () | 842 | { |
2826 | 838 | { | 843 | nux::GetWindowThread()->QueueObjectLayout(this); |
2794 | 839 | return _is_focused; | ||
2795 | 840 | } | ||
2796 | 841 | |||
2797 | 842 | /* Pretty much everything is going to have to override this */ | ||
2798 | 843 | void Area::DoSetFocused (bool focused) | ||
2799 | 844 | { | ||
2800 | 845 | if (_is_focused == focused) | ||
2801 | 846 | return; | ||
2802 | 847 | |||
2803 | 848 | _is_focused = focused; | ||
2804 | 849 | FocusChanged.emit (this); | ||
2805 | 850 | } | ||
2806 | 851 | |||
2807 | 852 | bool Area::DoCanFocus () | ||
2808 | 853 | { | ||
2809 | 854 | return true; | ||
2810 | 855 | } | ||
2811 | 856 | |||
2812 | 857 | /* override me! */ | ||
2813 | 858 | void Area::DoActivateFocus () | ||
2814 | 859 | { | ||
2815 | 860 | FocusActivated.emit (this); | ||
2816 | 861 | } | ||
2817 | 862 | |||
2818 | 863 | void Area::QueueRelayout () | ||
2819 | 864 | { | ||
2820 | 865 | nux::GetWindowThread ()->QueueObjectLayout (this); | ||
2827 | 866 | } | 844 | } |
2828 | 867 | 845 | ||
2829 | 868 | void Area::SetAcceptKeyboardEvent(bool accept_keyboard_event) | 846 | void Area::SetAcceptKeyboardEvent(bool accept_keyboard_event) |
2830 | @@ -885,45 +863,70 @@ | |||
2831 | 885 | return _accept_mouse_wheel_event; | 863 | return _accept_mouse_wheel_event; |
2832 | 886 | } | 864 | } |
2833 | 887 | 865 | ||
2873 | 888 | bool Area::TestMousePointerInclusion(const Point& mouse_position, NuxEventType event_type) | 866 | bool Area::TestMousePointerInclusion(const Point& mouse_position, NuxEventType event_type) |
2874 | 889 | { | 867 | { |
2875 | 890 | bool mouse_pointer_inside_area = false; | 868 | if ((IsLayout() == false) && ((visible_ == false) || |
2876 | 891 | 869 | (sensitive_ == false) || | |
2877 | 892 | if (Type().IsDerivedFromType(MenuPage::StaticObjectType)) | 870 | (view_enabled_ == false))) |
2878 | 893 | { | 871 | { |
2879 | 894 | // A MenuPage geometry is already in absolute coordinates. | 872 | // If this area is not a view and: |
2880 | 895 | mouse_pointer_inside_area = _geometry.IsInside(mouse_position); | 873 | // - it is insensitive to input event |
2881 | 896 | } | 874 | // - it is not enabled |
2882 | 897 | else | 875 | // - it is not visible |
2883 | 898 | { | 876 | // then return false. |
2884 | 899 | mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position); | 877 | return false; |
2885 | 900 | } | 878 | } |
2886 | 901 | 879 | ||
2887 | 902 | if ((event_type == NUX_MOUSE_WHEEL) && mouse_pointer_inside_area) | 880 | bool mouse_pointer_inside_area = false; |
2888 | 903 | { | 881 | |
2889 | 904 | if (_accept_mouse_wheel_event == false) | 882 | if (Type().IsDerivedFromType(MenuPage::StaticObjectType)) |
2890 | 905 | return NULL; | 883 | { |
2891 | 906 | } | 884 | // A MenuPage geometry is already in absolute coordinates. |
2892 | 907 | 885 | mouse_pointer_inside_area = geometry_.IsInside(mouse_position); | |
2893 | 908 | return mouse_pointer_inside_area; | 886 | } |
2894 | 909 | } | 887 | else |
2895 | 910 | 888 | { | |
2896 | 911 | bool Area::TestMousePointerInclusionFilterMouseWheel(const Point& mouse_position, NuxEventType event_type) | 889 | mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position); |
2897 | 912 | { | 890 | } |
2898 | 913 | bool mouse_pointer_inside_area = false; | 891 | |
2899 | 914 | 892 | if ((event_type == NUX_MOUSE_WHEEL) && mouse_pointer_inside_area) | |
2900 | 915 | if (Type().IsDerivedFromType(MenuPage::StaticObjectType)) | 893 | { |
2901 | 916 | { | 894 | if (_accept_mouse_wheel_event == false) |
2902 | 917 | // A MenuPage geometry is already in absolute coordinates. | 895 | return NULL; |
2903 | 918 | mouse_pointer_inside_area = _geometry.IsInside(mouse_position); | 896 | } |
2904 | 919 | } | 897 | |
2905 | 920 | else | 898 | return mouse_pointer_inside_area; |
2906 | 921 | { | 899 | } |
2907 | 922 | mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position); | 900 | |
2908 | 923 | } | 901 | bool Area::TestMousePointerInclusionFilterMouseWheel(const Point& mouse_position, NuxEventType event_type) |
2909 | 924 | 902 | { | |
2910 | 925 | return mouse_pointer_inside_area; | 903 | if ((IsLayout() == false) && ((visible_ == false) || |
2911 | 926 | } | 904 | (sensitive_ == false) || |
2912 | 905 | (view_enabled_ == false))) | ||
2913 | 906 | { | ||
2914 | 907 | // If this area is not a view and: | ||
2915 | 908 | // - it is insensitive to input event | ||
2916 | 909 | // - it is not enabled | ||
2917 | 910 | // - it is not visible | ||
2918 | 911 | // then return false. | ||
2919 | 912 | |||
2920 | 913 | return false; | ||
2921 | 914 | } | ||
2922 | 915 | |||
2923 | 916 | bool mouse_pointer_inside_area = false; | ||
2924 | 917 | |||
2925 | 918 | if (Type().IsDerivedFromType(MenuPage::StaticObjectType)) | ||
2926 | 919 | { | ||
2927 | 920 | // A MenuPage geometry is already in absolute coordinates. | ||
2928 | 921 | mouse_pointer_inside_area = geometry_.IsInside(mouse_position); | ||
2929 | 922 | } | ||
2930 | 923 | else | ||
2931 | 924 | { | ||
2932 | 925 | mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position); | ||
2933 | 926 | } | ||
2934 | 927 | |||
2935 | 928 | return mouse_pointer_inside_area; | ||
2936 | 929 | } | ||
2937 | 927 | 930 | ||
2938 | 928 | Area* Area::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type) | 931 | Area* Area::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type) |
2939 | 929 | { | 932 | { |
2940 | @@ -970,7 +973,7 @@ | |||
2941 | 970 | { | 973 | { |
2942 | 971 | next_object_to_key_focus_area_->ResetDownwardPathToKeyFocusArea(); | 974 | next_object_to_key_focus_area_->ResetDownwardPathToKeyFocusArea(); |
2943 | 972 | } | 975 | } |
2945 | 973 | if(next_object_to_key_focus_area_) | 976 | if (next_object_to_key_focus_area_) |
2946 | 974 | next_object_to_key_focus_area_->UnReference(); | 977 | next_object_to_key_focus_area_->UnReference(); |
2947 | 975 | 978 | ||
2948 | 976 | next_object_to_key_focus_area_ = NULL; | 979 | next_object_to_key_focus_area_ = NULL; |
2949 | @@ -979,11 +982,11 @@ | |||
2950 | 979 | void Area::ResetUpwardPathToKeyFocusArea() | 982 | void Area::ResetUpwardPathToKeyFocusArea() |
2951 | 980 | { | 983 | { |
2952 | 981 | has_key_focus_ = false; | 984 | has_key_focus_ = false; |
2954 | 982 | if (_parent_area) | 985 | if (parent_area_) |
2955 | 983 | { | 986 | { |
2957 | 984 | _parent_area->ResetUpwardPathToKeyFocusArea(); | 987 | parent_area_->ResetUpwardPathToKeyFocusArea(); |
2958 | 985 | } | 988 | } |
2960 | 986 | if(next_object_to_key_focus_area_) | 989 | if (next_object_to_key_focus_area_) |
2961 | 987 | next_object_to_key_focus_area_->UnReference(); | 990 | next_object_to_key_focus_area_->UnReference(); |
2962 | 988 | 991 | ||
2963 | 989 | next_object_to_key_focus_area_ = NULL; | 992 | next_object_to_key_focus_area_ = NULL; |
2964 | @@ -998,6 +1001,9 @@ | |||
2965 | 998 | 1001 | ||
2966 | 999 | bool Area::AcceptKeyNavFocus() | 1002 | bool Area::AcceptKeyNavFocus() |
2967 | 1000 | { | 1003 | { |
2968 | 1004 | if (GetInputEventSensitivity() == false) | ||
2969 | 1005 | return false; | ||
2970 | 1006 | |||
2971 | 1001 | return true; | 1007 | return true; |
2972 | 1002 | } | 1008 | } |
2973 | 1003 | 1009 | ||
2974 | @@ -1010,5 +1016,26 @@ | |||
2975 | 1010 | { | 1016 | { |
2976 | 1011 | return has_key_focus_; | 1017 | return has_key_focus_; |
2977 | 1012 | } | 1018 | } |
2978 | 1019 | |||
2979 | 1020 | Direction Area::GetDirection() const | ||
2980 | 1021 | { | ||
2981 | 1022 | return _direction; | ||
2982 | 1023 | } | ||
2983 | 1024 | |||
2984 | 1025 | void Area::SetDirection(Direction direction) | ||
2985 | 1026 | { | ||
2986 | 1027 | _direction = direction; | ||
2987 | 1028 | } | ||
2988 | 1029 | |||
2989 | 1030 | bool Area::IsMousePointerInside() const | ||
2990 | 1031 | { | ||
2991 | 1032 | Geometry geo = GetAbsoluteGeometry(); | ||
2992 | 1033 | Point position = GetWindowCompositor().GetMousePosition(); | ||
2993 | 1034 | |||
2994 | 1035 | if (geo.IsInside(position)) | ||
2995 | 1036 | return true; | ||
2996 | 1037 | |||
2997 | 1038 | return false; | ||
2998 | 1039 | } | ||
2999 | 1013 | } | 1040 | } |
3000 | 1014 | 1041 | ||
3001 | 1015 | 1042 | ||
3002 | === modified file 'Nux/Area.h' | |||
3003 | --- Nux/Area.h 2011-09-20 06:03:43 +0000 | |||
3004 | +++ Nux/Area.h 2011-10-25 21:32:25 +0000 | |||
3005 | @@ -26,7 +26,6 @@ | |||
3006 | 26 | #include <sigc++/sigc++.h> | 26 | #include <sigc++/sigc++.h> |
3007 | 27 | #include "NuxCore/InitiallyUnownedObject.h" | 27 | #include "NuxCore/InitiallyUnownedObject.h" |
3008 | 28 | #include "NuxGraphics/Events.h" | 28 | #include "NuxGraphics/Events.h" |
3009 | 29 | #include "Focusable.h" | ||
3010 | 30 | #include "Utils.h" | 29 | #include "Utils.h" |
3011 | 31 | #include "WidgetMetrics.h" | 30 | #include "WidgetMetrics.h" |
3012 | 32 | 31 | ||
3013 | @@ -65,11 +64,14 @@ | |||
3014 | 65 | //! Policy for and element position in the minor dimension of a layout. | 64 | //! Policy for and element position in the minor dimension of a layout. |
3015 | 66 | typedef enum | 65 | typedef enum |
3016 | 67 | { | 66 | { |
3022 | 68 | MINOR_POSITION_TOP, //!< Place the element on the top side of the layout (Hlayout) | 67 | MINOR_POSITION_START, //!< Place the element at the start of the layout(Hlayout and VLayout) |
3023 | 69 | MINOR_POSITION_BOTTOM, //!< Place the element on the bottom side of the layout (Hlayout) | 68 | MINOR_POSITION_CENTER, //!< Place the element at the center of the layout(Hlayout and VLayout) |
3024 | 70 | MINOR_POSITION_LEFT, //!< Place the element on the left side of the layout (Vlayout) | 69 | MINOR_POSITION_END, //!< Place the element at the end of the layout(Hlayout and VLayout) |
3025 | 71 | MINOR_POSITION_RIGHT, //!< Place the element on the right side of the layout (Hlayout) | 70 | MINOR_POSITION_TOP = MINOR_POSITION_START, //!< Deprecated. |
3026 | 72 | MINOR_POSITION_CENTER, //!< Place the element at the center of the layout (Hlayout and VLayout) | 71 | MINOR_POSITION_LEFT = MINOR_POSITION_START, //!< Deprecated. |
3027 | 72 | MINOR_POSITION_BOTTOM = MINOR_POSITION_END, //!< Deprecated. | ||
3028 | 73 | MINOR_POSITION_RIGHT = MINOR_POSITION_END, //!< Deprecated. | ||
3029 | 74 | |||
3030 | 73 | eAbove = MINOR_POSITION_TOP, //!< Deprecated. | 75 | eAbove = MINOR_POSITION_TOP, //!< Deprecated. |
3031 | 74 | eBelow = MINOR_POSITION_BOTTOM, //!< Deprecated. | 76 | eBelow = MINOR_POSITION_BOTTOM, //!< Deprecated. |
3032 | 75 | eLeft = MINOR_POSITION_LEFT, //!< Deprecated. | 77 | eLeft = MINOR_POSITION_LEFT, //!< Deprecated. |
3033 | @@ -84,19 +86,23 @@ | |||
3034 | 84 | */ | 86 | */ |
3035 | 85 | typedef enum | 87 | typedef enum |
3036 | 86 | { | 88 | { |
3043 | 87 | MAJOR_POSITION_TOP, //!< Stack elements at the top (for VLayout only). | 89 | MAJOR_POSITION_CENTER, //!< Stack elements in the center of the layout(for HLayout and VLayout). |
3044 | 88 | MAJOR_POSITION_BOTTOM, //!< Stack elements at the bottom (for VLayout only). | 90 | MAJOR_POSITION_START, //!< Stack elements at the begining of the layout(for HLayout and VLayout). |
3045 | 89 | MAJOR_POSITION_LEFT, //!< Stack elements at the left (for HLayout only). | 91 | MAJOR_POSITION_END, //!< Stack elements at the end of the layout(for HLayout and VLayout). |
3046 | 90 | MAJOR_POSITION_RIGHT, //!< Stack elements at the right (for HLayout only). | 92 | MAJOR_POSITION_SPREAD, //!< Spread elements evenly inside the layout(for HLayout and VLayout). |
3047 | 91 | MAJOR_POSITION_CENTER, //!< Stack elements in the center of the layout (for HLayout and VLayout). | 93 | |
3048 | 92 | MAJOR_POSITION_EXPAND, //!< Spread elements evenly inside the layout (for HLayout and VLayout). | 94 | MAJOR_POSITION_TOP = MAJOR_POSITION_START, //!< Deprecated. |
3049 | 95 | MAJOR_POSITION_BOTTOM = MAJOR_POSITION_END, //!< Deprecated. | ||
3050 | 96 | MAJOR_POSITION_LEFT = MAJOR_POSITION_START, //!< Deprecated. | ||
3051 | 97 | MAJOR_POSITION_RIGHT = MAJOR_POSITION_END, //!< Deprecated. | ||
3052 | 98 | |||
3053 | 93 | 99 | ||
3054 | 94 | eStackTop = MAJOR_POSITION_TOP, //!< Deprecated. | 100 | eStackTop = MAJOR_POSITION_TOP, //!< Deprecated. |
3055 | 95 | eStackBottom = MAJOR_POSITION_BOTTOM, //!< Deprecated. | 101 | eStackBottom = MAJOR_POSITION_BOTTOM, //!< Deprecated. |
3056 | 96 | eStackLeft = MAJOR_POSITION_LEFT, //!< Deprecated. | 102 | eStackLeft = MAJOR_POSITION_LEFT, //!< Deprecated. |
3057 | 97 | eStackRight = MAJOR_POSITION_RIGHT, //!< Deprecated. | 103 | eStackRight = MAJOR_POSITION_RIGHT, //!< Deprecated. |
3058 | 98 | eStackCenter = MAJOR_POSITION_CENTER, //!< Deprecated. | 104 | eStackCenter = MAJOR_POSITION_CENTER, //!< Deprecated. |
3060 | 99 | eStackExpand = MAJOR_POSITION_EXPAND, //!< Deprecated. | 105 | eStackExpand = MAJOR_POSITION_SPREAD, //!< Deprecated. |
3061 | 100 | } LayoutContentDistribution; | 106 | } LayoutContentDistribution; |
3062 | 101 | 107 | ||
3063 | 102 | //! For internal use only. | 108 | //! For internal use only. |
3064 | @@ -134,25 +140,21 @@ | |||
3065 | 134 | KEY_NAV_ENTER, | 140 | KEY_NAV_ENTER, |
3066 | 135 | }; | 141 | }; |
3067 | 136 | 142 | ||
3068 | 143 | typedef enum | ||
3069 | 144 | { | ||
3070 | 145 | LeftToRight, | ||
3071 | 146 | RightToLeft | ||
3072 | 147 | } Direction; | ||
3073 | 148 | |||
3074 | 137 | class Layout; | 149 | class Layout; |
3075 | 138 | class View; | 150 | class View; |
3076 | 139 | class Area; | 151 | class Area; |
3077 | 140 | 152 | ||
3079 | 141 | class Area: public InitiallyUnownedObject, public Focusable | 153 | class Area: public InitiallyUnownedObject |
3080 | 142 | { | 154 | { |
3094 | 143 | NUX_DECLARE_OBJECT_TYPE (Area, InitiallyUnownedObject); | 155 | NUX_DECLARE_OBJECT_TYPE(Area, InitiallyUnownedObject); |
3095 | 144 | public: | 156 | public: |
3096 | 145 | class LayoutProperties | 157 | Area(NUX_FILE_LINE_DECL); |
3084 | 146 | { | ||
3085 | 147 | public: | ||
3086 | 148 | virtual ~LayoutProperties () | ||
3087 | 149 | { | ||
3088 | 150 | |||
3089 | 151 | } | ||
3090 | 152 | }; | ||
3091 | 153 | |||
3092 | 154 | public: | ||
3093 | 155 | Area (NUX_FILE_LINE_DECL); | ||
3097 | 156 | virtual ~Area(); | 158 | virtual ~Area(); |
3098 | 157 | 159 | ||
3099 | 158 | int GetBaseX() const; | 160 | int GetBaseX() const; |
3100 | @@ -171,29 +173,29 @@ | |||
3101 | 171 | The size is adjusted to respect the min and max size policy | 173 | The size is adjusted to respect the min and max size policy |
3102 | 172 | \sa SetWidth(), SetHeight(), SetMinimumSize(), SetMaximumSize(). | 174 | \sa SetWidth(), SetHeight(), SetMinimumSize(), SetMaximumSize(). |
3103 | 173 | */ | 175 | */ |
3127 | 174 | void SetBaseSize (int w, int h); | 176 | virtual void SetBaseSize(int w, int h); |
3128 | 175 | 177 | ||
3129 | 176 | void SetMinimumSize(int w, int h); | 178 | virtual void SetMinimumSize(int w, int h); |
3130 | 177 | void SetMaximumSize(int w, int h); | 179 | virtual void SetMaximumSize(int w, int h); |
3131 | 178 | void SetMinMaxSize(int w, int h); | 180 | virtual void SetMinMaxSize(int w, int h); |
3132 | 179 | 181 | ||
3133 | 180 | void SetMinimumWidth(int w); | 182 | virtual void SetMinimumWidth(int w); |
3134 | 181 | void SetMaximumWidth(int w); | 183 | virtual void SetMaximumWidth(int w); |
3135 | 182 | void SetMinimumHeight(int h); | 184 | virtual void SetMinimumHeight(int h); |
3136 | 183 | void SetMaximumHeight(int h); | 185 | virtual void SetMaximumHeight(int h); |
3137 | 184 | 186 | ||
3138 | 185 | int GetMinimumWidth() const; | 187 | virtual int GetMinimumWidth() const; |
3139 | 186 | int GetMaximumWidth() const; | 188 | virtual int GetMaximumWidth() const; |
3140 | 187 | int GetMinimumHeight() const; | 189 | virtual int GetMinimumHeight() const; |
3141 | 188 | int GetMaximumHeight() const; | 190 | virtual int GetMaximumHeight() const; |
3142 | 189 | 191 | ||
3143 | 190 | void ApplyMinWidth(); | 192 | virtual void ApplyMinWidth(); |
3144 | 191 | void ApplyMinHeight(); | 193 | virtual void ApplyMinHeight(); |
3145 | 192 | void ApplyMaxWidth(); | 194 | virtual void ApplyMaxWidth(); |
3146 | 193 | void ApplyMaxHeight(); | 195 | virtual void ApplyMaxHeight(); |
3147 | 194 | 196 | ||
3148 | 195 | Size GetMinimumSize() const; | 197 | virtual Size GetMinimumSize() const; |
3149 | 196 | Size GetMaximumSize() const; | 198 | virtual Size GetMaximumSize() const; |
3150 | 197 | 199 | ||
3151 | 198 | //! Get the geometry of the object. | 200 | //! Get the geometry of the object. |
3152 | 199 | /*! | 201 | /*! |
3153 | @@ -212,7 +214,7 @@ | |||
3154 | 212 | 214 | ||
3155 | 213 | \sa SetBaseWidth(), SetBaseHeight(), SetBaseX(), SetBaseY(). | 215 | \sa SetBaseWidth(), SetBaseHeight(), SetBaseX(), SetBaseY(). |
3156 | 214 | */ | 216 | */ |
3158 | 215 | void SetGeometry (int x, int y, int w, int h); | 217 | void SetGeometry(int x, int y, int w, int h); |
3159 | 216 | 218 | ||
3160 | 217 | //! Set the geometry of the object. | 219 | //! Set the geometry of the object. |
3161 | 218 | /*! | 220 | /*! |
3162 | @@ -222,32 +224,36 @@ | |||
3163 | 222 | @param geo Geometry object. | 224 | @param geo Geometry object. |
3164 | 223 | \sa SetWidth(), SetHeight(), SetX(), SetY(). | 225 | \sa SetWidth(), SetHeight(), SetX(), SetY(). |
3165 | 224 | */ | 226 | */ |
3171 | 225 | void SetGeometry (const Geometry &geo); | 227 | void SetGeometry(const Geometry &geo); |
3172 | 226 | 228 | ||
3173 | 227 | void IncreaseSize (int x, int y); | 229 | void IncreaseSize(int x, int y); |
3174 | 228 | 230 | ||
3175 | 229 | void SetBaseString (const TCHAR *Caption); | 231 | void SetBaseString(const char *Caption); |
3176 | 230 | const NString &GetBaseString() const; | 232 | const NString &GetBaseString() const; |
3177 | 231 | 233 | ||
3179 | 232 | //! Return the Top level parent of this area. | 234 | //! Deprecated. Use GetToplevel. |
3180 | 235 | Area* GetToplevel(); | ||
3181 | 236 | |||
3182 | 237 | //! Return the root parent of the rendering tree for this area. | ||
3183 | 233 | /*! | 238 | /*! |
3185 | 234 | The top Level parent is either a BaseWindow or the main layout. | 239 | The root parent of the rendering tree is either a BaseWindow or the main layout. |
3186 | 240 | If the object isn't hooked to the rendering tree the function returns NULL. | ||
3187 | 235 | 241 | ||
3189 | 236 | @return The top level parent or Null. | 242 | @return The root parent of the rendering tree or NULL. |
3190 | 237 | */ | 243 | */ |
3192 | 238 | Area * GetToplevel (); | 244 | Area* GetRootParent(); |
3193 | 239 | 245 | ||
3194 | 240 | //! Return the Top level BaseWindow of this area. | 246 | //! Return the Top level BaseWindow of this area. |
3195 | 241 | /*! | 247 | /*! |
3196 | 242 | @return The top level BaseWindow or NULL. | 248 | @return The top level BaseWindow or NULL. |
3197 | 243 | */ | 249 | */ |
3199 | 244 | Area * GetTopLevelViewWindow (); | 250 | Area* GetTopLevelViewWindow(); |
3200 | 245 | 251 | ||
3201 | 246 | //! Return true is this area has a top level parent. | 252 | //! Return true is this area has a top level parent. |
3202 | 247 | /*! | 253 | /*! |
3203 | 248 | @return True if this area has a top level parent. | 254 | @return True if this area has a top level parent. |
3204 | 249 | */ | 255 | */ |
3206 | 250 | bool HasTopLevelParent (); | 256 | bool HasTopLevelParent(); |
3207 | 251 | 257 | ||
3208 | 252 | //! Return true is area is a child of the given parent in the widget tree. | 258 | //! Return true is area is a child of the given parent in the widget tree. |
3209 | 253 | /*! | 259 | /*! |
3210 | @@ -260,7 +266,7 @@ | |||
3211 | 260 | Test if a point is inside the area. | 266 | Test if a point is inside the area. |
3212 | 261 | 267 | ||
3213 | 262 | @param p A 2D point. | 268 | @param p A 2D point. |
3215 | 263 | @param event_type The type of mouse event (a parameter of FindAreaUnderMouse). | 269 | @param event_type The type of mouse event(a parameter of FindAreaUnderMouse). |
3216 | 264 | 270 | ||
3217 | 265 | @return True if p is located inside the Area. | 271 | @return True if p is located inside the Area. |
3218 | 266 | */ | 272 | */ |
3219 | @@ -270,7 +276,7 @@ | |||
3220 | 270 | Test if a point is inside the area and if the area accepts mouse wheel events. | 276 | Test if a point is inside the area and if the area accepts mouse wheel events. |
3221 | 271 | 277 | ||
3222 | 272 | @param p A 2D point. | 278 | @param p A 2D point. |
3224 | 273 | @param event_type The type of mouse event (a parameter of FindAreaUnderMouse). | 279 | @param event_type The type of mouse event(a parameter of FindAreaUnderMouse). |
3225 | 274 | @param filter_mouse_wheel_event If the event type is NUX_MOUSE_WHEEL and the mouse is over this area and this | 280 | @param filter_mouse_wheel_event If the event type is NUX_MOUSE_WHEEL and the mouse is over this area and this |
3226 | 275 | area does not accept mouse wheel events, then return false. | 281 | area does not accept mouse wheel events, then return false. |
3227 | 276 | 282 | ||
3228 | @@ -278,34 +284,23 @@ | |||
3229 | 278 | */ | 284 | */ |
3230 | 279 | bool TestMousePointerInclusionFilterMouseWheel(const Point& mouse_position, NuxEventType event); | 285 | bool TestMousePointerInclusionFilterMouseWheel(const Point& mouse_position, NuxEventType event); |
3231 | 280 | 286 | ||
3260 | 281 | virtual long ComputeChildLayout (); | 287 | //! Test if the muse pointer is inside the area. |
3261 | 282 | virtual void PositionChildLayout (float offsetX, float offsetY); | 288 | /*! |
3262 | 283 | virtual long ComputeLayout2 (); | 289 | Return true if the mouse pointer is inside the area. |
3263 | 284 | virtual void ComputePosition2 (float offsetX, float offsetY); | 290 | |
3264 | 285 | 291 | @return True if the mouse pointer is inside the area. | |
3265 | 286 | virtual bool IsArea () const; | 292 | */ |
3266 | 287 | virtual bool IsInputArea () const; | 293 | bool IsMousePointerInside() const; |
3267 | 288 | virtual bool IsView () const; | 294 | |
3268 | 289 | virtual bool IsLayout () const; | 295 | virtual long ComputeContentSize(); |
3269 | 290 | virtual bool IsSpaceLayout () const; | 296 | virtual void ComputeContentPosition(float offsetX, float offsetY); |
3270 | 291 | virtual bool IsViewWindow () const; | 297 | |
3271 | 292 | 298 | virtual bool IsArea() const; | |
3272 | 293 | //! Set the layout properties for this area | 299 | virtual bool IsInputArea() const; |
3273 | 294 | /*! | 300 | virtual bool IsView() const; |
3274 | 295 | Allows the Layout managing this area to store the properties specifc to this area. Layouts | 301 | virtual bool IsLayout() const; |
3275 | 296 | should create a sub-class of LayoutProperties. The LayoutProperties of an area will | 302 | virtual bool IsSpaceLayout() const; |
3276 | 297 | be deleted upon destruction. | 303 | virtual bool IsViewWindow() const; |
3249 | 298 | @param properties the LayoutProperties sub-class associated with this area. Can be NULL to | ||
3250 | 299 | unset. | ||
3251 | 300 | */ | ||
3252 | 301 | void SetLayoutProperties (LayoutProperties *properties); | ||
3253 | 302 | |||
3254 | 303 | //! Get the layout properties for this area | ||
3255 | 304 | /*! | ||
3256 | 305 | Retrieves the LayoutProperties sub-class with this area. See SetLayoutProperties | ||
3257 | 306 | @return LayoutProperties sub-class associated with this area. | ||
3258 | 307 | */ | ||
3259 | 308 | LayoutProperties * GetLayoutProperties (); | ||
3277 | 309 | 304 | ||
3278 | 310 | Area * GetParentObject() const; | 305 | Area * GetParentObject() const; |
3279 | 311 | 306 | ||
3280 | @@ -314,36 +309,41 @@ | |||
3281 | 314 | If visible, an area will be drawn. Default: true. | 309 | If visible, an area will be drawn. Default: true. |
3282 | 315 | @param visible if the area is visible to the user | 310 | @param visible if the area is visible to the user |
3283 | 316 | */ | 311 | */ |
3285 | 317 | void SetVisible (bool visible); | 312 | void SetVisible(bool visible); |
3286 | 318 | 313 | ||
3287 | 319 | //! Get the visibility of the area | 314 | //! Get the visibility of the area |
3288 | 320 | /*! | 315 | /*! |
3289 | 321 | Gets whether the area is visible to the user and will be visible to the user. Default is true. | 316 | Gets whether the area is visible to the user and will be visible to the user. Default is true. |
3290 | 322 | @return whether the area is visible | 317 | @return whether the area is visible |
3291 | 323 | */ | 318 | */ |
3295 | 324 | bool IsVisible (); | 319 | bool IsVisible(); |
3296 | 325 | 320 | ||
3297 | 326 | //! Set sensitivity of the area | 321 | //! Deprecated. Use SetInputEventSensitivity. |
3298 | 322 | void SetSensitive(bool); | ||
3299 | 323 | |||
3300 | 324 | //! Set input event sensitivity of the area. | ||
3301 | 327 | /*! | 325 | /*! |
3304 | 328 | If sensitive, an area will receive input events. Default is true. | 326 | A insensitive Area will not receive input events.\n |
3305 | 329 | @param if the area should receive input events | 327 | If the Area has a layout, the event will be passed down to it. Sensitivity only control an area's ability to receive input events(keyboard, mouse, touch). |
3306 | 328 | An area that is not sensitive will return false in \a TestMousePointerInclusion, \a TestMousePointerInclusionFilterMouseWheel and \a AcceptKeyNavFocus.\n | ||
3307 | 329 | Sensitivity does not affect layouts since they do not process events. | ||
3308 | 330 | |||
3309 | 331 | By default, an area is sensitive. | ||
3310 | 332 | |||
3311 | 333 | @param sensitive If the area should receive input events | ||
3312 | 330 | */ | 334 | */ |
3316 | 331 | void SetSensitive (bool sensitive); | 335 | void SetInputEventSensitivity(bool sensitive); |
3317 | 332 | 336 | ||
3318 | 333 | //! Get whether the area is sensitive | 337 | //! Deprecated. Use GetInputEventSensitivity. |
3319 | 338 | bool IsSensitive() const; | ||
3320 | 339 | |||
3321 | 340 | //! Get input event sensitivity of the area is sensitive | ||
3322 | 334 | /*! | 341 | /*! |
3323 | 335 | Gets whether the area is sensitive to input events | 342 | Gets whether the area is sensitive to input events |
3324 | 336 | @return whether the area is visible | 343 | @return whether the area is visible |
3325 | 337 | */ | 344 | */ |
3327 | 338 | bool IsSensitive (); | 345 | bool GetInputEventSensitivity() const; |
3328 | 339 | 346 | ||
3329 | 340 | virtual bool DoGetFocused (); | ||
3330 | 341 | virtual void DoSetFocused (bool focused); | ||
3331 | 342 | virtual bool DoCanFocus (); | ||
3332 | 343 | virtual void DoActivateFocus (); | ||
3333 | 344 | |||
3334 | 345 | sigc::signal<void, Area *> FocusActivated; | ||
3335 | 346 | sigc::signal<void, Area *> FocusChanged; | ||
3336 | 347 | sigc::signal<void, Area*> ChildFocusChanged; // sends parent + child | 347 | sigc::signal<void, Area*> ChildFocusChanged; // sends parent + child |
3337 | 348 | 348 | ||
3338 | 349 | /*! | 349 | /*! |
3339 | @@ -358,106 +358,132 @@ | |||
3340 | 358 | /*! | 358 | /*! |
3341 | 359 | Queues a relayout before the next paint cycle. This is safe to call multiple times within a cycle. | 359 | Queues a relayout before the next paint cycle. This is safe to call multiple times within a cycle. |
3342 | 360 | */ | 360 | */ |
3347 | 361 | void QueueRelayout (); | 361 | void QueueRelayout(); |
3348 | 362 | 362 | ||
3349 | 363 | virtual unsigned int GetStretchFactor(); | 363 | //! Get the area scale factor. |
3350 | 364 | virtual void SetStretchFactor (unsigned int sf); | 364 | /*! |
3351 | 365 | The scale factor is used to control the layout of area objects inside HLayout and VLayout. | ||
3352 | 366 | \sa HLayout, VLayout. | ||
3353 | 367 | |||
3354 | 368 | @return the Area scale factor. | ||
3355 | 369 | */ | ||
3356 | 370 | virtual unsigned int GetScaleFactor(); | ||
3357 | 371 | |||
3358 | 372 | //! Set the area scale factor. | ||
3359 | 373 | /*! | ||
3360 | 374 | The scale factor is used to control the layout of area objects inside HLayout and VLayout. | ||
3361 | 375 | \sa HLayout, VLayout. | ||
3362 | 376 | |||
3363 | 377 | @param the scale factor. | ||
3364 | 378 | */ | ||
3365 | 379 | virtual void SetScaleFactor(unsigned int sf); | ||
3366 | 365 | 380 | ||
3367 | 366 | virtual MinorDimensionPosition GetPositioning(); | 381 | virtual MinorDimensionPosition GetPositioning(); |
3369 | 367 | virtual void SetPositioning (MinorDimensionPosition p); | 382 | virtual void SetPositioning(MinorDimensionPosition p); |
3370 | 368 | 383 | ||
3371 | 369 | virtual MinorDimensionSize GetExtend(); | 384 | virtual MinorDimensionSize GetExtend(); |
3373 | 370 | virtual void SetExtend (MinorDimensionSize ext); | 385 | virtual void SetExtend(MinorDimensionSize ext); |
3374 | 371 | 386 | ||
3375 | 372 | virtual float GetPercentage(); | 387 | virtual float GetPercentage(); |
3377 | 373 | virtual void SetPercentage (float f); | 388 | virtual void SetPercentage(float f); |
3378 | 374 | virtual bool IsLayoutDone(); | 389 | virtual bool IsLayoutDone(); |
3387 | 375 | virtual void SetLayoutDone (bool b); | 390 | virtual void SetLayoutDone(bool b); |
3388 | 376 | 391 | ||
3389 | 377 | void Set2DMatrix (const Matrix4 &mat); | 392 | void Set2DMatrix(const Matrix4 &mat); |
3390 | 378 | void Set2DTranslation (float tx, float ty, float tz); | 393 | void Set2DTranslation(float tx, float ty, float tz); |
3391 | 379 | Matrix4 Get2DMatrix () const; | 394 | Matrix4 Get2DMatrix() const; |
3392 | 380 | 395 | ||
3393 | 381 | Matrix4 Get3DMatrix () const; | 396 | Matrix4 Get3DMatrix() const; |
3394 | 382 | bool Is3DArea () const; | 397 | bool Is3DArea() const; |
3395 | 383 | 398 | ||
3396 | 384 | //! Return the position of this object with regard to its top left corner of the physical window. | 399 | //! Return the position of this object with regard to its top left corner of the physical window. |
3397 | 385 | /*! | 400 | /*! |
3398 | 386 | Return the position of the Area inside the physical window. | 401 | Return the position of the Area inside the physical window. |
3399 | 387 | For the main layout set in WindowThread, The following functions are equivalent: | 402 | For the main layout set in WindowThread, The following functions are equivalent: |
3403 | 388 | \li GetGeometry () | 403 | \li GetGeometry() |
3404 | 389 | \li GetRootGeometry () | 404 | \li GetRootGeometry() |
3405 | 390 | \li GetAbsoluteGeometry () | 405 | \li GetAbsoluteGeometry() |
3406 | 391 | */ | 406 | */ |
3408 | 392 | virtual Geometry GetAbsoluteGeometry () const; | 407 | virtual Geometry GetAbsoluteGeometry() const; |
3409 | 393 | 408 | ||
3410 | 394 | //! Return the area absolute x coordinate. | 409 | //! Return the area absolute x coordinate. |
3412 | 395 | int GetAbsoluteX () const; | 410 | int GetAbsoluteX() const; |
3413 | 396 | 411 | ||
3414 | 397 | //! Return the area absolute y coordinate. | 412 | //! Return the area absolute y coordinate. |
3416 | 398 | int GetAbsoluteY () const; | 413 | int GetAbsoluteY() const; |
3417 | 399 | 414 | ||
3418 | 400 | //! Return the area absolute width. | 415 | //! Return the area absolute width. |
3419 | 401 | /*! | 416 | /*! |
3421 | 402 | As long as _2d_xform contains only translations, the absolute width is the same as value returned by GetBaseWidth (); | 417 | As long as _2d_xform contains only translations, the absolute width is the same as value returned by GetBaseWidth(); |
3422 | 403 | */ | 418 | */ |
3424 | 404 | int GetAbsoluteWidth () const; | 419 | int GetAbsoluteWidth() const; |
3425 | 405 | 420 | ||
3426 | 406 | //! Return the area absolute height. | 421 | //! Return the area absolute height. |
3427 | 407 | /*! | 422 | /*! |
3429 | 408 | As long as _2d_xform contains only translations, the absolute height is the same as value returned by GetBaseHeight (); | 423 | As long as _2d_xform contains only translations, the absolute height is the same as value returned by GetBaseHeight(); |
3430 | 409 | */ | 424 | */ |
3432 | 410 | int GetAbsoluteHeight () const; | 425 | int GetAbsoluteHeight() const; |
3433 | 411 | 426 | ||
3435 | 412 | //! Return the position of this object with regard to its top level parent (the main layout or a BaseWindow). | 427 | //! Return the position of this object with regard to its top level parent(the main layout or a BaseWindow). |
3436 | 413 | /*! | 428 | /*! |
3437 | 414 | Return the position of the Area inside the physical window. | 429 | Return the position of the Area inside the physical window. |
3439 | 415 | For the main layout set in WindowThread or for a BaseWindow, GetRootGeometry () is equivalent to GetGeometry (). | 430 | For the main layout set in WindowThread or for a BaseWindow, GetRootGeometry() is equivalent to GetGeometry(). |
3440 | 416 | */ | 431 | */ |
3442 | 417 | virtual Geometry GetRootGeometry () const; | 432 | virtual Geometry GetRootGeometry() const; |
3443 | 418 | 433 | ||
3444 | 419 | //! Return the area root x coordinate. | 434 | //! Return the area root x coordinate. |
3446 | 420 | int GetRootX () const; | 435 | int GetRootX() const; |
3447 | 421 | 436 | ||
3448 | 422 | //! Return the area root y coordinate. | 437 | //! Return the area root y coordinate. |
3450 | 423 | int GetRootY () const; | 438 | int GetRootY() const; |
3451 | 424 | 439 | ||
3452 | 425 | //! Return the area root width. | 440 | //! Return the area root width. |
3453 | 426 | /*! | 441 | /*! |
3455 | 427 | As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth (); | 442 | As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth(); |
3456 | 428 | */ | 443 | */ |
3458 | 429 | int GetRootWidth () const; | 444 | int GetRootWidth() const; |
3459 | 430 | 445 | ||
3460 | 431 | //! Return the area root height. | 446 | //! Return the area root height. |
3461 | 432 | /*! | 447 | /*! |
3463 | 433 | As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth (); | 448 | As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth(); |
3464 | 434 | */ | 449 | */ |
3466 | 435 | int GetRootHeight () const; | 450 | int GetRootHeight() const; |
3467 | 436 | 451 | ||
3468 | 437 | sigc::signal<void, int, int, int, int> OnResize; //!< Signal emitted when an area is resized. | 452 | sigc::signal<void, int, int, int, int> OnResize; //!< Signal emitted when an area is resized. |
3469 | 438 | sigc::signal<void, Area *, bool> OnVisibleChanged; | 453 | sigc::signal<void, Area *, bool> OnVisibleChanged; |
3470 | 439 | sigc::signal<void, Area *, bool> OnSensitiveChanged; | 454 | sigc::signal<void, Area *, bool> OnSensitiveChanged; |
3471 | 455 | |||
3472 | 456 | /*! | ||
3473 | 457 | This signal is only meant to inform of a change of size. When receiving this signal don't do anything | ||
3474 | 458 | that could change the size of this object. Or you risk creating an infinite loop. | ||
3475 | 459 | */ | ||
3476 | 440 | sigc::signal<void, Area *, Geometry&> OnGeometryChanged; | 460 | sigc::signal<void, Area *, Geometry&> OnGeometryChanged; |
3477 | 441 | 461 | ||
3478 | 442 | /*! | 462 | /*! |
3480 | 443 | SetParentObject/UnParentObject are protected API. it is not meant to be used directly by users. | 463 | SetParentObject/UnParentObject are protected API. They are not meant to be used directly by users. |
3481 | 444 | Users add widgets to layouts and layout have to be attached to a composition for objects to be rendered. | 464 | Users add widgets to layouts and layout have to be attached to a composition for objects to be rendered. |
3482 | 445 | Setting a parent to and child widget does not mean that when the parent is rendered, the child is also rendered. | 465 | Setting a parent to and child widget does not mean that when the parent is rendered, the child is also rendered. |
3487 | 446 | For instance, setting a button the be the child of a check-box means absolutely nothing is terms of rendering. | 466 | For instance, setting a button to be the child of a check-box means absolutely nothing is terms of rendering. |
3488 | 447 | A widget with a parent cannot be added to a added to a layout for rendering. The widget has to be un-parented first. | 467 | The check-box draw function would have to be aware of the existence of the button in order to render it.\n |
3489 | 448 | A layout with a parent cannot be added to a widget or another layout for rendering. The layout has to be un-parented first. | 468 | A view with a parent cannot be parented to another area for rendering. It has to be un-parented first.\n |
3490 | 449 | In essence only View and Layouts should be calling SetParentObject/UnParentObject. | 469 | A layout with a parent cannot be parented to another area for rendering. It has to be un-parented first.\n |
3491 | 470 | In essence only View and Layouts should be calling SetParentObject/UnParentObject.\n | ||
3492 | 471 | SetParentObject returns true if it was successful. | ||
3493 | 472 | |||
3494 | 473 | |||
3495 | 474 | @param parent The object that will become the parent of this area. | ||
3496 | 475 | @return True if the object is successfully parented. | ||
3497 | 450 | */ | 476 | */ |
3499 | 451 | virtual void SetParentObject (Area *); | 477 | virtual bool SetParentObject(Area *parent); |
3500 | 452 | 478 | ||
3501 | 453 | //! Un-parent and area | 479 | //! Un-parent and area |
3502 | 454 | /*! | 480 | /*! |
3503 | 455 | For un-parented areas the following functions are equivalent: | 481 | For un-parented areas the following functions are equivalent: |
3507 | 456 | \li GetGeometry () | 482 | \li GetGeometry() |
3508 | 457 | \li GetRootGeometry () | 483 | \li GetRootGeometry() |
3509 | 458 | \li GetAbsoluteGeometry () | 484 | \li GetAbsoluteGeometry() |
3510 | 459 | */ | 485 | */ |
3512 | 460 | virtual void UnParentObject (); | 486 | virtual void UnParentObject(); |
3513 | 461 | 487 | ||
3514 | 462 | /*! | 488 | /*! |
3515 | 463 | Return the area under the mouse pointer. | 489 | Return the area under the mouse pointer. |
3516 | @@ -491,7 +517,7 @@ | |||
3517 | 491 | When the geometry of an area changes, the new geometry can be recursively propagated to all its | 517 | When the geometry of an area changes, the new geometry can be recursively propagated to all its |
3518 | 492 | parent so a layout reconfiguration is initiated. | 518 | parent so a layout reconfiguration is initiated. |
3519 | 493 | \sa ReconfigureParentLayout() | 519 | \sa ReconfigureParentLayout() |
3521 | 494 | \sa _on_geometry_changeg_reconfigure_parent_layout | 520 | \sa on_geometry_change_reconfigure_parent_layout_ |
3522 | 495 | 521 | ||
3523 | 496 | @param reconfigure_parent_layout Set it to True to reconfigure this area parent layouts. | 522 | @param reconfigure_parent_layout Set it to True to reconfigure this area parent layouts. |
3524 | 497 | */ | 523 | */ |
3525 | @@ -527,37 +553,53 @@ | |||
3526 | 527 | */ | 553 | */ |
3527 | 528 | bool AcceptMouseWheelEvent() const; | 554 | bool AcceptMouseWheelEvent() const; |
3528 | 529 | 555 | ||
3529 | 556 | //! Return the direction of the area. | ||
3530 | 557 | Direction GetDirection() const; | ||
3531 | 558 | //! Sets the direction of the area. | ||
3532 | 559 | /*! | ||
3533 | 560 | @param direction Either nux::LeftToRight or nux::RightToLeft | ||
3534 | 561 | */ | ||
3535 | 562 | void SetDirection(Direction direction); | ||
3536 | 563 | |||
3537 | 530 | protected: | 564 | protected: |
3538 | 531 | bool _is_focused; | ||
3539 | 532 | /* | 565 | /* |
3540 | 533 | This function is reimplemented in Layout as it need to perform some special operations. | 566 | This function is reimplemented in Layout as it need to perform some special operations. |
3541 | 534 | It does nothing for Area and View classes. | 567 | It does nothing for Area and View classes. |
3542 | 535 | */ | 568 | */ |
3543 | 536 | //virtual void RemoveChildObject(smptr(Area)); | 569 | //virtual void RemoveChildObject(smptr(Area)); |
3544 | 537 | 570 | ||
3547 | 538 | virtual void GeometryChangePending () {} | 571 | /*! |
3548 | 539 | virtual void GeometryChanged () {} | 572 | This signal is only meant to inform that the size is about to change. When overriding this function, |
3549 | 573 | don't do anything that could change the size of this object. Or you risk creating an infinite loop. | ||
3550 | 574 | */ | ||
3551 | 575 | virtual void GeometryChangePending() {} | ||
3552 | 576 | |||
3553 | 577 | /*! | ||
3554 | 578 | This signal is only meant to inform that the size has changed. When overriding this function, | ||
3555 | 579 | don't do anything that could change the size of this object. Or you risk creating an infinite loop. | ||
3556 | 580 | */ | ||
3557 | 581 | virtual void GeometryChanged() {} | ||
3558 | 540 | 582 | ||
3559 | 541 | //! Request a Layout recompute after a change of size | 583 | //! Request a Layout recompute after a change of size |
3560 | 542 | /* | 584 | /* |
3561 | 543 | When an object size changes, it is necessary for its parent structure to initiate a layout | 585 | When an object size changes, it is necessary for its parent structure to initiate a layout |
3562 | 544 | re computation in order preserve the layout structure defined by the user through the API. | 586 | re computation in order preserve the layout structure defined by the user through the API. |
3563 | 545 | */ | 587 | */ |
3571 | 546 | virtual void RequestBottomUpLayoutComputation (Area *bo_initiator); | 588 | virtual void RequestBottomUpLayoutComputation(Area *bo_initiator); |
3572 | 547 | 589 | ||
3573 | 548 | //! Return the absolute geometry starting with a relative geometry passed as argument. | 590 | //! Return the absolute geometry starting with a relative geometry passed as argument. |
3574 | 549 | void InnerGetAbsoluteGeometry (Geometry &geometry); | 591 | void InnerGetAbsoluteGeometry(Geometry &geometry); |
3575 | 550 | 592 | ||
3576 | 551 | //! Return the absolute geometry starting with a relative geometry passed as argument. | 593 | //! Return the absolute geometry starting with a relative geometry passed as argument. |
3577 | 552 | void InnerGetRootGeometry (Geometry &geometry); | 594 | void InnerGetRootGeometry(Geometry &geometry); |
3578 | 553 | 595 | ||
3579 | 554 | // //! Add a "secondary" child to this Area. The | 596 | // //! Add a "secondary" child to this Area. The |
3580 | 555 | // /*! | 597 | // /*! |
3581 | 556 | // @return True if the child has been added; False otherwise; | 598 | // @return True if the child has been added; False otherwise; |
3582 | 557 | // */ | 599 | // */ |
3584 | 558 | // bool Secondary (Area *child); | 600 | // bool Secondary(Area *child); |
3585 | 559 | 601 | ||
3587 | 560 | bool _on_geometry_changeg_reconfigure_parent_layout; | 602 | bool on_geometry_change_reconfigure_parent_layout_; |
3588 | 561 | 603 | ||
3589 | 562 | bool has_key_focus_; | 604 | bool has_key_focus_; |
3590 | 563 | 605 | ||
3591 | @@ -568,32 +610,32 @@ | |||
3592 | 568 | void CheckMaxSize(); | 610 | void CheckMaxSize(); |
3593 | 569 | 611 | ||
3594 | 570 | 612 | ||
3596 | 571 | Geometry _geometry; //!< The area geometry. | 613 | Geometry geometry_; //!< The area geometry. |
3597 | 572 | 614 | ||
3598 | 573 | //! Define a parent child structure | 615 | //! Define a parent child structure |
3599 | 574 | /* | 616 | /* |
3600 | 575 | An object of the class Area may have another of the class Layout as Parent. | 617 | An object of the class Area may have another of the class Layout as Parent. |
3601 | 576 | An object of the class View may have an object of the class Layout as parent. | 618 | An object of the class View may have an object of the class Layout as parent. |
3602 | 577 | An object of the class Layout may have a parent of the class Layout or View as parent. | 619 | An object of the class Layout may have a parent of the class Layout or View as parent. |
3604 | 578 | A Area cannot have children (that may change later). | 620 | A Area cannot have children(that may change later). |
3605 | 579 | */ | 621 | */ |
3608 | 580 | Area *_parent_area; | 622 | Area *parent_area_; |
3607 | 581 | |||
3609 | 582 | 623 | ||
3613 | 583 | LayoutProperties *_layout_properties; | 624 | bool visible_; //!< Visible state of the area. |
3614 | 584 | bool _visible; | 625 | bool sensitive_; //!< Input sensitive state of the area |
3615 | 585 | bool _sensitive; | 626 | bool view_enabled_; //!< The enable state of a view. |
3616 | 586 | 627 | ||
3617 | 587 | NString _base_string; //!< A text string property for this area. | 628 | NString _base_string; //!< A text string property for this area. |
3618 | 588 | 629 | ||
3621 | 589 | Size _min_size; //!< A text string property for this area. | 630 | Size min_size_; //!< A text string property for this area. |
3622 | 590 | Size _max_size; //!< A text string property for this area. | 631 | Size max_size_; //!< A text string property for this area. |
3623 | 591 | 632 | ||
3629 | 592 | unsigned int _stretch_factor; //!< Factor for element expansion. | 633 | // Parameters used in layouts |
3630 | 593 | MinorDimensionPosition _positioning; //!< Area position hint | 634 | unsigned int scale_factor_; //!< Factor for element expansion. |
3631 | 594 | MinorDimensionSize _extend; //!< Area dimension hint | 635 | MinorDimensionPosition minor_axis_position_; //!< Area position hint |
3632 | 595 | float _percentage; //!< Area size percentage value. | 636 | MinorDimensionSize minor_axis_size_; //!< Area dimension hint |
3633 | 596 | bool _layout_done; //!< Area layout status flag. | 637 | float minor_axis_size_scale_; //!< Area size percentage value. |
3634 | 638 | bool layout_done_; //!< Area layout status flag. | ||
3635 | 597 | 639 | ||
3636 | 598 | 640 | ||
3637 | 599 | Matrix4 _2d_xform; //!< 2D transformation matrix for this area and its children. Contains only translations. | 641 | Matrix4 _2d_xform; //!< 2D transformation matrix for this area and its children. Contains only translations. |
3638 | @@ -605,6 +647,8 @@ | |||
3639 | 605 | bool _accept_mouse_wheel_event; | 647 | bool _accept_mouse_wheel_event; |
3640 | 606 | bool _accept_keyboard_event; | 648 | bool _accept_keyboard_event; |
3641 | 607 | 649 | ||
3642 | 650 | Direction _direction; | ||
3643 | 651 | |||
3644 | 608 | friend class Layout; | 652 | friend class Layout; |
3645 | 609 | friend class View; | 653 | friend class View; |
3646 | 610 | friend class WindowThread; | 654 | friend class WindowThread; |
3647 | 611 | 655 | ||
3648 | === modified file 'Nux/BaseWindow.cpp' | |||
3649 | --- Nux/BaseWindow.cpp 2011-09-20 06:03:43 +0000 | |||
3650 | +++ Nux/BaseWindow.cpp 2011-10-25 21:32:25 +0000 | |||
3651 | @@ -32,7 +32,7 @@ | |||
3652 | 32 | namespace nux | 32 | namespace nux |
3653 | 33 | { | 33 | { |
3654 | 34 | 34 | ||
3656 | 35 | NUX_IMPLEMENT_OBJECT_TYPE (BaseWindow); | 35 | NUX_IMPLEMENT_OBJECT_TYPE(BaseWindow); |
3657 | 36 | 36 | ||
3658 | 37 | const int SizeGripWidth = 20; | 37 | const int SizeGripWidth = 20; |
3659 | 38 | const int SizeGripHeight = 20; | 38 | const int SizeGripHeight = 20; |
3660 | @@ -44,10 +44,10 @@ | |||
3661 | 44 | pass the top-left corner position of the window. When drawing, make a similar adjustment. | 44 | pass the top-left corner position of the window. When drawing, make a similar adjustment. |
3662 | 45 | */ | 45 | */ |
3663 | 46 | 46 | ||
3666 | 47 | BaseWindow::BaseWindow (const TCHAR *WindowName, NUX_FILE_LINE_DECL) | 47 | BaseWindow::BaseWindow(const char *WindowName, NUX_FILE_LINE_DECL) |
3667 | 48 | : View (NUX_FILE_LINE_PARAM) | 48 | : View(NUX_FILE_LINE_PARAM) |
3668 | 49 | , _paint_layer(new ColorLayer(Color(0xFF707070))) | 49 | , _paint_layer(new ColorLayer(Color(0xFF707070))) |
3670 | 50 | , _opacity (1.0f) | 50 | , _opacity(1.0f) |
3671 | 51 | { | 51 | { |
3672 | 52 | premultiply = true; | 52 | premultiply = true; |
3673 | 53 | _name = WindowName; | 53 | _name = WindowName; |
3674 | @@ -70,9 +70,9 @@ | |||
3675 | 70 | accept_key_nav_focus_ = false; | 70 | accept_key_nav_focus_ = false; |
3676 | 71 | 71 | ||
3677 | 72 | // Should be at the end of the constructor | 72 | // Should be at the end of the constructor |
3679 | 73 | GetWindowCompositor().RegisterWindow (this); | 73 | GetWindowCompositor().RegisterWindow(this); |
3680 | 74 | 74 | ||
3682 | 75 | SetMinimumSize (1, 1); | 75 | SetMinimumSize(1, 1); |
3683 | 76 | SetGeometry(Geometry(100, 100, 320, 200)); | 76 | SetGeometry(Geometry(100, 100, 320, 200)); |
3684 | 77 | } | 77 | } |
3685 | 78 | 78 | ||
3686 | @@ -80,7 +80,7 @@ | |||
3687 | 80 | { | 80 | { |
3688 | 81 | if (_enter_focus_input_area) | 81 | if (_enter_focus_input_area) |
3689 | 82 | { | 82 | { |
3691 | 83 | _enter_focus_input_area->UnReference (); | 83 | _enter_focus_input_area->UnReference(); |
3692 | 84 | } | 84 | } |
3693 | 85 | 85 | ||
3694 | 86 | #if defined(NUX_OS_LINUX) | 86 | #if defined(NUX_OS_LINUX) |
3695 | @@ -89,160 +89,90 @@ | |||
3696 | 89 | #endif | 89 | #endif |
3697 | 90 | } | 90 | } |
3698 | 91 | 91 | ||
3699 | 92 | long BaseWindow::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) | ||
3700 | 93 | { | ||
3701 | 94 | long ret = TraverseInfo; | ||
3702 | 95 | long ProcEvInfo = 0; | ||
3703 | 96 | |||
3704 | 97 | IEvent window_event = ievent; | ||
3705 | 98 | Geometry base = GetGeometry(); | ||
3706 | 99 | window_event.e_x_root = base.x; | ||
3707 | 100 | window_event.e_y_root = base.y; | ||
3708 | 101 | |||
3709 | 102 | // The child layout get the Mouse down button only if the MouseDown happened inside the client view Area | ||
3710 | 103 | Geometry viewGeometry = GetGeometry(); | ||
3711 | 104 | |||
3712 | 105 | if (ievent.e_event == NUX_MOUSE_PRESSED) | ||
3713 | 106 | { | ||
3714 | 107 | if (!viewGeometry.IsPointInside (ievent.e_x - ievent.e_x_root, ievent.e_y - ievent.e_y_root) ) | ||
3715 | 108 | { | ||
3716 | 109 | ProcEvInfo = eDoNotProcess; | ||
3717 | 110 | } | ||
3718 | 111 | } | ||
3719 | 112 | |||
3720 | 113 | if (m_layout) | ||
3721 | 114 | ret = m_layout->ProcessEvent (window_event, ret, ProcEvInfo); | ||
3722 | 115 | |||
3723 | 116 | // PostProcessEvent2 must always have its last parameter set to 0 | ||
3724 | 117 | // because the m_BackgroundArea is the real physical limit of the window. | ||
3725 | 118 | // So the previous test about IsPointInside do not prevail over m_BackgroundArea | ||
3726 | 119 | // testing the event by itself. | ||
3727 | 120 | ret = PostProcessEvent2 (ievent, ret, 0); | ||
3728 | 121 | return ret; | ||
3729 | 122 | } | ||
3730 | 123 | |||
3731 | 124 | Area* BaseWindow::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type) | 92 | Area* BaseWindow::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type) |
3732 | 125 | { | 93 | { |
3733 | 126 | bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type); | 94 | bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type); |
3734 | 127 | 95 | ||
3736 | 128 | if(mouse_inside == false) | 96 | if (mouse_inside == false) |
3737 | 129 | return NULL; | 97 | return NULL; |
3738 | 130 | 98 | ||
3740 | 131 | if(m_layout) | 99 | if (m_layout) |
3741 | 132 | { | 100 | { |
3742 | 133 | nuxAssert(m_layout->IsLayout()); | 101 | nuxAssert(m_layout->IsLayout()); |
3743 | 134 | Area* found_area = m_layout->FindAreaUnderMouse(mouse_position, event_type); | 102 | Area* found_area = m_layout->FindAreaUnderMouse(mouse_position, event_type); |
3745 | 135 | if(found_area) | 103 | if (found_area) |
3746 | 136 | return found_area; | 104 | return found_area; |
3747 | 137 | } | 105 | } |
3748 | 138 | 106 | ||
3750 | 139 | if((event_type == NUX_MOUSE_WHEEL) && (!AcceptMouseWheelEvent())) | 107 | if ((event_type == NUX_MOUSE_WHEEL) && (!AcceptMouseWheelEvent())) |
3751 | 140 | return NULL; | 108 | return NULL; |
3752 | 141 | return this; | 109 | return this; |
3753 | 142 | } | 110 | } |
3754 | 143 | 111 | ||
3756 | 144 | void BaseWindow::Draw (GraphicsEngine &GfxContext, bool force_draw) | 112 | void BaseWindow::Draw(GraphicsEngine &graphics_engine, bool force_draw) |
3757 | 145 | { | 113 | { |
3758 | 146 | Geometry base = GetGeometry(); | 114 | Geometry base = GetGeometry(); |
3763 | 147 | // The elements position inside the window are referenced to top-left window corner. So bring base to (0, 0). | 115 | // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0). |
3764 | 148 | base.SetX (0); | 116 | base.SetX(0); |
3765 | 149 | base.SetY (0); | 117 | base.SetY(0); |
3766 | 150 | GfxContext.PushClippingRectangle (base); | 118 | graphics_engine.PushClippingRectangle(base); |
3767 | 151 | 119 | ||
3769 | 152 | GetPainter().PushDrawLayer(GfxContext, base, _paint_layer.get()); | 120 | GetPainter().PushDrawLayer(graphics_engine, base, _paint_layer.get()); |
3770 | 153 | 121 | ||
3771 | 154 | GetPainter().PopBackground(); | 122 | GetPainter().PopBackground(); |
3773 | 155 | GfxContext.PopClippingRectangle(); | 123 | graphics_engine.PopClippingRectangle(); |
3774 | 156 | } | 124 | } |
3775 | 157 | 125 | ||
3777 | 158 | void BaseWindow::DrawContent (GraphicsEngine &GfxContext, bool force_draw) | 126 | void BaseWindow::DrawContent(GraphicsEngine &graphics_engine, bool force_draw) |
3778 | 159 | { | 127 | { |
3779 | 160 | 128 | ||
3780 | 161 | Geometry base = GetGeometry(); | 129 | Geometry base = GetGeometry(); |
3787 | 162 | // The elements position inside the window are referenced to top-left window corner. So bring base to (0, 0). | 130 | // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0). |
3788 | 163 | base.SetX (0); | 131 | base.SetX(0); |
3789 | 164 | base.SetY (0); | 132 | base.SetY(0); |
3790 | 165 | 133 | ||
3791 | 166 | 134 | ||
3792 | 167 | GetPainter().PushLayer(GfxContext, base, _paint_layer.get()); | 135 | GetPainter().PushLayer(graphics_engine, base, _paint_layer.get()); |
3793 | 168 | 136 | ||
3794 | 169 | if (m_layout) | 137 | if (m_layout) |
3795 | 170 | { | 138 | { |
3799 | 171 | GfxContext.PushClippingRectangle (base); | 139 | graphics_engine.PushClippingRectangle(base); |
3800 | 172 | m_layout->ProcessDraw (GfxContext, force_draw); | 140 | m_layout->ProcessDraw(graphics_engine, force_draw); |
3801 | 173 | GfxContext.PopClippingRectangle(); | 141 | graphics_engine.PopClippingRectangle(); |
3802 | 174 | } | 142 | } |
3803 | 175 | 143 | ||
3804 | 176 | GetPainter().PopBackground(); | 144 | GetPainter().PopBackground(); |
3805 | 177 | } | 145 | } |
3806 | 178 | 146 | ||
3808 | 179 | void BaseWindow::PostDraw (GraphicsEngine &GfxContext, bool force_draw) | 147 | void BaseWindow::PostDraw(GraphicsEngine &graphics_engine, bool force_draw) |
3809 | 180 | { | 148 | { |
3810 | 181 | 149 | ||
3811 | 182 | } | 150 | } |
3812 | 183 | 151 | ||
3814 | 184 | void BaseWindow::SetConfigureNotifyCallback (ConfigureNotifyCallback Callback, void *Data) | 152 | void BaseWindow::SetConfigureNotifyCallback(ConfigureNotifyCallback Callback, void *Data) |
3815 | 185 | { | 153 | { |
3816 | 186 | m_configure_notify_callback = Callback; | 154 | m_configure_notify_callback = Callback; |
3817 | 187 | m_configure_notify_callback_data = Data; | 155 | m_configure_notify_callback_data = Data; |
3818 | 188 | } | 156 | } |
3819 | 189 | 157 | ||
3859 | 190 | void BaseWindow::AddWidget (View *ic) | 158 | Layout* BaseWindow::GetLayout() |
3821 | 191 | { | ||
3822 | 192 | if (ic && m_layout) | ||
3823 | 193 | { | ||
3824 | 194 | m_layout->AddView (ic, 0); | ||
3825 | 195 | // 0: the WidgetLayout geometry will be set to SetGeometry(0,0,1,1); | ||
3826 | 196 | // and the children will take their natural size by expending WidgetLayout. | ||
3827 | 197 | // If the parent of WidgetLayout offers more space, it won't be used by WidgetLayout. | ||
3828 | 198 | |||
3829 | 199 | ComputeChildLayout(); | ||
3830 | 200 | } | ||
3831 | 201 | } | ||
3832 | 202 | |||
3833 | 203 | void BaseWindow::AddWidget (View *ic, int stretchfactor) | ||
3834 | 204 | { | ||
3835 | 205 | if (ic && m_layout) | ||
3836 | 206 | { | ||
3837 | 207 | m_layout->AddView (ic, stretchfactor); | ||
3838 | 208 | // if(stretchfactor ==0): the WidgetLayout geometry will be set to SetGeometry(0,0,1,1); | ||
3839 | 209 | // and the children will take their natural size by expending WidgetLayout. | ||
3840 | 210 | // If the parent of WidgetLayout offers more space, it won't be used by WidgetLayout. | ||
3841 | 211 | |||
3842 | 212 | ComputeChildLayout(); | ||
3843 | 213 | } | ||
3844 | 214 | } | ||
3845 | 215 | |||
3846 | 216 | void BaseWindow::AddWidget (std::list<View *> *ViewList) | ||
3847 | 217 | { | ||
3848 | 218 | m_CompositionLayout->Clear(); | ||
3849 | 219 | |||
3850 | 220 | std::list<View *>::iterator it; | ||
3851 | 221 | |||
3852 | 222 | for (it = ViewList->begin(); it != ViewList->end(); it++) | ||
3853 | 223 | { | ||
3854 | 224 | AddWidget ( (*it) ); | ||
3855 | 225 | } | ||
3856 | 226 | } | ||
3857 | 227 | |||
3858 | 228 | Layout* BaseWindow::GetLayout () | ||
3860 | 229 | { | 159 | { |
3861 | 230 | return m_layout; | 160 | return m_layout; |
3862 | 231 | } | 161 | } |
3863 | 232 | 162 | ||
3865 | 233 | bool BaseWindow::SetLayout (Layout *layout) | 163 | bool BaseWindow::SetLayout(Layout *layout) |
3866 | 234 | { | 164 | { |
3868 | 235 | if (View::SetLayout (layout) == false) | 165 | if (View::SetLayout(layout) == false) |
3869 | 236 | return false; | 166 | return false; |
3870 | 237 | 167 | ||
3871 | 238 | m_layout = layout; | 168 | m_layout = layout; |
3872 | 239 | Geometry geo = GetGeometry(); | 169 | Geometry geo = GetGeometry(); |
3874 | 240 | Geometry layout_geo = Geometry (geo.x + m_Border, geo.y + m_TopBorder, | 170 | Geometry layout_geo = Geometry(geo.x + m_Border, geo.y + m_TopBorder, |
3875 | 241 | geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder); | 171 | geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder); |
3877 | 242 | m_layout->SetGeometry (layout_geo); | 172 | m_layout->SetGeometry(layout_geo); |
3878 | 243 | 173 | ||
3879 | 244 | // When this call returns the layout computation is done. | 174 | // When this call returns the layout computation is done. |
3881 | 245 | ComputeChildLayout(); | 175 | ComputeContentSize(); |
3882 | 246 | // or use | 176 | // or use |
3883 | 247 | //GetWindowThread()->QueueObjectLayout(m_layout); | 177 | //GetWindowThread()->QueueObjectLayout(m_layout); |
3884 | 248 | 178 | ||
3885 | @@ -257,16 +187,16 @@ | |||
3886 | 257 | 187 | ||
3887 | 258 | if (m_configure_notify_callback) | 188 | if (m_configure_notify_callback) |
3888 | 259 | { | 189 | { |
3890 | 260 | (*m_configure_notify_callback) (GetGraphicsDisplay()->GetWindowWidth(), GetGraphicsDisplay()->GetWindowHeight(), geo, m_configure_notify_callback_data); | 190 | (*m_configure_notify_callback)(GetGraphicsDisplay()->GetWindowWidth(), GetGraphicsDisplay()->GetWindowHeight(), geo, m_configure_notify_callback_data); |
3891 | 261 | 191 | ||
3893 | 262 | if (geo.IsNull() ) | 192 | if (geo.IsNull()) |
3894 | 263 | { | 193 | { |
3896 | 264 | nuxDebugMsg (TEXT ("[BaseWindow::PreLayoutManagement] Received an invalid Geometry.") ); | 194 | nuxDebugMsg("[BaseWindow::PreLayoutManagement] Received an invalid Geometry."); |
3897 | 265 | geo = GetGeometry(); | 195 | geo = GetGeometry(); |
3898 | 266 | } | 196 | } |
3899 | 267 | else | 197 | else |
3900 | 268 | { | 198 | { |
3902 | 269 | Area::SetGeometry (geo); | 199 | Area::SetGeometry(geo); |
3903 | 270 | // Get the geometry adjusted with respect to min and max dimension of this area. | 200 | // Get the geometry adjusted with respect to min and max dimension of this area. |
3904 | 271 | geo = GetGeometry(); | 201 | geo = GetGeometry(); |
3905 | 272 | } | 202 | } |
3906 | @@ -274,30 +204,30 @@ | |||
3907 | 274 | 204 | ||
3908 | 275 | if (m_layout) | 205 | if (m_layout) |
3909 | 276 | { | 206 | { |
3911 | 277 | Geometry layout_geo = Geometry (m_Border, m_TopBorder, | 207 | Geometry layout_geo = Geometry(m_Border, m_TopBorder, |
3912 | 278 | geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder); | 208 | geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder); |
3913 | 279 | 209 | ||
3916 | 280 | if (IsSizeMatchContent ()) | 210 | if (IsSizeMatchContent()) |
3917 | 281 | m_layout->SetGeometry (Geometry (0, 0, 1, 1)); | 211 | m_layout->SetGeometry(Geometry(0, 0, 1, 1)); |
3918 | 282 | else | 212 | else |
3920 | 283 | m_layout->SetGeometry (layout_geo); | 213 | m_layout->SetGeometry(layout_geo); |
3921 | 284 | } | 214 | } |
3922 | 285 | } | 215 | } |
3923 | 286 | 216 | ||
3924 | 287 | // Get a change to do any work on an element. | 217 | // Get a change to do any work on an element. |
3925 | 288 | // Here we need to position the header by hand because it is not under the control of vlayout. | 218 | // Here we need to position the header by hand because it is not under the control of vlayout. |
3927 | 289 | long BaseWindow::PostLayoutManagement (long LayoutResult) | 219 | long BaseWindow::PostLayoutManagement(long LayoutResult) |
3928 | 290 | { | 220 | { |
3929 | 291 | if (IsSizeMatchContent() && m_layout) | 221 | if (IsSizeMatchContent() && m_layout) |
3930 | 292 | { | 222 | { |
3931 | 293 | Geometry layout_geometry = m_layout->GetGeometry(); | 223 | Geometry layout_geometry = m_layout->GetGeometry(); |
3932 | 294 | 224 | ||
3934 | 295 | Geometry WindowGeometry = Geometry (GetGeometry().x, | 225 | Geometry WindowGeometry = Geometry(GetGeometry().x, |
3935 | 296 | GetGeometry().y, | 226 | GetGeometry().y, |
3936 | 297 | layout_geometry.GetWidth() + 2 * m_Border, | 227 | layout_geometry.GetWidth() + 2 * m_Border, |
3937 | 298 | layout_geometry.GetHeight() + m_Border + m_TopBorder); | 228 | layout_geometry.GetHeight() + m_Border + m_TopBorder); |
3938 | 299 | 229 | ||
3940 | 300 | Area::SetGeometry (WindowGeometry); | 230 | Area::SetGeometry(WindowGeometry); |
3941 | 301 | } | 231 | } |
3942 | 302 | 232 | ||
3943 | 303 | // A BaseWindow must kill the result of the management and pass it to the parent Layout. | 233 | // A BaseWindow must kill the result of the management and pass it to the parent Layout. |
3944 | @@ -307,13 +237,13 @@ | |||
3945 | 307 | 237 | ||
3946 | 308 | // Get a change to do any work on an element. | 238 | // Get a change to do any work on an element. |
3947 | 309 | // Here we need to position the header by hand because it is not under the control of vlayout. | 239 | // Here we need to position the header by hand because it is not under the control of vlayout. |
3949 | 310 | void BaseWindow::PositionChildLayout (float offsetX, float offsetY) | 240 | void BaseWindow::ComputeContentPosition(float offsetX, float offsetY) |
3950 | 311 | { | 241 | { |
3951 | 312 | 242 | ||
3952 | 313 | } | 243 | } |
3953 | 314 | 244 | ||
3954 | 315 | #if defined(NUX_OS_LINUX) | 245 | #if defined(NUX_OS_LINUX) |
3956 | 316 | void BaseWindow::EnableInputWindow (bool b, | 246 | void BaseWindow::EnableInputWindow(bool b, |
3957 | 317 | const char* title, | 247 | const char* title, |
3958 | 318 | bool take_focus, | 248 | bool take_focus, |
3959 | 319 | bool override_redirect) | 249 | bool override_redirect) |
3960 | @@ -321,62 +251,62 @@ | |||
3961 | 321 | if (b) | 251 | if (b) |
3962 | 322 | { | 252 | { |
3963 | 323 | if (m_input_window == 0) | 253 | if (m_input_window == 0) |
3965 | 324 | m_input_window = new XInputWindow (title, take_focus, override_redirect); | 254 | m_input_window = new XInputWindow(title, take_focus, override_redirect); |
3966 | 325 | 255 | ||
3969 | 326 | m_input_window->Show (); | 256 | m_input_window->Show(); |
3970 | 327 | m_input_window->SetGeometry (GetGeometry()); | 257 | m_input_window->SetGeometry(GetGeometry()); |
3971 | 328 | m_input_window_enabled = true; | 258 | m_input_window_enabled = true; |
3972 | 329 | } | 259 | } |
3973 | 330 | else | 260 | else |
3974 | 331 | { | 261 | { |
3975 | 332 | if (m_input_window) | 262 | if (m_input_window) |
3977 | 333 | m_input_window->Hide (); | 263 | m_input_window->Hide(); |
3978 | 334 | m_input_window_enabled = false; | 264 | m_input_window_enabled = false; |
3979 | 335 | } | 265 | } |
3980 | 336 | } | 266 | } |
3981 | 337 | 267 | ||
3983 | 338 | bool BaseWindow::InputWindowEnabled () | 268 | bool BaseWindow::InputWindowEnabled() |
3984 | 339 | { | 269 | { |
3985 | 340 | return m_input_window_enabled; | 270 | return m_input_window_enabled; |
3986 | 341 | } | 271 | } |
3987 | 342 | 272 | ||
4003 | 343 | void BaseWindow::InputWindowEnableStruts (bool enable) | 273 | void BaseWindow::InputWindowEnableStruts(bool enable) |
4004 | 344 | { | 274 | { |
4005 | 345 | if (m_input_window) | 275 | if (m_input_window) |
4006 | 346 | m_input_window->EnableStruts (enable); | 276 | m_input_window->EnableStruts(enable); |
4007 | 347 | } | 277 | } |
4008 | 348 | 278 | ||
4009 | 349 | bool BaseWindow::InputWindowStrutsEnabled () | 279 | bool BaseWindow::InputWindowStrutsEnabled() |
4010 | 350 | { | 280 | { |
4011 | 351 | return m_input_window_enabled && m_input_window->StrutsEnabled (); | 281 | return m_input_window_enabled && m_input_window->StrutsEnabled(); |
4012 | 352 | } | 282 | } |
4013 | 353 | 283 | ||
4014 | 354 | void BaseWindow::SetInputFocus () | 284 | void BaseWindow::SetInputFocus() |
4015 | 355 | { | 285 | { |
4016 | 356 | if (m_input_window) | 286 | if (m_input_window) |
4017 | 357 | m_input_window->SetInputFocus (); | 287 | m_input_window->SetInputFocus(); |
4018 | 358 | } | 288 | } |
4019 | 359 | 289 | ||
4021 | 360 | Window BaseWindow::GetInputWindowId () | 290 | Window BaseWindow::GetInputWindowId() |
4022 | 361 | { | 291 | { |
4023 | 362 | if (m_input_window) | 292 | if (m_input_window) |
4025 | 363 | return m_input_window->GetWindow (); | 293 | return m_input_window->GetWindow(); |
4026 | 364 | else | 294 | else |
4027 | 365 | return 0; | 295 | return 0; |
4028 | 366 | } | 296 | } |
4029 | 367 | 297 | ||
4030 | 368 | #endif | 298 | #endif |
4031 | 369 | 299 | ||
4033 | 370 | void BaseWindow::SetGeometry (const Geometry &geo) | 300 | void BaseWindow::SetGeometry(const Geometry &geo) |
4034 | 371 | { | 301 | { |
4036 | 372 | Area::SetGeometry (geo); | 302 | Area::SetGeometry(geo); |
4037 | 373 | 303 | ||
4038 | 374 | #if defined(NUX_OS_LINUX) | 304 | #if defined(NUX_OS_LINUX) |
4039 | 375 | if (m_input_window) | 305 | if (m_input_window) |
4041 | 376 | m_input_window->SetGeometry (geo); | 306 | m_input_window->SetGeometry(geo); |
4042 | 377 | #endif | 307 | #endif |
4043 | 378 | //LayoutWindowElements(); | 308 | //LayoutWindowElements(); |
4045 | 379 | //ComputeChildLayout(); | 309 | //ComputeContentSize(); |
4046 | 380 | } | 310 | } |
4047 | 381 | 311 | ||
4048 | 382 | void BaseWindow::LayoutWindowElements() | 312 | void BaseWindow::LayoutWindowElements() |
4049 | @@ -386,7 +316,7 @@ | |||
4050 | 386 | Geometry base = GetGeometry(); | 316 | Geometry base = GetGeometry(); |
4051 | 387 | } | 317 | } |
4052 | 388 | 318 | ||
4054 | 389 | void BaseWindow::SetBorder (int border) | 319 | void BaseWindow::SetBorder(int border) |
4055 | 390 | { | 320 | { |
4056 | 391 | if (m_Border != border) | 321 | if (m_Border != border) |
4057 | 392 | { | 322 | { |
4058 | @@ -394,7 +324,7 @@ | |||
4059 | 394 | } | 324 | } |
4060 | 395 | } | 325 | } |
4061 | 396 | 326 | ||
4063 | 397 | void BaseWindow::SetTopBorder (int border) | 327 | void BaseWindow::SetTopBorder(int border) |
4064 | 398 | { | 328 | { |
4065 | 399 | if (m_TopBorder != border) | 329 | if (m_TopBorder != border) |
4066 | 400 | { | 330 | { |
4067 | @@ -432,7 +362,7 @@ | |||
4068 | 432 | sigVisible.emit(this); | 362 | sigVisible.emit(this); |
4069 | 433 | GetWindowCompositor().sigVisibleViewWindow.emit(this); | 363 | GetWindowCompositor().sigVisibleViewWindow.emit(this); |
4070 | 434 | 364 | ||
4072 | 435 | ComputeChildLayout(); | 365 | ComputeContentSize(); |
4073 | 436 | } | 366 | } |
4074 | 437 | else | 367 | else |
4075 | 438 | { | 368 | { |
4076 | @@ -459,7 +389,7 @@ | |||
4077 | 459 | _is_visible = false; | 389 | _is_visible = false; |
4078 | 460 | _is_modal = false; | 390 | _is_modal = false; |
4079 | 461 | //ShowWindow(false); | 391 | //ShowWindow(false); |
4081 | 462 | GetWindowCompositor().StopModalWindow (ObjectWeakPtr<BaseWindow> (this)); | 392 | GetWindowCompositor().StopModalWindow(ObjectWeakPtr<BaseWindow> (this)); |
4082 | 463 | } | 393 | } |
4083 | 464 | 394 | ||
4084 | 465 | bool BaseWindow::IsModal() const | 395 | bool BaseWindow::IsModal() const |
4085 | @@ -467,7 +397,7 @@ | |||
4086 | 467 | return _is_modal; | 397 | return _is_modal; |
4087 | 468 | } | 398 | } |
4088 | 469 | 399 | ||
4090 | 470 | void BaseWindow::NotifyConfigurationChange (int Width, int Height) | 400 | void BaseWindow::NotifyConfigurationChange(int Width, int Height) |
4091 | 471 | { | 401 | { |
4092 | 472 | Geometry geo = GetGeometry(); | 402 | Geometry geo = GetGeometry(); |
4093 | 473 | 403 | ||
4094 | @@ -475,14 +405,14 @@ | |||
4095 | 475 | { | 405 | { |
4096 | 476 | (*m_configure_notify_callback) (GetGraphicsDisplay()->GetWindowWidth(), GetGraphicsDisplay()->GetWindowHeight(), geo, m_configure_notify_callback_data); | 406 | (*m_configure_notify_callback) (GetGraphicsDisplay()->GetWindowWidth(), GetGraphicsDisplay()->GetWindowHeight(), geo, m_configure_notify_callback_data); |
4097 | 477 | 407 | ||
4099 | 478 | if (geo.IsNull() ) | 408 | if (geo.IsNull()) |
4100 | 479 | { | 409 | { |
4102 | 480 | nuxDebugMsg (TEXT ("[BaseWindow::NotifyConfigurationChange] Received an invalid Geometry.") ); | 410 | nuxDebugMsg("[BaseWindow::NotifyConfigurationChange] Received an invalid Geometry."); |
4103 | 481 | geo = GetGeometry(); | 411 | geo = GetGeometry(); |
4104 | 482 | } | 412 | } |
4105 | 483 | else | 413 | else |
4106 | 484 | { | 414 | { |
4108 | 485 | Area::SetGeometry (geo); | 415 | Area::SetGeometry(geo); |
4109 | 486 | // Get the geometry adjusted with respect to min and max dimension of this area. | 416 | // Get the geometry adjusted with respect to min and max dimension of this area. |
4110 | 487 | geo = GetGeometry(); | 417 | geo = GetGeometry(); |
4111 | 488 | } | 418 | } |
4112 | @@ -493,68 +423,68 @@ | |||
4113 | 493 | } | 423 | } |
4114 | 494 | } | 424 | } |
4115 | 495 | 425 | ||
4117 | 496 | void BaseWindow::SetBackgroundLayer (AbstractPaintLayer *layer) | 426 | void BaseWindow::SetBackgroundLayer(AbstractPaintLayer *layer) |
4118 | 497 | { | 427 | { |
4120 | 498 | NUX_RETURN_IF_NULL (layer); | 428 | NUX_RETURN_IF_NULL(layer); |
4121 | 499 | _paint_layer.reset(layer->Clone()); | 429 | _paint_layer.reset(layer->Clone()); |
4122 | 500 | } | 430 | } |
4123 | 501 | 431 | ||
4125 | 502 | void BaseWindow::SetBackgroundColor (const Color &color) | 432 | void BaseWindow::SetBackgroundColor(const Color &color) |
4126 | 503 | { | 433 | { |
4127 | 504 | _paint_layer.reset(new ColorLayer(color)); | 434 | _paint_layer.reset(new ColorLayer(color)); |
4128 | 505 | } | 435 | } |
4129 | 506 | 436 | ||
4146 | 507 | void BaseWindow::PushHigher (BaseWindow* floating_view) | 437 | void BaseWindow::PushHigher(BaseWindow* floating_view) |
4147 | 508 | { | 438 | { |
4148 | 509 | GetWindowCompositor().PushHigher (this, floating_view); | 439 | GetWindowCompositor().PushHigher(this, floating_view); |
4149 | 510 | } | 440 | } |
4150 | 511 | 441 | ||
4151 | 512 | void BaseWindow::PushToFront () | 442 | void BaseWindow::PushToFront() |
4152 | 513 | { | 443 | { |
4153 | 514 | GetWindowCompositor().PushToFront (this); | 444 | GetWindowCompositor().PushToFront(this); |
4154 | 515 | } | 445 | } |
4155 | 516 | 446 | ||
4156 | 517 | void BaseWindow::PushToBack () | 447 | void BaseWindow::PushToBack() |
4157 | 518 | { | 448 | { |
4158 | 519 | GetWindowCompositor().PushToBack (this); | 449 | GetWindowCompositor().PushToBack(this); |
4159 | 520 | } | 450 | } |
4160 | 521 | 451 | ||
4161 | 522 | bool BaseWindow::ChildNeedsRedraw () | 452 | bool BaseWindow::ChildNeedsRedraw() |
4162 | 523 | { | 453 | { |
4163 | 524 | return _child_need_redraw; | 454 | return _child_need_redraw; |
4164 | 525 | } | 455 | } |
4165 | 526 | 456 | ||
4167 | 527 | void* BaseWindow::GetBackupTextureData (int &width, int &height, int &format) | 457 | void* BaseWindow::GetBackupTextureData(int &width, int &height, int &format) |
4168 | 528 | { | 458 | { |
4170 | 529 | return GetWindowCompositor ().GetBackupTextureData (this, width, height, format); | 459 | return GetWindowCompositor().GetBackupTextureData(this, width, height, format); |
4171 | 530 | } | 460 | } |
4172 | 531 | 461 | ||
4174 | 532 | void BaseWindow::SetEnterFocusInputArea (InputArea *input_area) | 462 | void BaseWindow::SetEnterFocusInputArea(InputArea *input_area) |
4175 | 533 | { | 463 | { |
4176 | 534 | if (_enter_focus_input_area) | 464 | if (_enter_focus_input_area) |
4177 | 535 | { | 465 | { |
4179 | 536 | _enter_focus_input_area->UnReference (); | 466 | _enter_focus_input_area->UnReference(); |
4180 | 537 | } | 467 | } |
4181 | 538 | 468 | ||
4182 | 539 | _enter_focus_input_area = input_area; | 469 | _enter_focus_input_area = input_area; |
4183 | 540 | if (_enter_focus_input_area) | 470 | if (_enter_focus_input_area) |
4185 | 541 | _enter_focus_input_area->Reference (); | 471 | _enter_focus_input_area->Reference(); |
4186 | 542 | 472 | ||
4187 | 543 | } | 473 | } |
4188 | 544 | 474 | ||
4190 | 545 | void BaseWindow::SetOpacity (float opacity) | 475 | void BaseWindow::SetOpacity(float opacity) |
4191 | 546 | { | 476 | { |
4192 | 547 | if (_opacity == opacity) | 477 | if (_opacity == opacity) |
4193 | 548 | return; | 478 | return; |
4194 | 549 | 479 | ||
4195 | 550 | _opacity = opacity; | 480 | _opacity = opacity; |
4196 | 551 | 481 | ||
4198 | 552 | _opacity = CLAMP (_opacity, 0.0f, 1.0f); | 482 | _opacity = CLAMP(_opacity, 0.0f, 1.0f); |
4199 | 553 | 483 | ||
4201 | 554 | QueueDraw (); | 484 | QueueDraw(); |
4202 | 555 | } | 485 | } |
4203 | 556 | 486 | ||
4205 | 557 | float BaseWindow::GetOpacity () | 487 | float BaseWindow::GetOpacity() |
4206 | 558 | { | 488 | { |
4207 | 559 | return _opacity; | 489 | return _opacity; |
4208 | 560 | } | 490 | } |
4209 | 561 | 491 | ||
4210 | === modified file 'Nux/BaseWindow.h' | |||
4211 | --- Nux/BaseWindow.h 2011-09-20 06:03:43 +0000 | |||
4212 | +++ Nux/BaseWindow.h 2011-10-25 21:32:25 +0000 | |||
4213 | @@ -58,7 +58,7 @@ | |||
4214 | 58 | @param int The height of the window. | 58 | @param int The height of the window. |
4215 | 59 | @param Geometry& The tentative size of the window. | 59 | @param Geometry& The tentative size of the window. |
4216 | 60 | */ | 60 | */ |
4218 | 61 | typedef void (*ConfigureNotifyCallback) (int, int, Geometry &, void *); | 61 | typedef void(*ConfigureNotifyCallback) (int, int, Geometry &, void *); |
4219 | 62 | 62 | ||
4220 | 63 | /*! | 63 | /*! |
4221 | 64 | A floating area on top of the main window. | 64 | A floating area on top of the main window. |
4222 | @@ -66,23 +66,18 @@ | |||
4223 | 66 | */ | 66 | */ |
4224 | 67 | class BaseWindow: public View | 67 | class BaseWindow: public View |
4225 | 68 | { | 68 | { |
4227 | 69 | NUX_DECLARE_OBJECT_TYPE (BaseWindow, View); | 69 | NUX_DECLARE_OBJECT_TYPE(BaseWindow, View); |
4228 | 70 | public: | 70 | public: |
4230 | 71 | BaseWindow (const TCHAR *WindowName = TEXT (""), NUX_FILE_LINE_PROTO); | 71 | BaseWindow(const char *WindowName = "", NUX_FILE_LINE_PROTO); |
4231 | 72 | virtual ~BaseWindow(); | 72 | virtual ~BaseWindow(); |
4232 | 73 | 73 | ||
4233 | 74 | nux::Property<bool> premultiply; | 74 | nux::Property<bool> premultiply; |
4234 | 75 | 75 | ||
4235 | 76 | virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type); | 76 | virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type); |
4240 | 77 | virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); | 77 | virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw); |
4241 | 78 | virtual void Draw (GraphicsEngine &GfxContext, bool force_draw); | 78 | virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw); |
4242 | 79 | virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw); | 79 | virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw); |
4239 | 80 | virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw); | ||
4243 | 81 | 80 | ||
4244 | 82 | void AddWidget (View *ic); | ||
4245 | 83 | void AddWidget (View *ic, int stretchfactor); | ||
4246 | 84 | void AddWidget (std::list<View *> *ViewList); | ||
4247 | 85 | |||
4248 | 86 | virtual Layout* GetLayout(); | 81 | virtual Layout* GetLayout(); |
4249 | 87 | virtual bool SetLayout(Layout *layout); | 82 | virtual bool SetLayout(Layout *layout); |
4250 | 88 | 83 | ||
4251 | @@ -90,37 +85,37 @@ | |||
4252 | 90 | /*! | 85 | /*! |
4253 | 91 | Push this view one level up the ViewWindow stack. Does it even if the view is hidden. | 86 | Push this view one level up the ViewWindow stack. Does it even if the view is hidden. |
4254 | 92 | */ | 87 | */ |
4256 | 93 | void PushHigher (BaseWindow* floating_view); | 88 | void PushHigher(BaseWindow* floating_view); |
4257 | 94 | 89 | ||
4258 | 95 | //! Push the view one level down the ViewWindow stack. | 90 | //! Push the view one level down the ViewWindow stack. |
4259 | 96 | /*! | 91 | /*! |
4260 | 97 | Push this view one level down the ViewWindow stack. Does it even if the view is hidden. | 92 | Push this view one level down the ViewWindow stack. Does it even if the view is hidden. |
4261 | 98 | */ | 93 | */ |
4263 | 99 | void PushLower (BaseWindow* floating_view); | 94 | void PushLower(BaseWindow* floating_view); |
4264 | 100 | 95 | ||
4265 | 101 | //! Push the view to the front of the ViewWindow stack. | 96 | //! Push the view to the front of the ViewWindow stack. |
4266 | 102 | /*! | 97 | /*! |
4267 | 103 | Push this view to the top of the ViewWindow stack. Does it even if the view is hidden. | 98 | Push this view to the top of the ViewWindow stack. Does it even if the view is hidden. |
4268 | 104 | If a valid ViewWindow has been forced at the top of the stack with a call to WindowCompositor::SetAlwaysOnFrontWindow(), | 99 | If a valid ViewWindow has been forced at the top of the stack with a call to WindowCompositor::SetAlwaysOnFrontWindow(), |
4269 | 105 | then this view will be positioned one level below that view. | 100 | then this view will be positioned one level below that view. |
4271 | 106 | \sa SetAlwaysOnFrontWindow (); | 101 | \sa SetAlwaysOnFrontWindow(); |
4272 | 107 | */ | 102 | */ |
4274 | 108 | void PushToFront (); | 103 | void PushToFront(); |
4275 | 109 | 104 | ||
4276 | 110 | //! Push the view to the back of the ViewWindow stack. | 105 | //! Push the view to the back of the ViewWindow stack. |
4277 | 111 | /*! | 106 | /*! |
4278 | 112 | Push this view to the back of the ViewWindow stack. Does it even if the view is hidden. | 107 | Push this view to the back of the ViewWindow stack. Does it even if the view is hidden. |
4279 | 113 | */ | 108 | */ |
4281 | 114 | void PushToBack (); | 109 | void PushToBack(); |
4282 | 115 | 110 | ||
4283 | 116 | //! Set the window size to respect the layout container. | 111 | //! Set the window size to respect the layout container. |
4284 | 117 | /*! | 112 | /*! |
4285 | 118 | Set the window size to be such that the container layout size remains the same after ComputeSizeLayout2 is | 113 | Set the window size to be such that the container layout size remains the same after ComputeSizeLayout2 is |
4287 | 119 | called on the layout. The window elements (title bar, minimize and close buttons) are positioned accordingly. | 114 | called on the layout. The window elements(title bar, minimize and close buttons) are positioned accordingly. |
4288 | 120 | The size grip is not responding anymore. | 115 | The size grip is not responding anymore. |
4289 | 121 | @param b If b is true, the window size respect the size the layout container. | 116 | @param b If b is true, the window size respect the size the layout container. |
4290 | 122 | */ | 117 | */ |
4292 | 123 | virtual void SetWindowSizeMatchLayout (bool b) | 118 | virtual void SetWindowSizeMatchLayout(bool b) |
4293 | 124 | { | 119 | { |
4294 | 125 | _size_match_layout = b; | 120 | _size_match_layout = b; |
4295 | 126 | } | 121 | } |
4296 | @@ -134,12 +129,12 @@ | |||
4297 | 134 | return _size_match_layout; | 129 | return _size_match_layout; |
4298 | 135 | } | 130 | } |
4299 | 136 | 131 | ||
4304 | 137 | virtual void ShowWindow (bool b, bool StartModal = false); | 132 | virtual void ShowWindow(bool b, bool StartModal = false); |
4305 | 138 | void StopModal (); | 133 | void StopModal(); |
4306 | 139 | bool IsModal () const; | 134 | bool IsModal() const; |
4307 | 140 | bool IsVisible () const; | 135 | bool IsVisible() const; |
4308 | 141 | 136 | ||
4310 | 142 | virtual void SetGeometry (const Geometry &geo); | 137 | virtual void SetGeometry(const Geometry &geo); |
4311 | 143 | 138 | ||
4312 | 144 | /*! | 139 | /*! |
4313 | 145 | Call this function to set a callback function that is called when this object is need to be resized or re-positioned. | 140 | Call this function to set a callback function that is called when this object is need to be resized or re-positioned. |
4314 | @@ -147,24 +142,24 @@ | |||
4315 | 147 | @param Data The callback data. | 142 | @param Data The callback data. |
4316 | 148 | */ | 143 | */ |
4317 | 149 | 144 | ||
4325 | 150 | void SetConfigureNotifyCallback (ConfigureNotifyCallback Callback, void *Data); | 145 | void SetConfigureNotifyCallback(ConfigureNotifyCallback Callback, void *Data); |
4326 | 151 | 146 | ||
4327 | 152 | void SetBackgroundLayer (AbstractPaintLayer *layer); | 147 | void SetBackgroundLayer(AbstractPaintLayer *layer); |
4328 | 153 | void SetBackgroundColor (const Color &color); | 148 | void SetBackgroundColor(const Color &color); |
4329 | 154 | 149 | ||
4330 | 155 | void SetOpacity (float opacity); | 150 | void SetOpacity(float opacity); |
4331 | 156 | float GetOpacity (); | 151 | float GetOpacity(); |
4332 | 157 | 152 | ||
4333 | 158 | #if defined(NUX_OS_LINUX) | 153 | #if defined(NUX_OS_LINUX) |
4335 | 159 | void EnableInputWindow (bool b, | 154 | void EnableInputWindow(bool b, |
4336 | 160 | const char* title = "nux input window", | 155 | const char* title = "nux input window", |
4337 | 161 | bool take_focus = False, | 156 | bool take_focus = False, |
4338 | 162 | bool override_redirect = False); | 157 | bool override_redirect = False); |
4344 | 163 | bool InputWindowEnabled (); | 158 | bool InputWindowEnabled(); |
4345 | 164 | void InputWindowEnableStruts (bool enable); | 159 | void InputWindowEnableStruts(bool enable); |
4346 | 165 | bool InputWindowStrutsEnabled (); | 160 | bool InputWindowStrutsEnabled(); |
4347 | 166 | void SetInputFocus (); | 161 | void SetInputFocus(); |
4348 | 167 | Window GetInputWindowId (); | 162 | Window GetInputWindowId(); |
4349 | 168 | #endif | 163 | #endif |
4350 | 169 | 164 | ||
4351 | 170 | //! Set an InputArea to receive the keyboard focus when the BaseWIndow receives the NUX_WINDOW_ENTER_FOCUS event. | 165 | //! Set an InputArea to receive the keyboard focus when the BaseWIndow receives the NUX_WINDOW_ENTER_FOCUS event. |
4352 | @@ -172,18 +167,18 @@ | |||
4353 | 172 | \sa _enter_focus_input_area. | 167 | \sa _enter_focus_input_area. |
4354 | 173 | @param input_area An InputArea pointer object. Must be a child of this BaseWindow. | 168 | @param input_area An InputArea pointer object. Must be a child of this BaseWindow. |
4355 | 174 | */ | 169 | */ |
4357 | 175 | void SetEnterFocusInputArea (InputArea *input_area); | 170 | void SetEnterFocusInputArea(InputArea *input_area); |
4358 | 176 | 171 | ||
4359 | 177 | 172 | ||
4360 | 178 | //! Get the backup texture data of this BaseWindow, | 173 | //! Get the backup texture data of this BaseWindow, |
4362 | 179 | void* GetBackupTextureData (int &width, int &height, int &format); | 174 | void* GetBackupTextureData(int &width, int &height, int &format); |
4363 | 180 | 175 | ||
4364 | 181 | //! Emit a signal when the BaseWindow becomes visible. | 176 | //! Emit a signal when the BaseWindow becomes visible. |
4365 | 182 | sigc::signal<void, BaseWindow*> sigVisible; | 177 | sigc::signal<void, BaseWindow*> sigVisible; |
4366 | 183 | //! Emit a signal when the BaseWindow becomes hidden. | 178 | //! Emit a signal when the BaseWindow becomes hidden. |
4367 | 184 | sigc::signal<void, BaseWindow*> sigHidden; | 179 | sigc::signal<void, BaseWindow*> sigHidden; |
4368 | 185 | 180 | ||
4370 | 186 | NString GetWindowName () | 181 | NString GetWindowName() |
4371 | 187 | { | 182 | { |
4372 | 188 | return _name; | 183 | return _name; |
4373 | 189 | } | 184 | } |
4374 | @@ -204,9 +199,9 @@ | |||
4375 | 204 | 199 | ||
4376 | 205 | friend class ComboBox_Logic_WindowView; | 200 | friend class ComboBox_Logic_WindowView; |
4377 | 206 | 201 | ||
4381 | 207 | virtual void PreLayoutManagement (); | 202 | virtual void PreLayoutManagement(); |
4382 | 208 | virtual long PostLayoutManagement (long LayoutResult); | 203 | virtual long PostLayoutManagement(long LayoutResult); |
4383 | 209 | virtual void PositionChildLayout (float offsetX, float offsetY); | 204 | virtual void ComputeContentPosition(float offsetX, float offsetY); |
4384 | 210 | //! Layout the window elements. | 205 | //! Layout the window elements. |
4385 | 211 | /*! | 206 | /*! |
4386 | 212 | Layout elements such as button on the title bar, and the resize widget according to the current | 207 | Layout elements such as button on the title bar, and the resize widget according to the current |
4387 | @@ -220,12 +215,12 @@ | |||
4388 | 220 | @param Width New width of the window. | 215 | @param Width New width of the window. |
4389 | 221 | @param Height New height of the window. | 216 | @param Height New height of the window. |
4390 | 222 | */ | 217 | */ |
4392 | 223 | virtual void NotifyConfigurationChange (int Width, int Height); | 218 | virtual void NotifyConfigurationChange(int Width, int Height); |
4393 | 224 | 219 | ||
4394 | 225 | int GetBorder() const; | 220 | int GetBorder() const; |
4395 | 226 | int GetTopBorder() const; | 221 | int GetTopBorder() const; |
4398 | 227 | void SetBorder (int border); | 222 | void SetBorder(int border); |
4399 | 228 | void SetTopBorder (int border); | 223 | void SetTopBorder(int border); |
4400 | 229 | int m_TopBorder; | 224 | int m_TopBorder; |
4401 | 230 | int m_Border; | 225 | int m_Border; |
4402 | 231 | boost::scoped_ptr<AbstractPaintLayer> _paint_layer; | 226 | boost::scoped_ptr<AbstractPaintLayer> _paint_layer; |
4403 | @@ -233,7 +228,7 @@ | |||
4404 | 233 | bool _entering_visible_state; //!< the window is about to be made visible during event processing | 228 | bool _entering_visible_state; //!< the window is about to be made visible during event processing |
4405 | 234 | bool _entering_hidden_state; //!< the window is about to be made hidden during event processing | 229 | bool _entering_hidden_state; //!< the window is about to be made hidden during event processing |
4406 | 235 | 230 | ||
4408 | 236 | bool ChildNeedsRedraw (); | 231 | bool ChildNeedsRedraw(); |
4409 | 237 | 232 | ||
4410 | 238 | #if defined(NUX_OS_LINUX) | 233 | #if defined(NUX_OS_LINUX) |
4411 | 239 | bool m_input_window_enabled; | 234 | bool m_input_window_enabled; |
4412 | 240 | 235 | ||
4413 | === removed file 'Nux/BezierCurveControl.cpp' | |||
4414 | --- Nux/BezierCurveControl.cpp 2011-09-20 06:03:43 +0000 | |||
4415 | +++ Nux/BezierCurveControl.cpp 1970-01-01 00:00:00 +0000 | |||
4416 | @@ -1,343 +0,0 @@ | |||
4417 | 1 | /* | ||
4418 | 2 | * Copyright 2010 Inalogic® Inc. | ||
4419 | 3 | * | ||
4420 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4421 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
4422 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
4423 | 7 | * of the License. | ||
4424 | 8 | * | ||
4425 | 9 | * This program is distributed in the hope that it will be useful, but | ||
4426 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
4427 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
4428 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
4429 | 13 | * License for more details. | ||
4430 | 14 | * | ||
4431 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
4432 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
4433 | 17 | * | ||
4434 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
4435 | 19 | * | ||
4436 | 20 | */ | ||
4437 | 21 | |||
4438 | 22 | |||
4439 | 23 | #include "Nux.h" | ||
4440 | 24 | #include "NuxCore/Math/Constants.h" | ||
4441 | 25 | #include "NuxCore/Math/Spline.h" | ||
4442 | 26 | #include "NuxCore/Math/Bezier.h" | ||
4443 | 27 | #include "BezierCurveControl.h" | ||
4444 | 28 | |||
4445 | 29 | namespace nux | ||
4446 | 30 | { | ||
4447 | 31 | |||
4448 | 32 | const int KNOT_SIZE = 2; | ||
4449 | 33 | const int KNOT_HIT_TEST = 4; | ||
4450 | 34 | |||
4451 | 35 | BezierCurveControl::BezierCurveControl (NUX_FILE_LINE_DECL) | ||
4452 | 36 | : View (NUX_FILE_LINE_PARAM) | ||
4453 | 37 | , m_minX (0.0f), | ||
4454 | 38 | m_minY (0.0f), | ||
4455 | 39 | m_maxX (1.0f), | ||
4456 | 40 | m_maxY (1.0f), | ||
4457 | 41 | m_FunctionCallback (0) | ||
4458 | 42 | { | ||
4459 | 43 | SetMinimumSize (400, 300); | ||
4460 | 44 | SetBaseSize (400, 300); | ||
4461 | 45 | |||
4462 | 46 | m_control_knot.push_back (Knot (0.0f, 0.0f) ); | ||
4463 | 47 | m_control_knot.push_back (Knot (0.1f, 0.0f) ); | ||
4464 | 48 | m_control_knot.push_back (Knot (0.7f, 0.9f) ); | ||
4465 | 49 | m_control_knot.push_back (Knot (1.0f, 1.0f) ); | ||
4466 | 50 | |||
4467 | 51 | mouse_down.connect (sigc::mem_fun (this, &BezierCurveControl::RecvMouseDown) ); | ||
4468 | 52 | mouse_up.connect (sigc::mem_fun (this, &BezierCurveControl::RecvMouseUp) ); | ||
4469 | 53 | mouse_drag.connect (sigc::mem_fun (this, &BezierCurveControl::RecvMouseDrag) ); | ||
4470 | 54 | |||
4471 | 55 | } | ||
4472 | 56 | |||
4473 | 57 | BezierCurveControl::~BezierCurveControl() | ||
4474 | 58 | { | ||
4475 | 59 | |||
4476 | 60 | |||
4477 | 61 | } | ||
4478 | 62 | |||
4479 | 63 | |||
4480 | 64 | long BezierCurveControl::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) | ||
4481 | 65 | { | ||
4482 | 66 | long ret = TraverseInfo; | ||
4483 | 67 | |||
4484 | 68 | if (ievent.e_event == NUX_MOUSE_PRESSED) | ||
4485 | 69 | { | ||
4486 | 70 | if (!GetGeometry().IsPointInside (ievent.e_x, ievent.e_y) ) | ||
4487 | 71 | { | ||
4488 | 72 | //ProcEvInfo = eDoNotProcess; | ||
4489 | 73 | //return TraverseInfo; | ||
4490 | 74 | } | ||
4491 | 75 | } | ||
4492 | 76 | |||
4493 | 77 | ret = PostProcessEvent2 (ievent, ret, 0); | ||
4494 | 78 | return ret; | ||
4495 | 79 | } | ||
4496 | 80 | |||
4497 | 81 | |||
4498 | 82 | void BezierCurveControl::Draw (GraphicsEngine &GfxContext, bool force_draw) | ||
4499 | 83 | { | ||
4500 | 84 | Geometry base = GetGeometry(); | ||
4501 | 85 | |||
4502 | 86 | GetPainter().PaintBackground (GfxContext, base); | ||
4503 | 87 | GetPainter().Paint2DQuadWireframe (GfxContext, base, Color (COLOR_BACKGROUND_SECONDARY) ); | ||
4504 | 88 | |||
4505 | 89 | #define N 3 | ||
4506 | 90 | t_u32 i; | ||
4507 | 91 | t_u32 nsample = 30; | ||
4508 | 92 | double t; | ||
4509 | 93 | t_u32 nbKnot = (t_u32) m_control_knot.size(); | ||
4510 | 94 | |||
4511 | 95 | if (nbKnot > 0) | ||
4512 | 96 | { | ||
4513 | 97 | double *xcon = new double[nbKnot]; | ||
4514 | 98 | double xval; | ||
4515 | 99 | double *ycon = new double[nbKnot]; | ||
4516 | 100 | double yval; | ||
4517 | 101 | |||
4518 | 102 | |||
4519 | 103 | for (i = 0; i < nbKnot; i++) | ||
4520 | 104 | { | ||
4521 | 105 | xcon[i] = m_control_knot[i].m_X; | ||
4522 | 106 | ycon[i] = m_control_knot[i].m_Y; | ||
4523 | 107 | } | ||
4524 | 108 | |||
4525 | 109 | int W = GetBaseWidth() - 2; | ||
4526 | 110 | int H = GetBaseHeight() - 2; | ||
4527 | 111 | int X = GetBaseX() + 1; | ||
4528 | 112 | int Y = GetBaseY() + 1; | ||
4529 | 113 | |||
4530 | 114 | double xprev, yprev; | ||
4531 | 115 | Bezier_XY (N, 0.0, xcon, ycon, &xprev, &yprev); | ||
4532 | 116 | |||
4533 | 117 | //GetPainter().Draw2DLine(X, Y, X+W, Y+H, Color(0xFFFF0000)); | ||
4534 | 118 | |||
4535 | 119 | base.OffsetPosition (1, 1); | ||
4536 | 120 | base.OffsetSize (-2, -2); | ||
4537 | 121 | |||
4538 | 122 | GfxContext.PushClippingRectangle (base); | ||
4539 | 123 | |||
4540 | 124 | GfxContext.GetRenderStates().EnableLineSmooth (TRUE, 1, GL_FASTEST); | ||
4541 | 125 | GfxContext.GetRenderStates().SetBlend (TRUE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
4542 | 126 | |||
4543 | 127 | for (i = 1; i < nsample; i++) | ||
4544 | 128 | { | ||
4545 | 129 | t = ( double ) ( i ) / ( double ) ( nsample - 1 ); | ||
4546 | 130 | Bezier_XY ( N, t, xcon, ycon, &xval, &yval ); | ||
4547 | 131 | |||
4548 | 132 | int X0, Y0, X1, Y1; | ||
4549 | 133 | X0 = X + W * (xprev - m_minX) / (m_maxX - m_minX); | ||
4550 | 134 | Y0 = Y + H * ( 1 - (yprev - m_minY) / (m_maxY - m_minY) ); | ||
4551 | 135 | X1 = X + W * (xval - m_minX) / (m_maxX - m_minX); | ||
4552 | 136 | Y1 = Y + H * ( 1 - (yval - m_minY) / (m_maxY - m_minY) ); | ||
4553 | 137 | |||
4554 | 138 | GetPainter().Draw2DLine (GfxContext, X0, Y0, X1, Y1, Color (0xFFFF0000) ); | ||
4555 | 139 | |||
4556 | 140 | xprev = xval; | ||
4557 | 141 | yprev = yval; | ||
4558 | 142 | } | ||
4559 | 143 | |||
4560 | 144 | GfxContext.GetRenderStates().EnableLineSmooth (FALSE); | ||
4561 | 145 | GfxContext.GetRenderStates().SetBlend (GL_FALSE); | ||
4562 | 146 | |||
4563 | 147 | for (i = 0; i < nbKnot - 1; i++) | ||
4564 | 148 | { | ||
4565 | 149 | int X0, Y0, X1, Y1; | ||
4566 | 150 | X0 = X + W * (m_control_knot[i].m_X - m_minX) / (m_maxX - m_minX); | ||
4567 | 151 | Y0 = Y + H * ( 1 - (m_control_knot[i].m_Y - m_minY) / (m_maxY - m_minY) ); | ||
4568 | 152 | X1 = X + W * (m_control_knot[i+1].m_X - m_minX) / (m_maxX - m_minX); | ||
4569 | 153 | Y1 = Y + H * ( 1 - (m_control_knot[i+1].m_Y - m_minY) / (m_maxY - m_minY) ); | ||
4570 | 154 | |||
4571 | 155 | GetPainter().Draw2DLine (GfxContext, X0, Y0, X1, Y1, Color (0xFF0000FF) ); | ||
4572 | 156 | |||
4573 | 157 | } | ||
4574 | 158 | |||
4575 | 159 | for (i = 0; i < nbKnot; i++) | ||
4576 | 160 | { | ||
4577 | 161 | int X0, Y0; | ||
4578 | 162 | X0 = X + W * (m_control_knot[i].m_X - m_minX) / (m_maxX - m_minX); | ||
4579 | 163 | Y0 = Y + H * ( 1 - (m_control_knot[i].m_Y - m_minY) / (m_maxY - m_minY) ); | ||
4580 | 164 | |||
4581 | 165 | if (m_control_knot[i].m_IsSelected) | ||
4582 | 166 | GetPainter().Paint2DQuadColor (GfxContext, X0 - KNOT_SIZE, Y0 - KNOT_SIZE, 2 * KNOT_SIZE, 2 * KNOT_SIZE, Color (0xFF00FF00) ); | ||
4583 | 167 | else | ||
4584 | 168 | GetPainter().Paint2DQuadColor (GfxContext, X0 - KNOT_SIZE, Y0 - KNOT_SIZE, 2 * KNOT_SIZE, 2 * KNOT_SIZE, Color (0xFF777777) ); | ||
4585 | 169 | } | ||
4586 | 170 | |||
4587 | 171 | delete[] xcon; | ||
4588 | 172 | delete[] ycon; | ||
4589 | 173 | } | ||
4590 | 174 | |||
4591 | 175 | // for(int i = 1; i < GetWidth(); i++) | ||
4592 | 176 | // { | ||
4593 | 177 | // float x1, y1; | ||
4594 | 178 | // | ||
4595 | 179 | // x1 = x0 + dX; | ||
4596 | 180 | // y1 = EvalFunction(x1); | ||
4597 | 181 | // | ||
4598 | 182 | // int X0, Y0, X1, Y1; | ||
4599 | 183 | // X0 = X + W * (x0 - m_minX) / (m_maxX - m_minX); | ||
4600 | 184 | // Y0 = Y - H * (y0 + m_minY) / (m_maxY - m_minY); | ||
4601 | 185 | // X1 = X + W * (x1 - m_minX) / (m_maxX - m_minX); | ||
4602 | 186 | // Y1 = Y - H * (y1 + m_minY) / (m_maxY - m_minY); | ||
4603 | 187 | // GetPainter().Draw2DLine(X0, Y0, X1, Y1, Color(0xFFFF0000)); | ||
4604 | 188 | // | ||
4605 | 189 | // x0 = x1; | ||
4606 | 190 | // y0 = y1; | ||
4607 | 191 | // | ||
4608 | 192 | // } | ||
4609 | 193 | GfxContext.PopClippingRectangle(); | ||
4610 | 194 | } | ||
4611 | 195 | |||
4612 | 196 | |||
4613 | 197 | void BezierCurveControl::DrawContent (GraphicsEngine &GfxContext, bool force_draw) | ||
4614 | 198 | { | ||
4615 | 199 | |||
4616 | 200 | } | ||
4617 | 201 | |||
4618 | 202 | void BezierCurveControl::PostDraw (GraphicsEngine &GfxContext, bool force_draw) | ||
4619 | 203 | { | ||
4620 | 204 | |||
4621 | 205 | } | ||
4622 | 206 | |||
4623 | 207 | |||
4624 | 208 | void BezierCurveControl::SetXAxisBounds (float minX, float maxX) | ||
4625 | 209 | { | ||
4626 | 210 | m_minX = minX; | ||
4627 | 211 | m_maxX = maxX; | ||
4628 | 212 | QueueDraw(); | ||
4629 | 213 | } | ||
4630 | 214 | |||
4631 | 215 | void BezierCurveControl::SetYAxisBounds (float minY, float maxY) | ||
4632 | 216 | { | ||
4633 | 217 | m_minY = minY; | ||
4634 | 218 | m_maxY = maxY; | ||
4635 | 219 | QueueDraw(); | ||
4636 | 220 | } | ||
4637 | 221 | |||
4638 | 222 | void BezierCurveControl::SetFunctionCallback (FunctionCallback f) | ||
4639 | 223 | { | ||
4640 | 224 | m_FunctionCallback = f; | ||
4641 | 225 | QueueDraw(); | ||
4642 | 226 | } | ||
4643 | 227 | |||
4644 | 228 | float BezierCurveControl::EvalFunction (float x) | ||
4645 | 229 | { | ||
4646 | 230 | if (m_FunctionCallback != 0) | ||
4647 | 231 | return (*m_FunctionCallback) (x); | ||
4648 | 232 | |||
4649 | 233 | return 0; | ||
4650 | 234 | } | ||
4651 | 235 | |||
4652 | 236 | void BezierCurveControl::UpdateGraph() | ||
4653 | 237 | { | ||
4654 | 238 | QueueDraw(); | ||
4655 | 239 | } | ||
4656 | 240 | |||
4657 | 241 | |||
4658 | 242 | // check if a value lies within a closed interval | ||
4659 | 243 | #ifndef INSIDE_BOUNDS | ||
4660 | 244 | #define INSIDE_BOUNDS( x, lo, hi ) ( (x) >= (lo) && (x) <= (hi) ) | ||
4661 | 245 | #endif | ||
4662 | 246 | |||
4663 | 247 | //check if a 2D point lies within a 2D box | ||
4664 | 248 | #ifndef PT_INSIDE_BOX | ||
4665 | 249 | #define PT_INSIDE_BOX( x, y, lo_x, hi_x, lo_y, hi_y ) ( INSIDE_BOUNDS(x,lo_x,hi_x) && INSIDE_BOUNDS(y,lo_y,hi_y) ) | ||
4666 | 250 | #endif | ||
4667 | 251 | |||
4668 | 252 | void BezierCurveControl::RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags) | ||
4669 | 253 | { | ||
4670 | 254 | QueueDraw(); | ||
4671 | 255 | } | ||
4672 | 256 | |||
4673 | 257 | void BezierCurveControl::RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags) | ||
4674 | 258 | { | ||
4675 | 259 | t_u32 nbKnot = (t_u32) m_control_knot.size(); | ||
4676 | 260 | |||
4677 | 261 | for (t_u32 i = 0; i < nbKnot; i++) | ||
4678 | 262 | { | ||
4679 | 263 | m_control_knot[i].m_IsSelected = false; | ||
4680 | 264 | } | ||
4681 | 265 | |||
4682 | 266 | int W = GetBaseWidth() - 2; | ||
4683 | 267 | int H = GetBaseHeight() - 2; | ||
4684 | 268 | int X = GetBaseX() + 1; | ||
4685 | 269 | int Y = GetBaseY() + 1; | ||
4686 | 270 | |||
4687 | 271 | bool b = PT_INSIDE_BOX (X + x, Y + y, X, X + W, Y, Y + H); | ||
4688 | 272 | |||
4689 | 273 | if (b == false) | ||
4690 | 274 | return; | ||
4691 | 275 | |||
4692 | 276 | X = GetBaseX(); | ||
4693 | 277 | Y = GetBaseY(); | ||
4694 | 278 | |||
4695 | 279 | for (t_u32 i = 0; i < nbKnot; i++) | ||
4696 | 280 | { | ||
4697 | 281 | int Xp, Yp; | ||
4698 | 282 | Xp = X + W * (m_control_knot[i].m_X - m_minX) / (m_maxX - m_minX); | ||
4699 | 283 | Yp = Y + H * ( 1 - (m_control_knot[i].m_Y - m_minY) / (m_maxY - m_minY) ); | ||
4700 | 284 | |||
4701 | 285 | if (PT_INSIDE_BOX (X + x, Y + y, Xp - KNOT_HIT_TEST, Xp + KNOT_HIT_TEST, Yp - KNOT_HIT_TEST, Yp + KNOT_HIT_TEST) ) | ||
4702 | 286 | { | ||
4703 | 287 | m_control_knot[i].m_IsSelected = true; | ||
4704 | 288 | break; | ||
4705 | 289 | } | ||
4706 | 290 | } | ||
4707 | 291 | |||
4708 | 292 | QueueDraw(); | ||
4709 | 293 | } | ||
4710 | 294 | |||
4711 | 295 | void BezierCurveControl::RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags) | ||
4712 | 296 | { | ||
4713 | 297 | float xp, yp; | ||
4714 | 298 | |||
4715 | 299 | int W = GetBaseWidth(); | ||
4716 | 300 | int H = GetBaseHeight(); | ||
4717 | 301 | t_u32 nbKnot = (t_u32) m_control_knot.size(); | ||
4718 | 302 | |||
4719 | 303 | xp = m_minX + (m_maxX - m_minX) * dx / W; | ||
4720 | 304 | yp = m_minY + (m_maxY - m_minY) * dy / H; | ||
4721 | 305 | |||
4722 | 306 | |||
4723 | 307 | |||
4724 | 308 | for (t_u32 i = 0; i < nbKnot; i++) | ||
4725 | 309 | { | ||
4726 | 310 | if (m_control_knot[i].m_IsSelected) | ||
4727 | 311 | { | ||
4728 | 312 | m_control_knot[i].m_X += xp; | ||
4729 | 313 | m_control_knot[i].m_Y -= yp; | ||
4730 | 314 | |||
4731 | 315 | if (m_control_knot[i].m_X < m_minX) | ||
4732 | 316 | { | ||
4733 | 317 | m_control_knot[i].m_X = m_minX; | ||
4734 | 318 | } | ||
4735 | 319 | |||
4736 | 320 | if (m_control_knot[i].m_X > m_maxX) | ||
4737 | 321 | { | ||
4738 | 322 | m_control_knot[i].m_X = m_maxX; | ||
4739 | 323 | } | ||
4740 | 324 | |||
4741 | 325 | if (m_control_knot[i].m_Y < m_minY) | ||
4742 | 326 | { | ||
4743 | 327 | m_control_knot[i].m_Y = m_minY; | ||
4744 | 328 | } | ||
4745 | 329 | |||
4746 | 330 | if (m_control_knot[i].m_Y > m_maxY) | ||
4747 | 331 | { | ||
4748 | 332 | m_control_knot[i].m_Y = m_maxY; | ||
4749 | 333 | } | ||
4750 | 334 | |||
4751 | 335 | break; | ||
4752 | 336 | } | ||
4753 | 337 | } | ||
4754 | 338 | |||
4755 | 339 | QueueDraw(); | ||
4756 | 340 | } | ||
4757 | 341 | |||
4758 | 342 | |||
4759 | 343 | } | ||
4760 | 344 | 0 | ||
4761 | === removed file 'Nux/BezierCurveControl.h' | |||
4762 | --- Nux/BezierCurveControl.h 2011-04-06 21:54:09 +0000 | |||
4763 | +++ Nux/BezierCurveControl.h 1970-01-01 00:00:00 +0000 | |||
4764 | @@ -1,105 +0,0 @@ | |||
4765 | 1 | /* | ||
4766 | 2 | * Copyright 2010 Inalogic® Inc. | ||
4767 | 3 | * | ||
4768 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4769 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
4770 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
4771 | 7 | * of the License. | ||
4772 | 8 | * | ||
4773 | 9 | * This program is distributed in the hope that it will be useful, but | ||
4774 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
4775 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
4776 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
4777 | 13 | * License for more details. | ||
4778 | 14 | * | ||
4779 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
4780 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
4781 | 17 | * | ||
4782 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
4783 | 19 | * | ||
4784 | 20 | */ | ||
4785 | 21 | |||
4786 | 22 | |||
4787 | 23 | #ifndef BEZIERCURVECONTROL_H | ||
4788 | 24 | #define BEZIERCURVECONTROL_H | ||
4789 | 25 | |||
4790 | 26 | namespace nux | ||
4791 | 27 | { | ||
4792 | 28 | |||
4793 | 29 | class Knot | ||
4794 | 30 | { | ||
4795 | 31 | public : | ||
4796 | 32 | |||
4797 | 33 | float m_X; | ||
4798 | 34 | float m_Y; | ||
4799 | 35 | |||
4800 | 36 | bool m_IsSelected; | ||
4801 | 37 | |||
4802 | 38 | public : | ||
4803 | 39 | |||
4804 | 40 | Knot() | ||
4805 | 41 | : m_X (0) | ||
4806 | 42 | , m_Y (0) | ||
4807 | 43 | , m_IsSelected (false) | ||
4808 | 44 | {} //Constructors | ||
4809 | 45 | Knot (float ptX, float ptY) | ||
4810 | 46 | : m_X (ptX) | ||
4811 | 47 | , m_Y (ptY) | ||
4812 | 48 | , m_IsSelected (false) | ||
4813 | 49 | {} | ||
4814 | 50 | |||
4815 | 51 | void setPoint (float x, float y) | ||
4816 | 52 | { | ||
4817 | 53 | m_X = x; //Setting | ||
4818 | 54 | m_Y = y; | ||
4819 | 55 | } | ||
4820 | 56 | |||
4821 | 57 | |||
4822 | 58 | //Operator overloading | ||
4823 | 59 | void operator = (Knot knot) | ||
4824 | 60 | { | ||
4825 | 61 | m_X = knot.m_X; | ||
4826 | 62 | m_Y = knot.m_Y; | ||
4827 | 63 | } | ||
4828 | 64 | bool operator != (Knot knot) | ||
4829 | 65 | { | ||
4830 | 66 | bool b; | ||
4831 | 67 | b = ( (m_X != knot.m_X) || (m_Y != knot.m_Y) ) ? true : false; | ||
4832 | 68 | return b; | ||
4833 | 69 | } | ||
4834 | 70 | }; | ||
4835 | 71 | |||
4836 | 72 | |||
4837 | 73 | typedef float (*FunctionCallback) (float); | ||
4838 | 74 | |||
4839 | 75 | class BezierCurveControl : public View | ||
4840 | 76 | { | ||
4841 | 77 | public: | ||
4842 | 78 | BezierCurveControl (NUX_FILE_LINE_PROTO); | ||
4843 | 79 | ~BezierCurveControl(); | ||
4844 | 80 | virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); | ||
4845 | 81 | virtual void Draw (GraphicsEngine &GfxContext, bool force_draw); | ||
4846 | 82 | virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw); | ||
4847 | 83 | virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw); | ||
4848 | 84 | |||
4849 | 85 | |||
4850 | 86 | void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags); | ||
4851 | 87 | void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags); | ||
4852 | 88 | void RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); | ||
4853 | 89 | private: | ||
4854 | 90 | void SetXAxisBounds (float minX, float maxX); | ||
4855 | 91 | void SetYAxisBounds (float minY, float maxY); | ||
4856 | 92 | void SetFunctionCallback (FunctionCallback f); | ||
4857 | 93 | float EvalFunction (float x); | ||
4858 | 94 | void UpdateGraph(); | ||
4859 | 95 | |||
4860 | 96 | std::vector<Knot> m_control_knot; | ||
4861 | 97 | |||
4862 | 98 | float m_minX, m_minY, m_maxX, m_maxY; | ||
4863 | 99 | FunctionCallback m_FunctionCallback; | ||
4864 | 100 | }; | ||
4865 | 101 | |||
4866 | 102 | |||
4867 | 103 | } | ||
4868 | 104 | |||
4869 | 105 | #endif // BEZIERCURVECONTROL_H | ||
4870 | 106 | 0 | ||
4871 | === removed file 'Nux/BezierCurveControl2.cpp' | |||
4872 | --- Nux/BezierCurveControl2.cpp 2011-09-20 06:03:43 +0000 | |||
4873 | +++ Nux/BezierCurveControl2.cpp 1970-01-01 00:00:00 +0000 | |||
4874 | @@ -1,1046 +0,0 @@ | |||
4875 | 1 | /* | ||
4876 | 2 | * Copyright 2010 Inalogic® Inc. | ||
4877 | 3 | * | ||
4878 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4879 | 5 | * under the terms of the GNU Lesser General Public License, as | ||
4880 | 6 | * published by the Free Software Foundation; either version 2.1 or 3.0 | ||
4881 | 7 | * of the License. | ||
4882 | 8 | * | ||
4883 | 9 | * This program is distributed in the hope that it will be useful, but | ||
4884 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
4885 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
4886 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
4887 | 13 | * License for more details. | ||
4888 | 14 | * | ||
4889 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
4890 | 16 | * License along with this program. If not, see <http://www.gnu.org/licenses/> | ||
4891 | 17 | * | ||
4892 | 18 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
4893 | 19 | * | ||
4894 | 20 | */ | ||
4895 | 21 | |||
4896 | 22 | |||
4897 | 23 | #include "Nux.h" | ||
4898 | 24 | |||
4899 | 25 | #include "BezierCurveControl2.h" | ||
4900 | 26 | #include "NuxCore/Math/Bezier.h" | ||
4901 | 27 | |||
4902 | 28 | namespace nux | ||
4903 | 29 | { | ||
4904 | 30 | |||
4905 | 31 | static const int KNOT_SIZE = 2; | ||
4906 | 32 | static const int KNOT_HIT_TEST = 4; | ||
4907 | 33 | static const int CURVE_DEGREE = 3; | ||
4908 | 34 | static const int GRAPH_MARGIN = 2; | ||
4909 | 35 | static const int UNIT_REFERENCE = 15; | ||
4910 | 36 | |||
4911 | 37 | unsigned long S_KEY = 0; | ||
4912 | 38 | |||
4913 | 39 | BezierCurveControl2::BezierCurveControl2 (NUX_FILE_LINE_DECL) | ||
4914 | 40 | : View (NUX_FILE_LINE_PARAM) | ||
4915 | 41 | , m_minX (-0.10f), | ||
4916 | 42 | m_minY (-0.100f), | ||
4917 | 43 | m_maxX (1.100f), | ||
4918 | 44 | m_maxY (1.100f), | ||
4919 | 45 | m_FunctionCallback (0), | ||
4920 | 46 | m_bControlPointSelected (0), | ||
4921 | 47 | m_bPanningEnabled (true), | ||
4922 | 48 | m_bZoomingEnabled (true) | ||
4923 | 49 | { | ||
4924 | 50 | SetMinimumSize (180, 180); | ||
4925 | 51 | |||
4926 | 52 | m_control_knot.push_back (Knot2 (0.0f, 0.0f) ); | ||
4927 | 53 | m_control_knot.push_back (Knot2 (0.1f, 0.0f) ); | ||
4928 | 54 | m_control_knot.push_back (Knot2 (0.7f, 0.9f) ); | ||
4929 | 55 | m_control_knot.push_back (Knot2 (1.0f, 1.0f) ); | ||
4930 | 56 | |||
4931 | 57 | mouse_down.connect (sigc::mem_fun (this, &BezierCurveControl2::RecvMouseDown) ); | ||
4932 | 58 | mouse_up.connect (sigc::mem_fun (this, &BezierCurveControl2::RecvMouseUp) ); | ||
4933 | 59 | mouse_drag.connect (sigc::mem_fun (this, &BezierCurveControl2::RecvMouseDrag) ); | ||
4934 | 60 | |||
4935 | 61 | key_down.connect (sigc::mem_fun (this, &BezierCurveControl2::RecvKeyEvent) ); | ||
4936 | 62 | |||
4937 | 63 | NTextureData image; | ||
4938 | 64 | MakeCheckBoardImage (image.GetSurface (0), 64, 64, Color (0xff323232), Color (0xff535353), 8, 8); | ||
4939 | 65 | BaseTexture* m_CheckboardPattern = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture (); | ||
4940 | 66 | m_CheckboardPattern->Update (&image); | ||
4941 | 67 | |||
4942 | 68 | TexCoordXForm texxform; | ||
4943 | 69 | texxform.SetTexCoordType (TexCoordXForm::OFFSET_COORD); | ||
4944 | 70 | texxform.SetWrap (TEXWRAP_REPEAT, TEXWRAP_REPEAT); | ||
4945 | 71 | m_Background = new TextureLayer (m_CheckboardPattern->GetDeviceTexture(), texxform, color::White); | ||
4946 | 72 | |||
4947 | 73 | m_CheckboardPattern->UnReference (); | ||
4948 | 74 | } | ||
4949 | 75 | |||
4950 | 76 | BezierCurveControl2::~BezierCurveControl2() | ||
4951 | 77 | { | ||
4952 | 78 | delete m_Background; | ||
4953 | 79 | } | ||
4954 | 80 | |||
4955 | 81 | long BezierCurveControl2::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) | ||
4956 | 82 | { | ||
4957 | 83 | long ret = TraverseInfo; | ||
4958 | 84 | |||
4959 | 85 | if (ievent.e_event == NUX_MOUSE_PRESSED) | ||
4960 | 86 | { | ||
4961 | 87 | if (!GetGeometry().IsPointInside (ievent.e_x, ievent.e_y) ) | ||
4962 | 88 | { | ||
4963 | 89 | //ProcEvInfo = eDoNotProcess; | ||
4964 | 90 | //return TraverseInfo; | ||
4965 | 91 | } | ||
4966 | 92 | } | ||
4967 | 93 | |||
4968 | 94 | S_KEY = ievent.GetVirtualKeyState (NUX_VK_S); | ||
4969 | 95 | ret = PostProcessEvent2 (ievent, ret, ProcessEventInfo); | ||
4970 | 96 | return ret; | ||
4971 | 97 | } | ||
4972 | 98 | |||
4973 | 99 | |||
4974 | 100 | void BezierCurveControl2::Draw (GraphicsEngine &GfxContext, bool force_draw) | ||
4975 | 101 | { | ||
4976 | 102 | Geometry base = GetGeometry(); | ||
4977 | 103 | |||
4978 | 104 | GetPainter().PaintBackground (GfxContext, base); | ||
4979 | 105 | GetPainter().Paint2DQuadColor (GfxContext, base, Color (COLOR_BACKGROUND_PRIMARY) ); | ||
4980 | 106 | base.OffsetPosition (GRAPH_MARGIN, GRAPH_MARGIN); | ||
4981 | 107 | base.OffsetSize (-2 * GRAPH_MARGIN, -2 * GRAPH_MARGIN); | ||
4982 | 108 | |||
4983 | 109 | int W = GetBaseWidth() - 2 * GRAPH_MARGIN; | ||
4984 | 110 | int H = GetBaseHeight() - 2 * GRAPH_MARGIN; | ||
4985 | 111 | int X = GetBaseX() + GRAPH_MARGIN; | ||
4986 | 112 | int Y = GetBaseY() + GRAPH_MARGIN; | ||
4987 | 113 | |||
4988 | 114 | t_u32 i; | ||
4989 | 115 | int nsample = base.GetWidth(); | ||
4990 | 116 | double t; | ||
4991 | 117 | t_u32 nbKnot = (t_u32) m_control_knot.size(); | ||
4992 | 118 | |||
4993 | 119 | GfxContext.PushClippingRectangle (base); | ||
4994 | 120 | |||
4995 | 121 | GetPainter().PushDrawLayer (GfxContext, base, m_Background); | ||
4996 | 122 | GetPainter().PopBackground(); | ||
4997 | 123 | |||
4998 | 124 | //DrawGrid(GfxContext); | ||
4999 | 125 | DrawCoordinateSystem (GfxContext); | ||
5000 | 126 |
Thank you for your patch!
Before we can accept it, we require you to agree to inalogic's contributor agreement (http:// inalogic. com/license). If you accept it, send and email to <email address hidden> and state that you agree.