Nux

Merge lp:~haggai-eran/nux/rtl into lp:nux

Proposed by Haggai Eran
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
Reviewer Review Type Date Requested Status
Tim Penhey (community) Needs Fixing
Jay Taoko Pending
Review via email: mp+71538@code.launchpad.net

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_get_default_direction), and also GetDirection and SetDirection per Area.
The second patch implements interface mirroring for the HLayout class, when using a RightToLeft direction.

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) wrote :

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.

Revision history for this message
Haggai Eran (haggai-eran) wrote :

Okay, I've sent the email.

Revision history for this message
Jay Taoko (jaytaoko) wrote :

thanks, got it!

Revision history for this message
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

Revision history for this message
Haggai Eran (haggai-eran) wrote :

  That's too bad. I was hoping to get my patches for unity 2d into Oneiric.

lp:~haggai-eran/nux/rtl updated
417. By Haggai Eran

Merged trunk.

418. By Haggai Eran

Merge trunk.

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Haggai Eran (haggai-eran) wrote :

Thanks,
Let me know if I can help.

Revision history for this message
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

Revision history for this message
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

Revision history for this message
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.

review: Needs Fixing
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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?

Revision history for this message
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.

Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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
6 #include "Nux.h"
7 #include "AbstractButton.h"
8-#include "HLayout.h"
9+#include "StaticText.h"
10
11 namespace nux
12 {
13@@ -30,20 +30,15 @@
14
15 AbstractButton::AbstractButton(NUX_FILE_LINE_DECL)
16 : View(NUX_FILE_LINE_PARAM)
17- , state(NUX_STATE_NORMAL)
18- {
19- active = false;
20- togglable_ = false;
21- Init();
22- }
23-
24- AbstractButton::~AbstractButton()
25- {
26-
27- }
28-
29- void AbstractButton::Init()
30- {
31+ , visual_state_(VISUAL_STATE_NORMAL)
32+ {
33+ active_ = false;
34+ mouse_pressed_ = false;
35+ static_text_ = NULL;
36+ label_color_ = color::White;
37+ same_size_as_content_ = false;
38+ label_font_size_ = 12;
39+
40 mouse_click.connect(sigc::mem_fun(this, &AbstractButton::RecvClick));
41 mouse_down.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseDown));
42 mouse_double_click.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseDown));
43@@ -53,50 +48,50 @@
44 mouse_leave.connect(sigc::mem_fun(this, &AbstractButton::RecvMouseLeave));
45 }
46
47- long AbstractButton::ProcessEvent(IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
48- {
49- return PostProcessEvent2 (ievent, TraverseInfo, ProcessEventInfo);
50- }
51-
52- void AbstractButton::RecvClick(int x, int y, unsigned long button_flags, unsigned long key_flags)
53- {
54- if (!IsViewActive())
55- return;
56-
57- if(togglable_)
58- {
59- active = !active;
60- }
61+ AbstractButton::~AbstractButton()
62+ {
63+
64+ }
65+
66+ bool AbstractButton::Active() const
67+ {
68+ return active_;
69+ }
70+
71+ void AbstractButton::SetActive(bool active)
72+ {
73+ if (active)
74+ Activate();
75 else
76- {
77- active = true;
78- }
79-
80- if(togglable_ == false)
81- {
82- active = false;
83- }
84-
85- activated.emit(this);
86- QueueDraw();
87+ Deactivate();
88+ }
89+
90+ ButtonVisualState AbstractButton::GetVisualState()
91+ {
92+ return visual_state_;
93 }
94
95 void AbstractButton::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags)
96 {
97- if (!IsViewActive())
98- return;
99+ if (IsMousePointerInside())
100+ {
101+ visual_state_ = VISUAL_STATE_PRELIGHT;
102+ }
103+ else
104+ {
105+ visual_state_ = VISUAL_STATE_NORMAL;
106+ }
107
108- state = NUX_STATE_PRELIGHT;
109- //state = 1;
110+ mouse_pressed_ = false;
111+ visual_state_change.emit(this);
112 QueueDraw();
113 }
114
115 void AbstractButton::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)
116 {
117- if (!IsViewActive())
118- return;
119-
120- state = NUX_STATE_ACTIVE;
121+ visual_state_ = VISUAL_STATE_PRESSED;
122+ mouse_pressed_ = true;
123+ visual_state_change.emit(this);
124 QueueDraw();
125 }
126
127@@ -107,13 +102,54 @@
128
129 void AbstractButton::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags)
130 {
131- state = NUX_STATE_PRELIGHT;
132+ if (mouse_pressed_)
133+ {
134+ visual_state_ = VISUAL_STATE_PRESSED;
135+ }
136+ else
137+ {
138+ visual_state_ = VISUAL_STATE_PRELIGHT;
139+ }
140+
141+ visual_state_change.emit(this);
142 QueueDraw();
143 }
144
145 void AbstractButton::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags)
146 {
147- state = NUX_STATE_NORMAL;
148- QueueDraw();
149+ visual_state_ = VISUAL_STATE_NORMAL;
150+ visual_state_change.emit(this);
151+ QueueDraw();
152+ }
153+
154+ void AbstractButton::SetLabelColor(const Color &color)
155+ {
156+ label_color_ = color;
157+ if (static_text_)
158+ static_text_->SetTextColor(label_color_);
159+ QueueDraw();
160+ }
161+
162+ Color AbstractButton::GetLabelColor()
163+ {
164+ return label_color_;
165+ }
166+
167+ ButtonVisualState AbstractButton::GetVisualState() const
168+ {
169+ return visual_state_;
170+ }
171+
172+ void AbstractButton::SetLabelFontSize(int point)
173+ {
174+ if (point < 0)
175+ return;
176+
177+ label_font_size_ = point;
178+ }
179+
180+ int AbstractButton::GetLabelFontSize() const
181+ {
182+ return label_font_size_;
183 }
184 }
185
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
191 namespace nux
192 {
193- enum State
194+ class StaticText;
195+
196+ enum ButtonVisualState
197 {
198- NUX_STATE_ACTIVE = 0,
199- NUX_STATE_NORMAL = 1,
200- NUX_STATE_PRELIGHT = 2,
201- NUX_STATE_SELECTED = 3,
202- NUX_STATE_INSENSITIVE = 4
203+ VISUAL_STATE_PRESSED = 0,
204+ VISUAL_STATE_NORMAL = 1,
205+ VISUAL_STATE_PRELIGHT = 2,
206+ VISUAL_STATE_DISABLED = 3
207 };
208
209- //! The base class of Button widgets.
210+ //! The base class of button type widgets.
211+ /*!
212+ AbstractButton is the direct base class of Button, CheckBox and RadioButton. It is a base class for ToggleButton.
213+ */
214 class AbstractButton : public View
215 {
216 NUX_DECLARE_OBJECT_TYPE(AbstractButton, View);
217 public:
218 AbstractButton(NUX_FILE_LINE_PROTO);
219- ~AbstractButton();
220-
221- //! Signal emitted when the button is activated.
222- Property<bool> active;
223-
224- //! Signal emitted when the button is activated.
225- sigc::signal<void, AbstractButton*> activated;
226+ virtual ~AbstractButton();
227+
228+ sigc::signal<void, AbstractButton*> visual_state_change;
229+
230+ //! Returns the visual state of the AbstractButton
231+ /*!
232+ Returns the visual state of the AbstractButton.
233+
234+ @return The visual state of the AbstractButton.
235+ */
236+ ButtonVisualState GetVisualState();
237+
238+ //! Return the active state of the button.
239+ /*!
240+ Return the active state of the button. A Button has a non-persistent active state. It always returns false.
241+ CheckBox, RadionButton and ToggleButton return true if they are active.
242+
243+ @return True if the button object is in an active state.
244+ */
245+ bool Active() const;
246+
247+ //! Activate the button.
248+ /*!
249+ Activate the button. If this object is a Button, then it has no persistent state and the function does nothing.
250+ */
251+ virtual void Activate() = 0;
252+
253+ //! Deactivate the button.
254+ /*!
255+ Deactivate the button. If this object is a Button, then it has no persistent state and the function does nothing.
256+ */
257+ virtual void Deactivate() = 0;
258+
259+ //! Set the state of the button.
260+ /*!
261+ Set the sate of the button. The button is either activated or deactivated.
262+
263+ @param active The button state.
264+ */
265+ virtual void SetActive(bool active);
266+
267+ //! Set the text color.
268+ /*!
269+ Set the text color.
270+
271+ @param color the text color.
272+ */
273+ void SetLabelColor(const Color &color);
274+
275+ //! Get the text color.
276+ /*!
277+ Get the text color.
278+
279+ @return The text color.
280+ */
281+ Color GetLabelColor();
282+
283+ //! Get the button visual state.
284+ /*!
285+ Get the button visual state.
286+
287+ @return The button visual state.
288+ */
289+ ButtonVisualState GetVisualState() const;
290+
291+ virtual void SetLabelFontSize(int point);
292+ int GetLabelFontSize() const;
293
294 protected:
295- bool togglable_;
296-
297- //! Button state property.
298- // FIXME: Should be read only.
299- nux::Property<State> state;
300-
301- virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
302-
303- void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags);
304- void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
305- void RecvMouseMove (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
306- void RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags);
307- void RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags);
308- void RecvClick (int x, int y, unsigned long button_flags, unsigned long key_flags);
309-
310- private:
311- void Init ();
312+ //! The state of the AbstractButton.
313+ bool active_;
314+
315+ bool mouse_pressed_;
316+
317+ //! Visual state of the button object.
318+ ButtonVisualState visual_state_;
319+
320+
321+ // Common attribute for all the classes that inherit from AbstractButton.
322+ std::string label_;
323+ Color label_color_;
324+ StaticText *static_text_;
325+ int label_font_size_;
326+ bool same_size_as_content_;
327+ int pre_layout_width_;
328+ int pre_layout_height_;
329+
330+ virtual void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags);
331+ virtual void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
332+ virtual void RecvMouseMove (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
333+ virtual void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
334+ virtual void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
335+ virtual void RecvClick (int x, int y, unsigned long button_flags, unsigned long key_flags) = 0;
336 };
337 }
338
339
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+/*
345+ * Copyright 2010 Inalogic® Inc.
346+ *
347+ * This program is free software: you can redistribute it and/or modify it
348+ * under the terms of the GNU Lesser General Public License, as
349+ * published by the Free Software Foundation; either version 2.1 or 3.0
350+ * of the License.
351+ *
352+ * This program is distributed in the hope that it will be useful, but
353+ * WITHOUT ANY WARRANTY; without even the implied warranties of
354+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
355+ * PURPOSE. See the applicable version of the GNU Lesser General Public
356+ * License for more details.
357+ *
358+ * You should have received a copy of both the GNU Lesser General Public
359+ * License along with this program. If not, see <http://www.gnu.org/licenses/>
360+ *
361+ * Authored by: Jay Taoko <jaytaoko@inalogic.com>
362+ *
363+ */
364+
365+
366+#include "Nux.h"
367+#include "HLayout.h"
368+#include "AbstractCheckedButton.h"
369+#include "StaticText.h"
370+
371+namespace nux
372+{
373+ NUX_IMPLEMENT_OBJECT_TYPE(AbstractCheckedButton);
374+
375+ AbstractCheckedButton::AbstractCheckedButton(const std::string &str, bool state, NUX_FILE_LINE_DECL)
376+ : AbstractButton(NUX_FILE_LINE_PARAM)
377+ {
378+ label_ = str;
379+ active_ = state;
380+ hlayout_ = 0;
381+
382+ static_text_ = new StaticText(label_, NUX_TRACKER_LOCATION);
383+ static_text_->SetTextColor(label_color_);
384+ hlayout_ = new HLayout(NUX_TRACKER_LOCATION);
385+ check_area_ = new InputArea(NUX_TRACKER_LOCATION);
386+
387+ check_area_->SetInputEventSensitivity(false);
388+ static_text_->SetInputEventSensitivity(false);
389+
390+ // Set Geometry
391+ check_area_->SetMinMaxSize(14, 14);
392+
393+ hlayout_->SetSpaceBetweenChildren(4);
394+ hlayout_->SetContentDistribution(MAJOR_POSITION_LEFT);
395+ hlayout_->AddView(check_area_, 0, MINOR_POSITION_CENTER, MINOR_SIZE_MATCHCONTENT);
396+ hlayout_->AddView(static_text_, 1, MINOR_POSITION_CENTER, MINOR_SIZE_MATCHCONTENT);
397+
398+// // This is convenient to make the layout and the AbstractCheckedButton fit the check area and the caption area.
399+// // Since the check area is bigger than 4x4, it will force the layout and the AbstractCheckedButton to grow.
400+// // 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+// // will be adjusted to fit the minimum width of the check area and the caption area.
402+// {
403+// hlayout_->SetMinimumSize(1, 1);
404+// SetMinimumSize(14, 14);
405+// ApplyMinWidth();
406+// ApplyMinHeight();
407+// }
408+
409+ hlayout_->SetScaleFactor(0);
410+ SetLayout(hlayout_);
411+
412+ }
413+
414+ AbstractCheckedButton::~AbstractCheckedButton()
415+ {
416+ }
417+
418+ void AbstractCheckedButton::SetLabel(const std::string &checkbox_label)
419+ {
420+ label_ = checkbox_label;
421+ static_text_->SetText(label_);
422+ QueueDraw();
423+ }
424+
425+ std::string AbstractCheckedButton::GetLabel() const
426+ {
427+ return label_;
428+ }
429+
430+ void AbstractCheckedButton::Draw(GraphicsEngine &graphics_engine, bool force_draw)
431+ {
432+ Geometry base = GetGeometry();
433+ graphics_engine.PushClippingRectangle(base);
434+
435+ GetPainter().PaintBackground(graphics_engine, base);
436+
437+ InteractState is;
438+ is.is_on = active_;
439+
440+ if (visual_state_ == VISUAL_STATE_PRESSED)
441+ {
442+ is.is_focus = true;
443+ }
444+ else if (visual_state_ == VISUAL_STATE_PRELIGHT)
445+ {
446+ is.is_prelight = true;
447+ }
448+ else
449+ {
450+ is.is_focus = false;
451+ is.is_prelight = false;
452+ }
453+
454+ GetPainter().PushPaintLayerStack();
455+ {
456+ GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometry(), is, Color(0xff000000));
457+ static_text_->ProcessDraw(graphics_engine, true);
458+ }
459+ GetPainter().PopPaintLayerStack();
460+
461+ graphics_engine.PopClippingRectangle();
462+ }
463+
464+ long AbstractCheckedButton::ComputeContentSize()
465+ {
466+ if (view_layout_)
467+ {
468+ PreLayoutManagement();
469+
470+ int old_width = GetBaseWidth();
471+ int old_height = GetBaseHeight();
472+
473+ // Let the text view be as large as possible.
474+ static_text_->SetMaximumWidth(AREA_MAX_WIDTH);
475+
476+ // Constrain the vertical expansion of the color selector.
477+ view_layout_->SetBaseHeight(1);
478+ long ret = view_layout_->ComputeContentSize();
479+
480+ PostLayoutManagement(ret);
481+
482+ {
483+ // Check if the text view goes out of the AbstractCheckedButton area.
484+ Geometry base = GetGeometry();
485+ Geometry text_geo = static_text_->GetGeometry();
486+
487+ // Intersect the AbstractCheckedButton and the text view
488+ Geometry intersection = base.Intersect(text_geo);
489+ if (intersection != text_geo)
490+ {
491+ // The text view goes outside of the AbstractCheckedButton area. We have to clip it
492+ static_text_->SetMaximumWidth(intersection.width);
493+
494+ // Assign a size of 1 to the layout and call ComputeContentSize.
495+ // Inside the StaticText::ComputeContentSize there is code that takes care of size negociation.
496+ view_layout_->SetBaseWidth(1);
497+ ret = view_layout_->ComputeContentSize();
498+
499+ // Assign the layout geometry to the AbstractCheckedButton view.
500+ PostLayoutManagement(ret);
501+ }
502+ }
503+
504+ int new_width = GetBaseWidth();
505+ int new_height = GetBaseHeight();
506+
507+ long size_compliance = 0;
508+
509+ // The layout has been resized to tightly pack its content
510+ if (new_width > old_width)
511+ {
512+ size_compliance |= eLargerWidth; // need scrollbar
513+ }
514+ else if (new_width < old_width)
515+ {
516+ size_compliance |= eSmallerWidth;
517+ }
518+ else
519+ {
520+ size_compliance |= eCompliantWidth;
521+ }
522+
523+ // The layout has been resized to tightly pack its content
524+ if (new_height > old_height)
525+ {
526+ size_compliance |= eLargerHeight; // need scrollbar
527+ }
528+ else if (new_height < old_height)
529+ {
530+ size_compliance |= eSmallerHeight;
531+ }
532+ else
533+ {
534+ size_compliance |= eCompliantHeight;
535+ }
536+
537+ return size_compliance;
538+ }
539+ else
540+ {
541+ PreLayoutManagement();
542+ int ret = PostLayoutManagement(eCompliantHeight | eCompliantWidth);
543+ return ret;
544+ }
545+
546+ return 0;
547+ }
548+
549+ void AbstractCheckedButton::SetLabelFontSize(int point)
550+ {
551+ AbstractButton::SetLabelFontSize(point);
552+ if (static_text_ == NULL)
553+ return;
554+
555+ static_text_->SetTextPointSize(point);
556+
557+ ComputeContentSize();
558+ QueueDraw();
559+ }
560+}
561
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+/*
567+ * Copyright 2010 Inalogic® Inc.
568+ *
569+ * This program is free software: you can redistribute it and/or modify it
570+ * under the terms of the GNU Lesser General Public License, as
571+ * published by the Free Software Foundation; either version 2.1 or 3.0
572+ * of the License.
573+ *
574+ * This program is distributed in the hope that it will be useful, but
575+ * WITHOUT ANY WARRANTY; without even the implied warranties of
576+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
577+ * PURPOSE. See the applicable version of the GNU Lesser General Public
578+ * License for more details.
579+ *
580+ * You should have received a copy of both the GNU Lesser General Public
581+ * License along with this program. If not, see <http://www.gnu.org/licenses/>
582+ *
583+ * Authored by: Jay Taoko <jaytaoko@inalogic.com>
584+ *
585+ */
586+
587+
588+#ifndef ABSTRACTCHECKEDBUTTON_H
589+#define ABSTRACTCHECKEDBUTTON_H
590+
591+#include "AbstractButton.h"
592+
593+namespace nux
594+{
595+ class HLayout;
596+ class InputArea;
597+ class StaticText;
598+
599+ //! AbstractCheckedButton class
600+ /*!
601+ Acts as a base class for CheckBox and radioButton.\n
602+ */
603+ class AbstractCheckedButton: public AbstractButton
604+ {
605+ NUX_DECLARE_OBJECT_TYPE(AbstractCheckedButton, AbstractButton);
606+ public:
607+ AbstractCheckedButton(const std::string &str, bool state = false, NUX_FILE_LINE_PROTO);
608+ virtual ~AbstractCheckedButton();
609+
610+ //! Emitted when the button is clicked.
611+ sigc::signal<void, AbstractCheckedButton*> click;
612+
613+ //! Emitted when the active state changes.
614+ /*!
615+ Emitted when the active state changes, as a result of a mouse click or an API call.\n
616+ \sa Activate, Deactivate.
617+ */
618+ sigc::signal<void, AbstractCheckedButton*> state_change;
619+
620+ //! Set the label.
621+ /*!
622+ Set the label of this AbstractCheckedButton. If the \a label argument is an empty string, then the the AbstractCheckedButton label is destroyed,
623+ and the content of the AbstractCheckedButton is re-arranged accordingly.
624+
625+ @param label The label of the AbstractCheckedButton.
626+ */
627+ void SetLabel(const std::string &checkbox_label);
628+
629+ //!Return the label of this AbstractCheckedButton.
630+ /*!
631+ Return the label of this AbstractCheckedButton.
632+
633+ @return The AbstractCheckedButton label string.
634+ */
635+ std::string GetLabel() const;
636+
637+ //! Activate the check box.
638+ /*!
639+ Activate the check box.
640+ */
641+ virtual void Activate() = 0;
642+
643+ //! Deactivate the check box.
644+ /*!
645+ Deactivate the check box.
646+ */
647+ virtual void Deactivate() = 0;
648+
649+ virtual void SetLabelFontSize(int point);
650+
651+ protected:
652+ virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw) = 0;
653+ virtual void RecvClick(int x, int y, unsigned long button_flags, unsigned long key_flags) = 0;
654+ virtual long ComputeContentSize();
655+
656+ HLayout *hlayout_;
657+ InputArea *check_area_;
658+
659+ private:
660+ //! Override of Area::SetMinimumHeight and made private.
661+ /*!
662+ Prevent changing the minimum height of the StaticText view.
663+ */
664+ virtual void SetMinimumHeight(){};
665+
666+ //! Override of Area::SetMaximumHeight and made private.
667+ /*!
668+ Prevent changing the maximum height of the StaticText view.
669+ */
670+ virtual void SetMaximumHeight(){};
671+ };
672+
673+}
674+
675+#endif // ABSTRACTCHECKEDBUTTON_H
676
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 namespace nux
682 {
683
684- Color AbstractComboBox::m_sCOMBO_COLOR = Color (0x009F9F00);
685- Color AbstractComboBox::m_sCOMBO_BUTTON_COLOR = Color (0x00FFFFFF);
686- Color AbstractComboBox::m_sCOMBO_MOUSEOVER_COLOR = Color (0x55FFFFFF);
687+ Color AbstractComboBox::m_sCOMBO_COLOR = Color(0x009F9F00);
688+ Color AbstractComboBox::m_sCOMBO_BUTTON_COLOR = Color(0x00FFFFFF);
689+ Color AbstractComboBox::m_sCOMBO_MOUSEOVER_COLOR = Color(0x55FFFFFF);
690
691- AbstractComboBox::AbstractComboBox (NUX_FILE_LINE_DECL)
692- : View (NUX_FILE_LINE_PARAM)
693- , m_MenuIsActive (false)
694+ AbstractComboBox::AbstractComboBox(NUX_FILE_LINE_DECL)
695+ : View(NUX_FILE_LINE_PARAM)
696+ , m_MenuIsActive(false)
697 {
698 m_hlayout = new HLayout(NUX_TRACKER_LOCATION);
699 _combo_box_area = new InputArea(NUX_TRACKER_LOCATION);
700 _combo_box_opening_area = new InputArea(NUX_TRACKER_LOCATION);
701
702- m_hlayout->AddView (_combo_box_area, 1);
703- m_hlayout->AddView (_combo_box_opening_area, 0);
704- m_hlayout->SetHorizontalExternalMargin (0);
705- m_hlayout->SetVerticalExternalMargin (0);
706- SetLayout (m_hlayout);
707-
708- _combo_box_area->mouse_enter.connect (sigc::mem_fun (this, &AbstractComboBox::RecvMouseEnter) );
709- _combo_box_area->mouse_leave.connect (sigc::mem_fun (this, &AbstractComboBox::RecvMouseLeave) );
710-
711- _combo_box_opening_area->mouse_enter.connect (sigc::mem_fun (this, &AbstractComboBox::RecvMouseEnter) );
712- _combo_box_opening_area->mouse_leave.connect (sigc::mem_fun (this, &AbstractComboBox::RecvMouseLeave) );
713-
714- SetTextColor (color::Black);
715-
716- _pango_static_text = new StaticText (TEXT(""), NUX_TRACKER_LOCATION);
717+ m_hlayout->AddView(_combo_box_area, 1);
718+ m_hlayout->AddView(_combo_box_opening_area, 0);
719+ m_hlayout->SetHorizontalExternalMargin(0);
720+ m_hlayout->SetVerticalExternalMargin(0);
721+ SetLayout(m_hlayout);
722+
723+ _combo_box_area->mouse_enter.connect(sigc::mem_fun(this, &AbstractComboBox::RecvMouseEnter));
724+ _combo_box_area->mouse_leave.connect(sigc::mem_fun(this, &AbstractComboBox::RecvMouseLeave));
725+
726+ _combo_box_opening_area->mouse_enter.connect(sigc::mem_fun(this, &AbstractComboBox::RecvMouseEnter));
727+ _combo_box_opening_area->mouse_leave.connect(sigc::mem_fun(this, &AbstractComboBox::RecvMouseLeave));
728+
729+ SetTextColor(color::Black);
730+
731+ _pango_static_text = new StaticText("", NUX_TRACKER_LOCATION);
732 }
733
734 AbstractComboBox::~AbstractComboBox()
735 {
736 if (_pango_static_text)
737- _pango_static_text->Dispose ();
738+ _pango_static_text->Dispose();
739 _pango_static_text = 0;
740 }
741
742- void AbstractComboBox::Draw (GraphicsEngine &GfxContext, bool force_draw)
743+ void AbstractComboBox::Draw(GraphicsEngine &graphics_engine, bool force_draw)
744 {
745 Geometry base = GetGeometry();
746
747- GfxContext.PushClippingRectangle (base);
748- GetPainter().PaintBackground (GfxContext, base);
749- GetPainter().PaintShape (GfxContext, base, m_sCOMBO_COLOR, eSHAPE_CORNER_ROUND4);
750+ graphics_engine.PushClippingRectangle(base);
751+ GetPainter().PaintBackground(graphics_engine, base);
752+ GetPainter().PaintShape(graphics_engine, base, m_sCOMBO_COLOR, eSHAPE_CORNER_ROUND4);
753
754 {
755- //GetPainter().PaintTextLineStatic (GfxContext, GetFont (), _combo_box_area->GetGeometry(), _combo_box_area->GetBaseString().GetTCharPtr(), GetTextColor(), eAlignTextLeft);
756- _pango_static_text->SetGeometry (_combo_box_area->GetGeometry ());
757- _pango_static_text->ProcessDraw (GfxContext, true);
758+ //GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), _combo_box_area->GetGeometry(), _combo_box_area->GetBaseString().GetTCharPtr(), GetTextColor(), eAlignTextLeft);
759+ _pango_static_text->SetGeometry(_combo_box_area->GetGeometry());
760+ _pango_static_text->ProcessDraw(graphics_engine, true);
761 }
762
763 Geometry button_geo = _combo_box_opening_area->GetGeometry();
764- button_geo.OffsetSize (-5, -2);
765- button_geo.OffsetPosition (+4, +1);
766+ button_geo.OffsetSize(-5, -2);
767+ button_geo.OffsetPosition(+4, +1);
768
769- if (_combo_box_area->IsMouseInside() || _combo_box_opening_area->IsMouseInside() || GetFocused ())
770- GetPainter().PaintShape (GfxContext, button_geo, m_sCOMBO_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4);
771+ if (_combo_box_area->IsMouseInside() || _combo_box_opening_area->IsMouseInside())
772+ GetPainter().PaintShape(graphics_engine, button_geo, m_sCOMBO_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4);
773 else
774- GetPainter().PaintShape (GfxContext, button_geo, m_sCOMBO_BUTTON_COLOR, eSHAPE_CORNER_ROUND4);
775+ GetPainter().PaintShape(graphics_engine, button_geo, m_sCOMBO_BUTTON_COLOR, eSHAPE_CORNER_ROUND4);
776
777- GeometryPositioning gp (eHACenter, eVACenter);
778- Geometry GeoPo = ComputeGeometryPositioning (button_geo, GetTheme().GetImageGeometry (eCOMBOBOX_OPEN_BUTTON), gp);
779- GetPainter().PaintShape (GfxContext, GeoPo, Color (0xFFFFFFFF), eCOMBOBOX_OPEN_BUTTON);
780+ GeometryPositioning gp(eHACenter, eVACenter);
781+ Geometry GeoPo = ComputeGeometryPositioning(button_geo, GetTheme().GetImageGeometry(eCOMBOBOX_OPEN_BUTTON), gp);
782+ GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eCOMBOBOX_OPEN_BUTTON);
783
784 Geometry popup_geometry;
785- popup_geometry.SetX (_combo_box_area->GetBaseX() );
786- popup_geometry.SetY (_combo_box_area->GetBaseY() + _combo_box_area->GetBaseHeight() );
787- popup_geometry.SetWidth (_combo_box_area->GetBaseWidth() );
788- popup_geometry.SetHeight (_combo_box_area->GetBaseHeight() );
789-
790- GfxContext.PopClippingRectangle ();
791- }
792-
793- void AbstractComboBox::DrawContent (GraphicsEngine &GfxContext, bool force_draw)
794- {
795-
796- }
797-
798- void AbstractComboBox::PostDraw (GraphicsEngine &GfxContext, bool force_draw)
799- {
800-
801- }
802-
803- void AbstractComboBox::RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags)
804+ popup_geometry.SetX(_combo_box_area->GetBaseX());
805+ popup_geometry.SetY(_combo_box_area->GetBaseY() + _combo_box_area->GetBaseHeight());
806+ popup_geometry.SetWidth(_combo_box_area->GetBaseWidth());
807+ popup_geometry.SetHeight(_combo_box_area->GetBaseHeight());
808+
809+ graphics_engine.PopClippingRectangle();
810+ }
811+
812+ void AbstractComboBox::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
813+ {
814+
815+ }
816+
817+ void AbstractComboBox::PostDraw(GraphicsEngine &graphics_engine, bool force_draw)
818+ {
819+
820+ }
821+
822+ void AbstractComboBox::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags)
823 {
824 QueueDraw();
825 }
826
827- void AbstractComboBox::RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags)
828+ void AbstractComboBox::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags)
829 {
830 QueueDraw();
831 }
832
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 class AbstractComboBox: public View
838 {
839 public:
840- AbstractComboBox (NUX_FILE_LINE_PROTO);
841+ AbstractComboBox(NUX_FILE_LINE_PROTO);
842 virtual ~AbstractComboBox();
843
844- virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) = 0;
845- virtual void Draw (GraphicsEngine &GfxContext, bool force_draw);
846- virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw);
847- virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw);
848-
849- void RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags);
850- void RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags);
851-
852- StaticText * GetStaticText ()
853+ virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
854+ virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
855+ virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw);
856+
857+ void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
858+ void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
859+
860+ StaticText * GetStaticText()
861 {
862 return _pango_static_text;
863 }
864
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
870 namespace nux
871 {
872- AbstractPaintLayer::AbstractPaintLayer ()
873- {
874-
875- }
876-
877- AbstractPaintLayer::~AbstractPaintLayer ()
878- {
879-
880- }
881-
882- void AbstractPaintLayer::SetGeometry (const Geometry &geo)
883- {
884- _geometry = geo;
885- }
886-
887- Geometry const& AbstractPaintLayer::GetGeometry () const
888- {
889- return _geometry;
890- }
891-
892- void AbstractPaintLayer::SetModelViewMatrix (const Matrix4 &mat)
893- {
894- _model_view_matrix = mat;
895- }
896-
897- Matrix4 AbstractPaintLayer::GetModelViewMatrix ()
898- {
899- return _model_view_matrix;
900+ AbstractPaintLayer::AbstractPaintLayer()
901+ {
902+
903+ }
904+
905+ AbstractPaintLayer::~AbstractPaintLayer()
906+ {
907+
908+ }
909+
910+ void AbstractPaintLayer::SetGeometry(const Geometry &geo)
911+ {
912+ geometry_ = geo;
913+ }
914+
915+ Geometry const& AbstractPaintLayer::GetGeometry() const
916+ {
917+ return geometry_;
918+ }
919+
920+ void AbstractPaintLayer::SetModelViewMatrix(const Matrix4 &mat)
921+ {
922+ model_view_matrix_ = mat;
923+ }
924+
925+ Matrix4 AbstractPaintLayer::GetModelViewMatrix()
926+ {
927+ return model_view_matrix_;
928 }
929 }
930
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 PaintLayer_ImageStyle,
936 };
937
938- AbstractPaintLayer ();
939- virtual ~AbstractPaintLayer ();
940- virtual AbstractPaintLayer *Clone () const = 0; //Virtual Constructor Idiom
941-
942- virtual void Renderlayer (GraphicsEngine &GfxContext) = 0;
943-
944- virtual void SetGeometry (const Geometry &geo);
945+ AbstractPaintLayer();
946+ virtual ~AbstractPaintLayer();
947+ virtual AbstractPaintLayer *Clone() const = 0; //Virtual Constructor Idiom
948+
949+ virtual void Renderlayer(GraphicsEngine &graphics_engine) = 0;
950+
951+ virtual void SetGeometry(const Geometry &geo);
952
953 //! Preserve the model view matrix at the moment layer is pushed on the paint layer stack. See Painter class.
954- void SetModelViewMatrix (const Matrix4 &mat);
955+ void SetModelViewMatrix(const Matrix4 &mat);
956
957- Matrix4 GetModelViewMatrix ();
958+ Matrix4 GetModelViewMatrix();
959
960 Geometry const& GetGeometry() const;
961
962 protected:
963- Geometry _geometry;
964- Matrix4 _model_view_matrix;
965+ Geometry geometry_;
966+ Matrix4 model_view_matrix_;
967 };
968
969 }
970
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-/*
976- * Copyright 2010 Inalogic® Inc.
977- *
978- * This program is free software: you can redistribute it and/or modify it
979- * under the terms of the GNU Lesser General Public License, as
980- * published by the Free Software Foundation; either version 2.1 or 3.0
981- * of the License.
982- *
983- * This program is distributed in the hope that it will be useful, but
984- * WITHOUT ANY WARRANTY; without even the implied warranties of
985- * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
986- * PURPOSE. See the applicable version of the GNU Lesser General Public
987- * License for more details.
988- *
989- * You should have received a copy of both the GNU Lesser General Public
990- * License along with this program. If not, see <http://www.gnu.org/licenses/>
991- *
992- * Authored by: Jay Taoko <jaytaoko@inalogic.com>
993- *
994- */
995-
996-#include "Nux.h"
997-
998-#include "AbstractRadioButton.h"
999-#include "HLayout.h"
1000-
1001-namespace nux
1002-{
1003- NUX_IMPLEMENT_OBJECT_TYPE(AbstractRadioButton);
1004-
1005- AbstractRadioButton::AbstractRadioButton (const TCHAR *Caption, NUX_FILE_LINE_DECL)
1006- : View (NUX_FILE_LINE_PARAM)
1007- {
1008- _state = false;
1009- }
1010-
1011- AbstractRadioButton::~AbstractRadioButton()
1012- {
1013-
1014- }
1015-}
1016
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-/*
1022- * Copyright 2010 Inalogic® Inc.
1023- *
1024- * This program is free software: you can redistribute it and/or modify it
1025- * under the terms of the GNU Lesser General Public License, as
1026- * published by the Free Software Foundation; either version 2.1 or 3.0
1027- * of the License.
1028- *
1029- * This program is distributed in the hope that it will be useful, but
1030- * WITHOUT ANY WARRANTY; without even the implied warranties of
1031- * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
1032- * PURPOSE. See the applicable version of the GNU Lesser General Public
1033- * License for more details.
1034- *
1035- * You should have received a copy of both the GNU Lesser General Public
1036- * License along with this program. If not, see <http://www.gnu.org/licenses/>
1037- *
1038- * Authored by: Jay Taoko <jaytaoko@inalogic.com>
1039- *
1040- */
1041-
1042-
1043-#ifndef ABSTRACTRADIOBUTTON_H
1044-#define ABSTRACTRADIOBUTTON_H
1045-
1046-namespace nux
1047-{
1048- //! The base class of Button, CheckBox, RadioButton and PushButton.
1049- class AbstractRadioButton : public View
1050- {
1051- NUX_DECLARE_OBJECT_TYPE (AbstractRadioButton, View);
1052- public:
1053- AbstractRadioButton (const TCHAR *Caption = TEXT (""), NUX_FILE_LINE_PROTO);
1054- ~AbstractRadioButton();
1055-
1056- virtual void SetCaption (const TCHAR *Caption) = 0;
1057- virtual const NString &GetCaption() const = 0;
1058-
1059- virtual void SetState (bool b) = 0;
1060- virtual void SetState (bool State, bool EmitSignal) = 0;
1061- virtual bool GetState() const = 0;
1062-
1063- protected:
1064- bool _state;
1065- };
1066-}
1067-
1068-#endif // ABSTRACTRADIOBUTTON_H
1069
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-/*
1075- * Copyright 2010 Inalogic® Inc.
1076- *
1077- * This program is free software: you can redistribute it and/or modify it
1078- * under the terms of the GNU Lesser General Public License, as
1079- * published by the Free Software Foundation; either version 2.1 or 3.0
1080- * of the License.
1081- *
1082- * This program is distributed in the hope that it will be useful, but
1083- * WITHOUT ANY WARRANTY; without even the implied warranties of
1084- * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
1085- * PURPOSE. See the applicable version of the GNU Lesser General Public
1086- * License for more details.
1087- *
1088- * You should have received a copy of both the GNU Lesser General Public
1089- * License along with this program. If not, see <http://www.gnu.org/licenses/>
1090- *
1091- * Authored by: Jay Taoko <jaytaoko@inalogic.com>
1092- *
1093- */
1094-
1095-
1096-#include "Nux.h"
1097-
1098-#include "AbstractSeparator.h"
1099-
1100-namespace nux
1101-{
1102-
1103- AbstractSeparator::AbstractSeparator (NUX_FILE_LINE_DECL)
1104- : View (NUX_FILE_LINE_PARAM)
1105- , m_Color (0xFF888888)
1106- , m_Alpha0 (0.0f)
1107- , m_Alpha1 (0.592f)
1108- , m_BorderSize (10)
1109- {
1110-
1111- }
1112-
1113- AbstractSeparator::AbstractSeparator (const Color &color, float Alpha0, float Alpha1, int Border, NUX_FILE_LINE_DECL)
1114- : View (NUX_FILE_LINE_PARAM)
1115- , m_Color (color)
1116- , m_Alpha0 (Alpha0)
1117- , m_Alpha1 (Alpha1)
1118- , m_BorderSize (Border)
1119- {
1120-
1121- }
1122-
1123- AbstractSeparator::~AbstractSeparator()
1124- {
1125-
1126- }
1127-
1128- void AbstractSeparator::SetColor (const Color &color)
1129- {
1130- m_Color = color;
1131- }
1132-
1133- void AbstractSeparator::SetAlpha (float Alpha0, float Alpha1)
1134- {
1135- m_Alpha0 = Alpha0;
1136- m_Alpha1 = Alpha1;
1137- }
1138-
1139- void AbstractSeparator::SetBorderSize (int Border)
1140- {
1141- m_BorderSize = Border;
1142- }
1143-}
1144
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-/*
1150- * Copyright 2010 Inalogic® Inc.
1151- *
1152- * This program is free software: you can redistribute it and/or modify it
1153- * under the terms of the GNU Lesser General Public License, as
1154- * published by the Free Software Foundation; either version 2.1 or 3.0
1155- * of the License.
1156- *
1157- * This program is distributed in the hope that it will be useful, but
1158- * WITHOUT ANY WARRANTY; without even the implied warranties of
1159- * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
1160- * PURPOSE. See the applicable version of the GNU Lesser General Public
1161- * License for more details.
1162- *
1163- * You should have received a copy of both the GNU Lesser General Public
1164- * License along with this program. If not, see <http://www.gnu.org/licenses/>
1165- *
1166- * Authored by: Jay Taoko <jaytaoko@inalogic.com>
1167- *
1168- */
1169-
1170-
1171-#ifndef ABSTRACTSEPARATOR_H
1172-#define ABSTRACTSEPARATOR_H
1173-
1174-namespace nux
1175-{
1176-
1177- class AbstractSeparator: public View
1178- {
1179- public:
1180- AbstractSeparator (NUX_FILE_LINE_PROTO);
1181- AbstractSeparator (const Color &color, float Alpha0, float Alpha1, int Border, NUX_FILE_LINE_PROTO);
1182- ~AbstractSeparator();
1183- void SetColor (const Color &color);
1184- void SetAlpha (float Alpha0, float Alpha1);
1185- void SetBorderSize (int Border);
1186-
1187- protected:
1188- Color m_Color;
1189- float m_Alpha0;
1190- float m_Alpha1;
1191- int m_BorderSize;
1192- };
1193-
1194-}
1195-
1196-#endif // ABSTRACTSEPARATOR_H
1197
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 namespace nux
1203 {
1204
1205- NUX_IMPLEMENT_OBJECT_TYPE (AbstractThread);
1206+ NUX_IMPLEMENT_OBJECT_TYPE(AbstractThread);
1207
1208- AbstractThread::AbstractThread (AbstractThread *Parent)
1209- : m_Parent (Parent)
1210- , m_UserInitFunc (0)
1211- , m_UserExitFunc (0)
1212+ AbstractThread::AbstractThread(AbstractThread *Parent)
1213+ : m_Parent(Parent)
1214+ , m_UserInitFunc(0)
1215+ , m_UserExitFunc(0)
1216 {
1217
1218 }
1219
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 namespace nux
1225 {
1226
1227- typedef void (*ThreadUserInitFunc) (NThread *, void *InitData);
1228- typedef void (*ThreadUserExitFunc) (NThread *, void *ExitData);
1229- typedef void (*ThreadMainFunc) (NThread *, void *MainData);
1230+ typedef void(*ThreadUserInitFunc) (NThread *, void *InitData);
1231+ typedef void(*ThreadUserExitFunc) (NThread *, void *ExitData);
1232+ typedef void(*ThreadMainFunc) (NThread *, void *MainData);
1233
1234 class AbstractThread: public NThread, public sigc::trackable
1235 {
1236- NUX_DECLARE_OBJECT_TYPE (AbstractThread, NThread);
1237+ NUX_DECLARE_OBJECT_TYPE(AbstractThread, NThread);
1238
1239 public:
1240- AbstractThread (AbstractThread *Parent);
1241+ AbstractThread(AbstractThread *Parent);
1242 virtual ~AbstractThread();
1243
1244 protected:
1245- virtual unsigned int Run (void *) = 0;
1246+ virtual unsigned int Run(void *) = 0;
1247
1248- virtual ThreadState StartChildThread (NThread *thread, bool Modal) = 0;
1249- virtual void AddChildThread (NThread *) = 0;
1250- virtual void RemoveChildThread (NThread *) = 0;
1251- virtual void ChildHasFinished (NThread *app) = 0;
1252+ virtual ThreadState StartChildThread(NThread *thread, bool Modal) = 0;
1253+ virtual void AddChildThread(NThread *) = 0;
1254+ virtual void RemoveChildThread(NThread *) = 0;
1255+ virtual void ChildHasFinished(NThread *app) = 0;
1256 virtual void TerminateAllChildThread() = 0;
1257
1258 std::list<NThread *> m_ChildThread;
1259@@ -61,7 +61,7 @@
1260 std::list<NThread *> m_ThreadList;
1261
1262 private:
1263- AbstractThread (const AbstractThread &);
1264+ AbstractThread(const AbstractThread &);
1265 // Does not make sense for a singleton. This is a self assignment.
1266 AbstractThread &operator= (const AbstractThread &);
1267 // Declare operator adress-of as private
1268
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 namespace nux
1274 {
1275
1276- NUX_IMPLEMENT_OBJECT_TYPE (ActionItem);
1277+ NUX_IMPLEMENT_OBJECT_TYPE(ActionItem);
1278
1279- ActionItem::ActionItem (const TCHAR *label, int UserValue, NUX_FILE_LINE_DECL)
1280- : Object (true, NUX_FILE_LINE_PARAM)
1281- , m_UserValue (UserValue)
1282- , m_Label (TEXT ("") )
1283- , m_IsActivated (true)
1284- , m_Menu (0)
1285- , m_Enable (true)
1286+ ActionItem::ActionItem(const char *label, int UserValue, NUX_FILE_LINE_DECL)
1287+ : Object(true, NUX_FILE_LINE_PARAM)
1288+ , m_UserValue(UserValue)
1289+ , m_Label("")
1290+ , m_IsActivated(true)
1291+ , m_Menu(0)
1292+ , m_Enable(true)
1293 {
1294 m_Icon = 0;
1295- SetLabel (label);
1296+ SetLabel(label);
1297 }
1298
1299 ActionItem::~ActionItem()
1300 {
1301- if(m_Icon)
1302+ if (m_Icon)
1303 m_Icon->UnReference();
1304 }
1305
1306- void ActionItem::DrawAsMenuItem (GraphicsEngine &GfxContext, InputArea &area, bool is_highlighted, bool draw_icone)
1307+ void ActionItem::DrawAsMenuItem(GraphicsEngine &graphics_engine, InputArea &area, bool is_highlighted, bool draw_icone)
1308 {
1309 Geometry geo = area.GetGeometry();
1310- Geometry icon_geo (0, 0, 20, 20);
1311+ Geometry icon_geo(0, 0, 20, 20);
1312 Geometry text_geo = geo;
1313
1314- text_geo.OffsetPosition (24, 2);
1315- text_geo.OffsetSize (2 * 24, 2 * 2);
1316-
1317- icon_geo.SetX (geo.x + 2);
1318- icon_geo.SetY (geo.y + 2);
1319-
1320- const TCHAR *label = GetLabel();
1321+ text_geo.OffsetPosition(24, 2);
1322+ text_geo.OffsetSize(2 * 24, 2 * 2);
1323+
1324+ icon_geo.SetX(geo.x + 2);
1325+ icon_geo.SetY(geo.y + 2);
1326+
1327+ const char *label = GetLabel();
1328
1329 if (is_highlighted)
1330 {
1331- GetPainter().Paint2DQuadColor (GfxContext, geo, Color (COLOR_FOREGROUND_SECONDARY) );
1332+ GetPainter().Paint2DQuadColor(graphics_engine, geo, Color(COLOR_FOREGROUND_SECONDARY));
1333 }
1334
1335- if(m_Icon)
1336- GetPainter().Draw2DTextureAligned (GfxContext, m_Icon, icon_geo, TextureAlignmentStyle (eTACenter, eTACenter) );
1337+ if (m_Icon)
1338+ GetPainter().Draw2DTextureAligned(graphics_engine, m_Icon, icon_geo, TextureAlignmentStyle(eTACenter, eTACenter));
1339
1340- GetPainter().PaintTextLineStatic (GfxContext, GetSysFont(), text_geo, std::string (label), Color (0xFF000000), eAlignTextLeft);
1341+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysFont(), text_geo, std::string(label), Color(0xFF000000), eAlignTextLeft);
1342 }
1343
1344- void ActionItem::DrawAsToolButton (GraphicsEngine &GfxContext, InputArea &area)
1345+ void ActionItem::DrawAsToolButton(GraphicsEngine &graphics_engine, InputArea &area)
1346 {
1347 Geometry base = area.GetGeometry();
1348
1349- if (area.IsMouseOwner() )
1350+ if (area.IsMouseOwner())
1351 {
1352- if (area.IsMouseInside() )
1353+ if (area.IsMouseInside())
1354 {
1355- GetPainter().PaintShape (GfxContext, base, Color (COLOR_BACKGROUND_SECONDARY), eSHAPE_CORNER_ROUND2);
1356- GetPainter().PaintShape (GfxContext, base, Color (COLOR_BLACK), eSTROKE_CORNER_ROUND2);
1357+ GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY), eSHAPE_CORNER_ROUND2);
1358+ GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BLACK), eSTROKE_CORNER_ROUND2);
1359 }
1360 else
1361 {
1362- GetPainter().PaintShape (GfxContext, base, Color (COLOR_FOREGROUND_PRIMARY), eSHAPE_CORNER_ROUND2);
1363- GetPainter().PaintShape (GfxContext, base, Color (COLOR_BLACK), eSTROKE_CORNER_ROUND2);
1364+ GetPainter().PaintShape(graphics_engine, base, Color(COLOR_FOREGROUND_PRIMARY), eSHAPE_CORNER_ROUND2);
1365+ GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BLACK), eSTROKE_CORNER_ROUND2);
1366 }
1367 }
1368 else
1369 {
1370- if (area.IsMouseInside() && (!area.MouseFocusOnOtherArea() ) )
1371+ if (area.IsMouseInside() && (!area.MouseFocusOnOtherArea()))
1372 {
1373- GetPainter().PaintShape (GfxContext, base, Color (COLOR_FOREGROUND_PRIMARY), eSHAPE_CORNER_ROUND2);
1374- GetPainter().PaintShape (GfxContext, base, Color (COLOR_BLACK), eSTROKE_CORNER_ROUND2);
1375+ GetPainter().PaintShape(graphics_engine, base, Color(COLOR_FOREGROUND_PRIMARY), eSHAPE_CORNER_ROUND2);
1376+ GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BLACK), eSTROKE_CORNER_ROUND2);
1377 }
1378 else
1379 {
1380- GetPainter().PaintShape (GfxContext, base, Color (COLOR_BACKGROUND_SECONDARY), eSHAPE_CORNER_ROUND2);
1381- GetPainter().PaintShape (GfxContext, base, Color (COLOR_BLACK), eSTROKE_CORNER_ROUND2);
1382+ GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY), eSHAPE_CORNER_ROUND2);
1383+ GetPainter().PaintShape(graphics_engine, base, Color(COLOR_BLACK), eSTROKE_CORNER_ROUND2);
1384 }
1385 }
1386
1387- GetPainter().Draw2DTextureAligned (GfxContext, m_Icon, base, TextureAlignmentStyle (eTACenter, eTACenter) );
1388+ GetPainter().Draw2DTextureAligned(graphics_engine, m_Icon, base, TextureAlignmentStyle(eTACenter, eTACenter));
1389 }
1390
1391- void ActionItem::Activate (bool b)
1392+ void ActionItem::Activate(bool b)
1393 {
1394 m_IsActivated = b;
1395 }
1396@@ -116,7 +116,7 @@
1397 sigAction.emit();
1398 }
1399
1400- void ActionItem::Enable (bool b)
1401+ void ActionItem::Enable(bool b)
1402 {
1403 m_Enable = b;
1404 }
1405@@ -126,19 +126,19 @@
1406 return m_Enable;
1407 }
1408
1409- void ActionItem::SetLabel (const TCHAR *label)
1410+ void ActionItem::SetLabel(const char *label)
1411 {
1412 m_Label = label;
1413 }
1414
1415- const TCHAR *ActionItem::GetLabel() const
1416+ const char *ActionItem::GetLabel() const
1417 {
1418 return m_Label.GetTCharPtr();
1419 }
1420
1421- void ActionItem::SetIcon (const BaseTexture* icon)
1422+ void ActionItem::SetIcon(const BaseTexture* icon)
1423 {
1424- if(m_Icon)
1425+ if (m_Icon)
1426 m_Icon->UnReference();
1427 m_Icon = icon->Clone();
1428 }
1429
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 namespace nux
1435 {
1436
1437- AnimatedTextureArea::AnimatedTextureArea (NUX_FILE_LINE_DECL)
1438- : View (NUX_FILE_LINE_PARAM)
1439- , m_UserTexture (0)
1440+ AnimatedTextureArea::AnimatedTextureArea(NUX_FILE_LINE_DECL)
1441+ : View(NUX_FILE_LINE_PARAM)
1442+ , m_UserTexture(0)
1443 {
1444- SetMinMaxSize (32, 32);
1445+ SetMinMaxSize(32, 32);
1446
1447- mouse_down.connect (sigc::mem_fun (this, &AnimatedTextureArea::RecvMouseDown) );
1448- mouse_drag.connect (sigc::mem_fun (this, &AnimatedTextureArea::RecvMouseDrag) );
1449+ mouse_down.connect(sigc::mem_fun(this, &AnimatedTextureArea::RecvMouseDown));
1450+ mouse_drag.connect(sigc::mem_fun(this, &AnimatedTextureArea::RecvMouseDrag));
1451
1452 m_TimerFunctor = new TimerFunctor();
1453- m_TimerFunctor->OnTimerExpired.connect (sigc::mem_fun (this, &AnimatedTextureArea::TimerNextFrame) );
1454+ m_TimerFunctor->time_expires.connect(sigc::mem_fun(this, &AnimatedTextureArea::TimerNextFrame));
1455 }
1456
1457 AnimatedTextureArea::~AnimatedTextureArea()
1458 {
1459- GetTimer().RemoveTimerHandler (m_TimerHandler);
1460+ GetTimer().RemoveTimerHandler(m_TimerHandler);
1461 m_TimerHandler = 0;
1462 delete m_TimerFunctor;
1463 m_TimerFunctor = 0;
1464 }
1465
1466- long AnimatedTextureArea::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
1467- {
1468- return PostProcessEvent2 (ievent, TraverseInfo, ProcessEventInfo);
1469- }
1470-
1471- void AnimatedTextureArea::Draw (GraphicsEngine &GfxContext, bool force_draw)
1472+ void AnimatedTextureArea::Draw(GraphicsEngine &graphics_engine, bool force_draw)
1473 {
1474 if (m_UserTexture)
1475 {
1476- GetPainter().PaintBackground (GfxContext, GetGeometry() );
1477- GfxContext.GetRenderStates().SetBlend (true, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1478+ GetPainter().PaintBackground(graphics_engine, GetGeometry());
1479+ graphics_engine.GetRenderStates().SetBlend(true, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1480 nux::Geometry base = GetGeometry();
1481 nux::TexCoordXForm texxform;
1482- GfxContext.QRP_1Tex (base.x, base.y, base.width, base.height, m_UserTexture->GetDeviceTexture(), texxform, nux::color::White);
1483+ graphics_engine.QRP_1Tex(base.x, base.y, base.width, base.height, m_UserTexture->GetDeviceTexture(), texxform, nux::color::White);
1484
1485- GfxContext.GetRenderStates().SetBlend (false);
1486+ graphics_engine.GetRenderStates().SetBlend(false);
1487 }
1488 }
1489- void AnimatedTextureArea::DrawContent (GraphicsEngine &GfxContext, bool force_draw)
1490- {
1491-
1492- }
1493-
1494- void AnimatedTextureArea::PostDraw (GraphicsEngine &GfxContext, bool force_draw)
1495- {
1496-
1497- }
1498-
1499- void AnimatedTextureArea::SetTexture (TextureFrameAnimation *Texture)
1500+ void AnimatedTextureArea::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
1501+ {
1502+
1503+ }
1504+
1505+ void AnimatedTextureArea::PostDraw(GraphicsEngine &graphics_engine, bool force_draw)
1506+ {
1507+
1508+ }
1509+
1510+ void AnimatedTextureArea::SetTexture(TextureFrameAnimation *Texture)
1511 {
1512 m_UserTexture = Texture;
1513
1514 if (m_UserTexture)
1515 {
1516- ObjectPtr< CachedTextureFrameAnimation > Texture = GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource (m_UserTexture);
1517+ ObjectPtr< CachedTextureFrameAnimation > Texture = GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource(m_UserTexture);
1518 ObjectPtr<IOpenGLAnimatedTexture> AnimatedTexture = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>();
1519 ObjectPtr<IOpenGLBaseTexture> Texture2D = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>();
1520
1521- AnimatedTexture->SetFiltering (GL_LINEAR, GL_LINEAR);
1522- AnimatedTexture->SetWrap (GL_CLAMP, GL_CLAMP, GL_CLAMP);
1523+ AnimatedTexture->SetFiltering(GL_LINEAR, GL_LINEAR);
1524+ AnimatedTexture->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
1525 }
1526
1527 QueueDraw();
1528 }
1529
1530- void AnimatedTextureArea::RecvMouseDown (int x, int y, long button_flags, long key_flags)
1531+ void AnimatedTextureArea::RecvMouseDown(int x, int y, long button_flags, long key_flags)
1532 {
1533- sigMouseDown.emit (x, y);
1534+ sigMouseDown.emit(x, y);
1535 }
1536
1537- void AnimatedTextureArea::RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
1538+ void AnimatedTextureArea::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
1539 {
1540- sigMouseDrag.emit (x, y);
1541+ sigMouseDrag.emit(x, y);
1542 }
1543
1544 void AnimatedTextureArea::StartAnimation()
1545 {
1546- if (m_TimerHandler.IsValid() )
1547+ if (m_TimerHandler.IsValid())
1548 {
1549- GetTimer().RemoveTimerHandler (m_TimerHandler);
1550+ GetTimer().RemoveTimerHandler(m_TimerHandler);
1551 m_TimerHandler = 0;
1552 }
1553
1554- m_TimerHandler = GetTimer().AddTimerHandler (41, m_TimerFunctor, 0);
1555+ m_TimerHandler = GetTimer().AddTimerHandler(41, m_TimerFunctor, 0);
1556 QueueDraw();
1557 }
1558
1559 void AnimatedTextureArea::StopAnimation()
1560 {
1561- if (m_TimerHandler.IsValid() )
1562+ if (m_TimerHandler.IsValid())
1563 {
1564- GetTimer().RemoveTimerHandler (m_TimerHandler);
1565+ GetTimer().RemoveTimerHandler(m_TimerHandler);
1566 m_TimerHandler = 0;
1567 }
1568 }
1569
1570- void AnimatedTextureArea::TimerNextFrame (void *v)
1571+ void AnimatedTextureArea::TimerNextFrame(void *v)
1572 {
1573 if (m_UserTexture)
1574 {
1575- ObjectPtr< CachedTextureFrameAnimation > Texture = GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource (m_UserTexture);
1576+ ObjectPtr< CachedTextureFrameAnimation > Texture = GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource(m_UserTexture);
1577 ObjectPtr<IOpenGLAnimatedTexture> AnimatedTexture = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>();
1578 ObjectPtr<IOpenGLBaseTexture> Texture2D = Texture->m_Texture; //Texture->m_Texture.CastRef<IOpenGLAnimatedTexture>();
1579
1580 AnimatedTexture->PresentNextFrame();
1581- m_TimerHandler = GetTimer().AddTimerHandler (41, m_TimerFunctor, 0);
1582+ m_TimerHandler = GetTimer().AddTimerHandler(41, m_TimerFunctor, 0);
1583 }
1584
1585 QueueDraw();
1586
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 class AnimatedTextureArea : public View
1592 {
1593 public:
1594- AnimatedTextureArea (NUX_FILE_LINE_PROTO);
1595+ AnimatedTextureArea(NUX_FILE_LINE_PROTO);
1596 ~AnimatedTextureArea();
1597- virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
1598- virtual void Draw (GraphicsEngine &GfxContext, bool force_draw);
1599- virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw);
1600- virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw);
1601+ virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
1602+ virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
1603+ virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw);
1604
1605- void SetTexture (TextureFrameAnimation *Texture);
1606- void RecvMouseDown (int x, int y, long button_flags, long key_flags);
1607- void RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1608+ void SetTexture(TextureFrameAnimation *Texture);
1609+ void RecvMouseDown(int x, int y, long button_flags, long key_flags);
1610+ void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1611
1612 sigc::signal<void, int, int> sigMouseDown;
1613 sigc::signal<void, int, int> sigMouseDrag;
1614@@ -51,7 +50,7 @@
1615
1616
1617 private:
1618- void TimerNextFrame (void *v);
1619+ void TimerNextFrame(void *v);
1620 TimerFunctor *m_TimerFunctor;
1621 TimerHandle m_TimerHandler;
1622
1623
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 namespace nux
1629 {
1630
1631- NUX_IMPLEMENT_OBJECT_TYPE (Area);
1632+ NUX_IMPLEMENT_OBJECT_TYPE(Area);
1633
1634 Area::Area (NUX_FILE_LINE_DECL)
1635- : InitiallyUnownedObject (NUX_FILE_LINE_PARAM)
1636- , _is_focused (0)
1637- , _geometry (0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT)
1638- , _min_size (AREA_MIN_WIDTH, AREA_MIN_HEIGHT)
1639- , _max_size (AREA_MAX_WIDTH, AREA_MAX_HEIGHT)
1640+ : InitiallyUnownedObject(NUX_FILE_LINE_PARAM)
1641+ , geometry_(0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT)
1642+ , min_size_(AREA_MIN_WIDTH, AREA_MIN_HEIGHT)
1643+ , max_size_(AREA_MAX_WIDTH, AREA_MAX_HEIGHT)
1644+ , _direction (GetDefaultDirection())
1645 {
1646- _parent_area = NULL;
1647+ visible_ = true;
1648+ view_enabled_ = true;
1649+ parent_area_ = NULL;
1650+
1651 next_object_to_key_focus_area_ = NULL;
1652 has_key_focus_ = false;
1653
1654- _stretch_factor = 1;
1655- _layout_properties = NULL;
1656- _visible = true;
1657- _sensitive = true;
1658+ scale_factor_ = 1;
1659+ sensitive_ = true;
1660
1661- _on_geometry_changeg_reconfigure_parent_layout = true;
1662+ on_geometry_change_reconfigure_parent_layout_ = true;
1663 _accept_mouse_wheel_event = false;
1664 _accept_keyboard_event = false;
1665
1666- _2d_xform.Identity ();
1667- _3d_xform.Identity ();
1668+ _2d_xform.Identity();
1669+ _3d_xform.Identity();
1670 _3d_area = false;
1671 }
1672
1673
1674 Area::~Area()
1675 {
1676- if (_layout_properties)
1677- delete _layout_properties;
1678 }
1679
1680 const NString &Area::GetBaseString() const
1681@@ -71,362 +70,360 @@
1682 return _base_string;
1683 }
1684
1685- void Area::SetBaseString (const TCHAR *Caption)
1686+ void Area::SetBaseString(const char *Caption)
1687 {
1688 _base_string = Caption;
1689 }
1690
1691 void Area::CheckMinSize()
1692 {
1693- int w = _min_size.width;
1694+ int w = min_size_.width;
1695 w = Max<int>(AREA_MIN_WIDTH, w);
1696- int h = _min_size.height;
1697+ int h = min_size_.height;
1698 h = Max<int>(AREA_MIN_HEIGHT, h);
1699
1700- _min_size = Size(w, h);
1701-
1702- if (_min_size.width > _max_size.width)
1703- {
1704- _max_size.width = _min_size.width;
1705- }
1706-
1707- if (_min_size.height > _max_size.height)
1708- {
1709- _max_size.height = _min_size.height;
1710- }
1711-
1712- if (_geometry.width < _min_size.width)
1713- {
1714- _geometry.width = _min_size.width;
1715- }
1716-
1717- if (_geometry.height < _min_size.height )
1718- {
1719- _geometry.height = _min_size.height;
1720+ min_size_ = Size(w, h);
1721+
1722+ if (min_size_.width > max_size_.width)
1723+ {
1724+ max_size_.width = min_size_.width;
1725+ }
1726+
1727+ if (min_size_.height > max_size_.height)
1728+ {
1729+ max_size_.height = min_size_.height;
1730+ }
1731+
1732+ if (geometry_.width < min_size_.width)
1733+ {
1734+ geometry_.width = min_size_.width;
1735+ }
1736+
1737+ if (geometry_.height < min_size_.height )
1738+ {
1739+ geometry_.height = min_size_.height;
1740 }
1741 }
1742
1743 void Area::CheckMaxSize()
1744 {
1745- int w = _max_size.width;
1746- w = Min<int>(AREA_MAX_WIDTH, w);
1747- int h = _max_size.height;
1748- h = Min<int>(AREA_MAX_HEIGHT, h);
1749-
1750- _max_size = Size(w, h);
1751-
1752- if (_min_size.width > _max_size.width)
1753- {
1754- _min_size.width = _max_size.width;
1755- }
1756-
1757- if (_min_size.height > _max_size.height)
1758- {
1759- _min_size.height = _max_size.height;
1760- }
1761-
1762- if (_geometry.width > _max_size.width)
1763- {
1764- _geometry.width = _max_size.width;
1765- }
1766-
1767- if (_geometry.height > _max_size.height)
1768- {
1769- _geometry.height = _max_size.height;
1770+ int w = max_size_.width;
1771+ w = w <= AREA_MAX_WIDTH ? w : AREA_MAX_WIDTH;
1772+ int h = max_size_.height;
1773+ h = h <= AREA_MAX_HEIGHT ? h: AREA_MAX_HEIGHT;
1774+
1775+ max_size_ = Size(w, h);
1776+
1777+ if (min_size_.width > max_size_.width)
1778+ {
1779+ min_size_.width = max_size_.width;
1780+ }
1781+
1782+ if (min_size_.height > max_size_.height)
1783+ {
1784+ min_size_.height = max_size_.height;
1785+ }
1786+
1787+ if (geometry_.width > max_size_.width)
1788+ {
1789+ geometry_.width = max_size_.width;
1790+ }
1791+
1792+ if (geometry_.height > max_size_.height)
1793+ {
1794+ geometry_.height = max_size_.height;
1795 }
1796 }
1797
1798- void Area::SetMinimumSize (int w, int h)
1799+ void Area::SetMinimumSize(int w, int h)
1800 {
1801- nuxAssert (w >= 0);
1802- nuxAssert (h >= 0);
1803- _min_size = Size(w, h);
1804+ nuxAssert(w >= 0);
1805+ nuxAssert(h >= 0);
1806+ min_size_ = Size(w, h);
1807
1808 CheckMinSize();
1809
1810 ReconfigureParentLayout();
1811 }
1812
1813- void Area::SetMaximumSize (int w, int h)
1814+ void Area::SetMaximumSize(int w, int h)
1815 {
1816- nuxAssert (w >= 0);
1817- nuxAssert (h >= 0);
1818- _max_size = Size(w, h);
1819+ nuxAssert(w >= 0);
1820+ nuxAssert(h >= 0);
1821+ max_size_ = Size(w, h);
1822
1823 CheckMaxSize();
1824
1825 ReconfigureParentLayout();
1826 }
1827
1828- void Area::SetMinMaxSize (int w, int h)
1829+ void Area::SetMinMaxSize(int w, int h)
1830 {
1831- nuxAssert (w >= 0);
1832- nuxAssert (h >= 0);
1833- SetMinimumSize (w, h);
1834- SetMaximumSize (w, h);
1835+ nuxAssert(w >= 0);
1836+ nuxAssert(h >= 0);
1837+ SetMinimumSize(w, h);
1838+ SetMaximumSize(w, h);
1839
1840 //ReconfigureParentLayout();
1841 }
1842
1843 void Area::ApplyMinWidth()
1844 {
1845- _geometry.width = _min_size.width;
1846+ geometry_.width = min_size_.width;
1847
1848 ReconfigureParentLayout();
1849 }
1850
1851 void Area::ApplyMinHeight()
1852 {
1853- _geometry.height = _min_size.height;
1854+ geometry_.height = min_size_.height;
1855
1856 ReconfigureParentLayout();
1857 }
1858
1859 void Area::ApplyMaxWidth()
1860 {
1861- _geometry.width = _max_size.width;
1862+ geometry_.width = max_size_.width;
1863
1864 ReconfigureParentLayout();
1865 }
1866
1867 void Area::ApplyMaxHeight()
1868 {
1869- _geometry.height = _max_size.height;
1870+ geometry_.height = max_size_.height;
1871
1872 ReconfigureParentLayout();
1873 }
1874
1875 Size Area::GetMinimumSize() const
1876 {
1877- return _min_size;
1878+ return min_size_;
1879 }
1880
1881 Size Area::GetMaximumSize() const
1882 {
1883- return _max_size;
1884+ return max_size_;
1885 }
1886
1887- void Area::SetMinimumWidth (int w)
1888+ void Area::SetMinimumWidth(int w)
1889 {
1890- nuxAssert (w >= 0);
1891- _min_size.width = w;
1892+ nuxAssert(w >= 0);
1893+ min_size_.width = w;
1894 CheckMinSize();
1895 ReconfigureParentLayout();
1896 }
1897
1898- void Area::SetMaximumWidth (int w)
1899+ void Area::SetMaximumWidth(int w)
1900 {
1901- nuxAssert (w >= 0);
1902- _max_size.width = w;
1903+ nuxAssert(w >= 0);
1904+ max_size_.width = w;
1905 CheckMaxSize();
1906 ReconfigureParentLayout();
1907 }
1908
1909- void Area::SetMinimumHeight (int h)
1910+ void Area::SetMinimumHeight(int h)
1911 {
1912- nuxAssert (h >= 0);
1913- _min_size.height = h;
1914+ nuxAssert(h >= 0);
1915+ min_size_.height = h;
1916 CheckMinSize();
1917 ReconfigureParentLayout();
1918 }
1919
1920- void Area::SetMaximumHeight (int h)
1921+ void Area::SetMaximumHeight(int h)
1922 {
1923- nuxAssert (h >= 0);
1924- _max_size.height = h;
1925+ nuxAssert(h >= 0);
1926+ max_size_.height = h;
1927 CheckMaxSize();
1928 ReconfigureParentLayout();
1929 }
1930
1931 int Area::GetMinimumWidth() const
1932 {
1933- return _min_size.width;
1934+ return min_size_.width;
1935 }
1936
1937 int Area::GetMaximumWidth() const
1938 {
1939- return _max_size.width;
1940+ return max_size_.width;
1941 }
1942
1943 int Area::GetMinimumHeight() const
1944 {
1945- return _min_size.height;
1946+ return min_size_.height;
1947 }
1948
1949 int Area::GetMaximumHeight() const
1950 {
1951- return _max_size.height;
1952+ return max_size_.height;
1953 }
1954
1955- unsigned int Area::GetStretchFactor()
1956+ unsigned int Area::GetScaleFactor()
1957 {
1958- return _stretch_factor;
1959+ return scale_factor_;
1960 }
1961
1962- void Area::SetStretchFactor (unsigned int sf)
1963+ void Area::SetScaleFactor(unsigned int sf)
1964 {
1965 // re implemented by Layout
1966- _stretch_factor = sf;
1967+ scale_factor_ = sf;
1968 }
1969
1970- void Area::SetParentObject (Area *bo)
1971+ bool Area::SetParentObject(Area *parent)
1972 {
1973- if (bo == 0)
1974- {
1975- nuxAssertMsg (0, TEXT ("[Area::SetParentObject] Invalid parent obejct.") );
1976- return;
1977- }
1978-
1979- if (_parent_area)
1980- {
1981- nuxAssertMsg (0, TEXT ("[Area::SetParentObject] Object already has a parent. You must UnParent the object before you can parenting again.") );
1982- return;
1983- }
1984-
1985- _parent_area = bo;
1986+ if (parent == 0)
1987+ {
1988+ nuxAssertMsg(0, "[Area::SetParentObject] Invalid parent obejct.");
1989+ return false;
1990+ }
1991+
1992+ if (parent_area_ && (parent_area_ != parent))
1993+ {
1994+ nuxAssertMsg(0, "[Area::SetParentObject] Object already has a parent. You must UnParent the object before you can parenting again.");
1995+ return false;
1996+ }
1997+
1998+ if (parent_area_)
1999+ {
2000+ // Already parented to the same area. Return.
2001+ return true;
2002+ }
2003+
2004+ parent_area_ = parent;
2005 Reference();
2006+
2007+ return true;
2008 }
2009
2010 void Area::UnParentObject()
2011 {
2012- if (_parent_area)
2013+ if (parent_area_)
2014 {
2015- _parent_area = 0;
2016+ parent_area_ = 0;
2017 UnReference();
2018 }
2019 }
2020
2021 Area *Area::GetParentObject() const
2022 {
2023- return _parent_area;
2024+ return parent_area_;
2025 }
2026
2027 int Area::GetBaseX () const
2028 {
2029- return _geometry.x;
2030+ return geometry_.x;
2031 }
2032
2033 int Area::GetBaseY () const
2034 {
2035- return _geometry.y;
2036+ return geometry_.y;
2037 }
2038
2039 int Area::GetBaseWidth () const
2040 {
2041- return _geometry.width;
2042+ return geometry_.width;
2043 }
2044
2045 int Area::GetBaseHeight () const
2046 {
2047- return _geometry.height;
2048+ return geometry_.height;
2049 }
2050
2051 void Area::SetGeometry(int x, int y, int w, int h)
2052 {
2053- h = nux::Clamp<int> (h, _min_size.height, _max_size.height);
2054- w = nux::Clamp<int> (w, _min_size.width, _max_size.width);
2055+ h = nux::Clamp<int> (h, min_size_.height, max_size_.height);
2056+ w = nux::Clamp<int> (w, min_size_.width, max_size_.width);
2057
2058 nux::Geometry geometry(x, y, w, h);
2059- if (_geometry == geometry)
2060+ if (geometry_ == geometry)
2061 return;
2062
2063 GeometryChangePending();
2064- _geometry = geometry;
2065+ geometry_ = geometry;
2066 ReconfigureParentLayout();
2067 GeometryChanged();
2068
2069- OnGeometryChanged.emit(this, _geometry);
2070+ OnGeometryChanged.emit(this, geometry_);
2071 }
2072
2073- void Area::SetGeometry (const Geometry &geo)
2074+ void Area::SetGeometry(const Geometry &geo)
2075 {
2076- SetGeometry (geo.x, geo.y, geo.width, geo.height);
2077+ SetGeometry(geo.x, geo.y, geo.width, geo.height);
2078 }
2079
2080 Geometry const& Area::GetGeometry() const
2081 {
2082- return _geometry;
2083+ return geometry_;
2084 }
2085
2086 void Area::SetBaseX(int x)
2087 {
2088- SetGeometry(x, _geometry.y, _geometry.width, _geometry.height);
2089+ SetGeometry(x, geometry_.y, geometry_.width, geometry_.height);
2090 }
2091
2092 void Area::SetBaseY (int y)
2093 {
2094- SetGeometry (_geometry.x, y, _geometry.width, _geometry.height);
2095+ SetGeometry(geometry_.x, y, geometry_.width, geometry_.height);
2096 }
2097
2098 void Area::SetBaseXY (int x, int y)
2099 {
2100- SetGeometry (x, y, _geometry.width, _geometry.height);
2101- }
2102-
2103- void Area::SetBaseSize (int w, int h)
2104- {
2105- SetGeometry (_geometry.x, _geometry.y, w, h);
2106- }
2107-
2108- void Area::SetBaseWidth (int w)
2109- {
2110- SetGeometry (_geometry.x, _geometry.y, w, _geometry.height);
2111- }
2112-
2113- void Area::SetBaseHeight (int h)
2114- {
2115- SetGeometry (_geometry.x, _geometry.y, _geometry.width, h);
2116- }
2117-
2118- void Area::IncreaseSize (int x, int y)
2119- {
2120- _geometry.OffsetPosition (x, y);
2121- OnResize.emit (_geometry.x, _geometry.y, _geometry.width, _geometry.height );
2122- }
2123-
2124- long Area::ComputeChildLayout()
2125- {
2126- return 0;
2127- }
2128-
2129- void Area::PositionChildLayout (float offsetX, float offsetY)
2130- {
2131-
2132- }
2133-
2134- long Area::ComputeLayout2()
2135+ SetGeometry(x, y, geometry_.width, geometry_.height);
2136+ }
2137+
2138+ void Area::SetBaseSize(int w, int h)
2139+ {
2140+ SetGeometry(geometry_.x, geometry_.y, w, h);
2141+ }
2142+
2143+ void Area::SetBaseWidth(int w)
2144+ {
2145+ SetGeometry(geometry_.x, geometry_.y, w, geometry_.height);
2146+ }
2147+
2148+ void Area::SetBaseHeight(int h)
2149+ {
2150+ SetGeometry(geometry_.x, geometry_.y, geometry_.width, h);
2151+ }
2152+
2153+ void Area::IncreaseSize(int x, int y)
2154+ {
2155+ geometry_.OffsetPosition(x, y);
2156+ OnResize.emit(geometry_.x, geometry_.y, geometry_.width, geometry_.height );
2157+ }
2158+
2159+ long Area::ComputeContentSize()
2160 {
2161 return (eCompliantWidth | eCompliantHeight);
2162 }
2163
2164- void Area::ComputePosition2 (float offsetX, float offsetY)
2165+ void Area::ComputeContentPosition(float offsetX, float offsetY)
2166 {
2167
2168 }
2169
2170 void Area::SetReconfigureParentLayoutOnGeometryChange(bool reconfigure_parent_layout)
2171 {
2172- _on_geometry_changeg_reconfigure_parent_layout = reconfigure_parent_layout;
2173+ on_geometry_change_reconfigure_parent_layout_ = reconfigure_parent_layout;
2174 }
2175
2176 bool Area::ReconfigureParentLayoutOnGeometryChange()
2177 {
2178- return _on_geometry_changeg_reconfigure_parent_layout;
2179+ return on_geometry_change_reconfigure_parent_layout_;
2180 }
2181
2182 void Area::ReconfigureParentLayout(Area *child)
2183 {
2184- if(_on_geometry_changeg_reconfigure_parent_layout == false)
2185+ if (on_geometry_change_reconfigure_parent_layout_ == false)
2186 return;
2187
2188- if (GetWindowThread ()->IsComputingLayout() )
2189+ if (GetWindowThread() && GetWindowThread()->IsComputingLayout())
2190 {
2191 // there is no need to do the following while we are already computing the layout.
2192 // If we do, we will end up in an infinite loop.
2193 return;
2194 }
2195
2196- if (this->Type().IsDerivedFromType (View::StaticObjectType) )
2197+ if (this->Type().IsDerivedFromType(View::StaticObjectType))
2198 {
2199 // The object that is being resized is a View object and it has a parent.
2200 if (this->OwnsTheReference() == false && this->GetParentObject())
2201@@ -437,29 +434,29 @@
2202
2203 View *ic = static_cast<View *>(this);
2204
2205- if (ic->CanBreakLayout() )
2206+ if (ic->CanBreakLayout())
2207 {
2208
2209- if ( (child != 0) &&
2210- (ic->Type().IsObjectType (VSplitter::StaticObjectType) || ic->Type().IsObjectType (HSplitter::StaticObjectType) ) )
2211+ if ((child != 0) &&
2212+ (ic->Type().IsObjectType(VSplitter::StaticObjectType) || ic->Type().IsObjectType(HSplitter::StaticObjectType)))
2213 {
2214 // If this element is a Splitter, then we submit its child to the refresh list. We don't want to submit the
2215- // splitter because this will cause a redraw of all parts of the splitter (costly and unnecessary).
2216- GetWindowThread ()->QueueObjectLayout (child);
2217+ // splitter because this will cause a redraw of all parts of the splitter(costly and unnecessary).
2218+ GetWindowThread()->QueueObjectLayout(child);
2219 }
2220 else
2221 {
2222- GetWindowThread ()->QueueObjectLayout (ic);
2223+ GetWindowThread()->QueueObjectLayout(ic);
2224 }
2225 }
2226- else if (ic->_parent_area)
2227- ic->_parent_area->ReconfigureParentLayout (this);
2228+ else if (ic->parent_area_)
2229+ ic->parent_area_->ReconfigureParentLayout(this);
2230 else
2231 {
2232- GetWindowThread ()->QueueObjectLayout (ic);
2233+ GetWindowThread()->QueueObjectLayout(ic);
2234 }
2235 }
2236- else if (this->Type().IsDerivedFromType (Layout::StaticObjectType) )
2237+ else if (this->Type().IsDerivedFromType(Layout::StaticObjectType))
2238 {
2239 // The object that is being resized is a View object and it has a parent.
2240 if (this->OwnsTheReference() == false && this->GetParentObject())
2241@@ -470,47 +467,47 @@
2242
2243 Layout *layout = static_cast<Layout *>(this);
2244
2245- if (layout->_parent_area)
2246+ if (layout->parent_area_)
2247 {
2248- if (layout->_parent_area->Type().IsDerivedFromType (View::StaticObjectType) )
2249+ if (layout->parent_area_->Type().IsDerivedFromType(View::StaticObjectType))
2250 {
2251- View *ic = (View *) (layout->_parent_area);
2252+ View *ic = (View *) (layout->parent_area_);
2253
2254- if (ic->CanBreakLayout() )
2255+ if (ic->CanBreakLayout())
2256 {
2257- if ( (child != 0) &&
2258- (ic->Type().IsObjectType (VSplitter::StaticObjectType) || ic->Type().IsObjectType (HSplitter::StaticObjectType) ) )
2259+ if ((child != 0) &&
2260+ (ic->Type().IsObjectType(VSplitter::StaticObjectType) || ic->Type().IsObjectType(HSplitter::StaticObjectType)))
2261 {
2262 // 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
2263- // splitter because this will cause a redraw of all parts of the splitter (costly and unnecessary).
2264- GetWindowThread ()->QueueObjectLayout (this);
2265+ // splitter because this will cause a redraw of all parts of the splitter(costly and unnecessary).
2266+ GetWindowThread()->QueueObjectLayout(this);
2267 }
2268 else
2269 {
2270- GetWindowThread ()->QueueObjectLayout (ic);
2271+ GetWindowThread()->QueueObjectLayout(ic);
2272 }
2273 }
2274 else
2275 {
2276 // The parent object of an object of type View is a Layout object type.
2277- layout->_parent_area->ReconfigureParentLayout (this);
2278+ layout->parent_area_->ReconfigureParentLayout(this);
2279 }
2280 }
2281 else
2282 {
2283- layout->_parent_area->ReconfigureParentLayout (this);
2284+ layout->parent_area_->ReconfigureParentLayout(this);
2285 }
2286 }
2287 else
2288 {
2289- // 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.
2290- GetWindowThread ()->QueueObjectLayout (layout);
2291+ // 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+ GetWindowThread()->QueueObjectLayout(layout);
2293 }
2294 }
2295 else
2296 {
2297 // The object that is being resized is a InputArea object.
2298- if (this->_parent_area)
2299+ if (this->parent_area_)
2300 {
2301 // The object that is being resized is a View object and it has a parent.
2302 if (this->OwnsTheReference() == false && this->GetParentObject())
2303@@ -520,125 +517,128 @@
2304 }
2305
2306 // The parent object of an object of type InputArea is a Layout object type.
2307- this->_parent_area->ReconfigureParentLayout (this);
2308+ this->parent_area_->ReconfigureParentLayout(this);
2309 }
2310 }
2311 }
2312
2313- void Area::RequestBottomUpLayoutComputation (Area *bo_initiator)
2314+ void Area::RequestBottomUpLayoutComputation(Area *bo_initiator)
2315 {
2316- if (_parent_area && _parent_area->IsLayout() )
2317+ if (parent_area_ && parent_area_->IsLayout())
2318 {
2319- _parent_area->RequestBottomUpLayoutComputation (bo_initiator);
2320+ parent_area_->RequestBottomUpLayoutComputation(bo_initiator);
2321 }
2322 }
2323
2324- void Area::SetLayoutProperties (LayoutProperties *properties)
2325- {
2326- if (_layout_properties)
2327- delete _layout_properties;
2328-
2329- _layout_properties = properties;
2330- }
2331-
2332- Area::LayoutProperties * Area::GetLayoutProperties ()
2333- {
2334- return _layout_properties;
2335- }
2336-
2337- void Area::SetVisible (bool visible)
2338- {
2339- if (_visible == visible)
2340- return;
2341-
2342- _visible = visible;
2343-
2344- OnVisibleChanged.emit (this, _visible);
2345- }
2346-
2347- bool Area::IsVisible ()
2348- {
2349- return _visible;
2350- }
2351-
2352- void Area::SetSensitive (bool sensitive)
2353- {
2354- if (_sensitive == sensitive)
2355- return;
2356-
2357- _sensitive = sensitive;
2358-
2359- OnSensitiveChanged.emit (this, _sensitive);
2360- }
2361-
2362- bool Area::IsSensitive ()
2363- {
2364- return _sensitive;
2365+ void Area::SetVisible(bool visible)
2366+ {
2367+ if (IsLayout())
2368+ return;
2369+
2370+ if (visible_ == visible)
2371+ return;
2372+
2373+ visible_ = visible;
2374+
2375+ OnVisibleChanged.emit(this, visible_);
2376+ }
2377+
2378+ bool Area::IsVisible()
2379+ {
2380+ return visible_;
2381+ }
2382+
2383+ void Area::SetSensitive(bool sensitive)
2384+ {
2385+ SetInputEventSensitivity(sensitive);
2386+ }
2387+
2388+ void Area::SetInputEventSensitivity(bool sensitive)
2389+ {
2390+ if (IsLayout())
2391+ return;
2392+
2393+ if (sensitive_ == sensitive)
2394+ return;
2395+
2396+ sensitive_ = sensitive;
2397+
2398+ OnSensitiveChanged.emit(this, sensitive_);
2399+ }
2400+
2401+ bool Area::IsSensitive() const
2402+ {
2403+ return GetInputEventSensitivity();
2404+ }
2405+
2406+ bool Area::GetInputEventSensitivity() const
2407+ {
2408+ return sensitive_;
2409 }
2410
2411 MinorDimensionPosition Area::GetPositioning()
2412 {
2413- return _positioning;
2414+ return minor_axis_position_;
2415 }
2416
2417- void Area::SetPositioning (MinorDimensionPosition p)
2418+ void Area::SetPositioning(MinorDimensionPosition p)
2419 {
2420- _positioning = p;
2421+ minor_axis_position_ = p;
2422 }
2423
2424 MinorDimensionSize Area::GetExtend()
2425 {
2426- return _extend;
2427+ return minor_axis_size_;
2428 }
2429
2430- void Area::SetExtend (MinorDimensionSize ext)
2431+ void Area::SetExtend(MinorDimensionSize ext)
2432 {
2433- _extend = ext;
2434+ minor_axis_size_ = ext;
2435 }
2436
2437 float Area::GetPercentage()
2438 {
2439- return _percentage;
2440+ return minor_axis_size_scale_;
2441 }
2442
2443- void Area::SetPercentage (float p)
2444+ void Area::SetPercentage(float p)
2445 {
2446- _percentage = p;
2447+ minor_axis_size_scale_ = p;
2448 }
2449
2450 bool Area::IsLayoutDone()
2451 {
2452- return _layout_done;
2453- }
2454-
2455- void Area::SetLayoutDone (bool b)
2456- {
2457- _layout_done = b;
2458- }
2459-
2460- bool Area::IsArea () const
2461- {
2462- return this->Type ().IsDerivedFromType (Area::StaticObjectType);;
2463- }
2464-
2465- bool Area::IsInputArea () const
2466- {
2467- return this->Type ().IsDerivedFromType (InputArea::StaticObjectType);;
2468- }
2469-
2470- bool Area::IsView () const
2471- {
2472- return this->Type ().IsDerivedFromType (View::StaticObjectType);;
2473- }
2474-
2475- bool Area::IsLayout () const
2476- {
2477- return this->Type ().IsDerivedFromType (Layout::StaticObjectType);
2478- }
2479-
2480- bool Area::IsViewWindow () const
2481- {
2482- return this->Type ().IsDerivedFromType (BaseWindow::StaticObjectType);
2483+ return layout_done_;
2484+ }
2485+
2486+ void Area::SetLayoutDone(bool b)
2487+ {
2488+ layout_done_ = b;
2489+ }
2490+
2491+ bool Area::IsArea() const
2492+ {
2493+ return this->Type().IsDerivedFromType(Area::StaticObjectType);;
2494+ }
2495+
2496+ bool Area::IsInputArea() const
2497+ {
2498+ return this->Type().IsDerivedFromType(InputArea::StaticObjectType);;
2499+ }
2500+
2501+ bool Area::IsView() const
2502+ {
2503+ return this->Type().IsDerivedFromType(View::StaticObjectType);;
2504+ }
2505+
2506+ bool Area::IsLayout() const
2507+ {
2508+ return this->Type().IsDerivedFromType(Layout::StaticObjectType);
2509+ }
2510+
2511+ bool Area::IsViewWindow() const
2512+ {
2513+ return this->Type().IsDerivedFromType(BaseWindow::StaticObjectType);
2514 }
2515
2516 bool Area::IsSpaceLayout() const
2517@@ -646,113 +646,113 @@
2518 return this->Type().IsDerivedFromType(SpaceLayout::StaticObjectType);;
2519 }
2520
2521- void Area::Set2DMatrix (const Matrix4 &mat)
2522+ void Area::Set2DMatrix(const Matrix4 &mat)
2523 {
2524 _2d_xform = mat;
2525 }
2526
2527- void Area::Set2DTranslation (float tx, float ty, float tz)
2528+ void Area::Set2DTranslation(float tx, float ty, float tz)
2529 {
2530- _2d_xform.Translate (tx, ty, tz);
2531+ _2d_xform.Translate(tx, ty, tz);
2532 }
2533
2534- Matrix4 Area::Get2DMatrix () const
2535+ Matrix4 Area::Get2DMatrix() const
2536 {
2537 return _2d_xform;
2538 }
2539
2540- Matrix4 Area::Get3DMatrix () const
2541+ Matrix4 Area::Get3DMatrix() const
2542 {
2543 return _3d_xform;
2544 }
2545
2546- bool Area::Is3DArea () const
2547+ bool Area::Is3DArea() const
2548 {
2549 return _3d_area;
2550 }
2551
2552- static void MatrixXFormGeometry (const Matrix4 &matrix, Geometry &geo)
2553+ static void MatrixXFormGeometry(const Matrix4 &matrix, Geometry &geo)
2554 {
2555- Vector4 in (geo.x, geo.y, 0, 1);
2556+ Vector4 in(geo.x, geo.y, 0, 1);
2557 // This is mean only for translation matrices. It will not work with matrices containing rotations or scalings.
2558 Vector4 out = matrix * in;
2559 geo.x = out.x;
2560 geo.y = out.y;
2561 }
2562
2563- void Area::InnerGetAbsoluteGeometry (Geometry &geometry)
2564+ void Area::InnerGetAbsoluteGeometry(Geometry &geometry)
2565 {
2566- if (this->Type ().IsDerivedFromType (BaseWindow::StaticObjectType) || (this == GetWindowThread ()->GetMainLayout ()))
2567+ if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout()))
2568 {
2569- geometry.OffsetPosition (_geometry.x, _geometry.y);
2570+ geometry.OffsetPosition(geometry_.x, geometry_.y);
2571 return;
2572 }
2573
2574- MatrixXFormGeometry (_2d_xform, geometry);
2575+ MatrixXFormGeometry(_2d_xform, geometry);
2576
2577- Area *parent = GetParentObject ();
2578+ Area *parent = GetParentObject();
2579 if (parent)
2580- parent->InnerGetAbsoluteGeometry (geometry);
2581+ parent->InnerGetAbsoluteGeometry(geometry);
2582 }
2583
2584- Geometry Area::GetAbsoluteGeometry () const
2585+ Geometry Area::GetAbsoluteGeometry() const
2586 {
2587 if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) ||
2588 Type().IsDerivedFromType(MenuPage::StaticObjectType) ||
2589 (this == GetWindowThread()->GetMainLayout()))
2590 {
2591 // Do not apply the _2D_xform matrix to a BaseWindow or the main layout
2592- return _geometry;
2593+ return geometry_;
2594 }
2595 else
2596 {
2597- nux::Geometry geo = _geometry;
2598- MatrixXFormGeometry (_2d_xform, geo);
2599+ nux::Geometry geo = geometry_;
2600+ MatrixXFormGeometry(_2d_xform, geo);
2601
2602- Area *parent = GetParentObject ();
2603+ Area *parent = GetParentObject();
2604 if (parent)
2605- parent->InnerGetAbsoluteGeometry (geo);
2606+ parent->InnerGetAbsoluteGeometry(geo);
2607
2608 return geo;
2609 }
2610 }
2611
2612- int Area::GetAbsoluteX () const
2613- {
2614- return GetAbsoluteGeometry ().x;
2615- }
2616-
2617- int Area::GetAbsoluteY () const
2618- {
2619- return GetAbsoluteGeometry ().y;
2620- }
2621-
2622- int Area::GetAbsoluteWidth () const
2623- {
2624- return GetAbsoluteGeometry ().width;
2625- }
2626-
2627- int Area::GetAbsoluteHeight () const
2628- {
2629- return GetAbsoluteGeometry ().height;
2630- }
2631-
2632- void Area::InnerGetRootGeometry (Geometry &geometry)
2633- {
2634- if (this->Type ().IsDerivedFromType (BaseWindow::StaticObjectType) || (this == GetWindowThread ()->GetMainLayout ()))
2635+ int Area::GetAbsoluteX() const
2636+ {
2637+ return GetAbsoluteGeometry().x;
2638+ }
2639+
2640+ int Area::GetAbsoluteY() const
2641+ {
2642+ return GetAbsoluteGeometry().y;
2643+ }
2644+
2645+ int Area::GetAbsoluteWidth() const
2646+ {
2647+ return GetAbsoluteGeometry().width;
2648+ }
2649+
2650+ int Area::GetAbsoluteHeight() const
2651+ {
2652+ return GetAbsoluteGeometry().height;
2653+ }
2654+
2655+ void Area::InnerGetRootGeometry(Geometry &geometry)
2656+ {
2657+ if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout()))
2658 return;
2659
2660- MatrixXFormGeometry (_2d_xform, geometry);
2661+ MatrixXFormGeometry(_2d_xform, geometry);
2662
2663- Area *parent = GetParentObject ();
2664+ Area *parent = GetParentObject();
2665 if (parent)
2666- parent->InnerGetRootGeometry (geometry);
2667+ parent->InnerGetRootGeometry(geometry);
2668 }
2669
2670- Geometry Area::GetRootGeometry () const
2671+ Geometry Area::GetRootGeometry() const
2672 {
2673- nux::Geometry geo = _geometry;
2674- MatrixXFormGeometry (_2d_xform, geo);
2675+ nux::Geometry geo = geometry_;
2676+ MatrixXFormGeometry(_2d_xform, geo);
2677
2678 if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout()))
2679 {
2680@@ -760,62 +760,67 @@
2681 }
2682 else
2683 {
2684- Area *parent = GetParentObject ();
2685+ Area *parent = GetParentObject();
2686 if (parent)
2687- parent->InnerGetRootGeometry (geo);
2688+ parent->InnerGetRootGeometry(geo);
2689
2690 return geo;
2691 }
2692 }
2693
2694- int Area::GetRootX () const
2695- {
2696- return GetRootGeometry ().x;
2697- }
2698-
2699- int Area::GetRootY () const
2700- {
2701- return GetRootGeometry ().y;
2702- }
2703-
2704- int Area::GetRootWidth () const
2705- {
2706- return GetRootGeometry ().width;
2707- }
2708-
2709- int Area::GetRootHeight () const
2710- {
2711- return GetRootGeometry ().height;
2712- }
2713-
2714- Area* Area::GetToplevel ()
2715- {
2716- if (Type ().IsDerivedFromType (BaseWindow::StaticObjectType) || (this == GetWindowThread ()->GetMainLayout ()))
2717+ int Area::GetRootX() const
2718+ {
2719+ return GetRootGeometry().x;
2720+ }
2721+
2722+ int Area::GetRootY() const
2723+ {
2724+ return GetRootGeometry().y;
2725+ }
2726+
2727+ int Area::GetRootWidth() const
2728+ {
2729+ return GetRootGeometry().width;
2730+ }
2731+
2732+ int Area::GetRootHeight() const
2733+ {
2734+ return GetRootGeometry().height;
2735+ }
2736+
2737+ Area* Area::GetToplevel()
2738+ {
2739+ return GetRootParent();
2740+ }
2741+
2742+ Area* Area::GetRootParent()
2743+ {
2744+ if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout()))
2745 {
2746 return this;
2747 }
2748
2749- Area* parent = GetParentObject ();
2750+ Area* parent = GetParentObject();
2751 if (!parent) //we didn't find a way to salvation!
2752 {
2753 return 0;
2754 }
2755- return parent->GetToplevel ();
2756+ return parent->GetRootParent();
2757 }
2758
2759- Area* Area::GetTopLevelViewWindow ()
2760+ Area* Area::GetTopLevelViewWindow()
2761 {
2762- Area* area = GetToplevel ();
2763+ Area* area = GetRootParent();
2764
2765- if (area && area->IsViewWindow ())
2766+ if (area && area->IsViewWindow())
2767 return area;
2768
2769 return NULL;
2770 }
2771
2772- bool Area::HasTopLevelParent ()
2773+ bool Area::HasTopLevelParent()
2774 {
2775- if (GetToplevel ())
2776+ if (GetRootParent())
2777 {
2778 return true;
2779 }
2780@@ -827,42 +832,15 @@
2781 if (this == parent)
2782 return true;
2783
2784- if (!parent || !_parent_area)
2785+ if (!parent || !parent_area_)
2786 return false;
2787
2788- return _parent_area->IsChildOf(parent);
2789- }
2790-
2791- /* handles our focusable code */
2792- bool Area::DoGetFocused ()
2793- {
2794- return _is_focused;
2795- }
2796-
2797- /* Pretty much everything is going to have to override this */
2798- void Area::DoSetFocused (bool focused)
2799- {
2800- if (_is_focused == focused)
2801- return;
2802-
2803- _is_focused = focused;
2804- FocusChanged.emit (this);
2805- }
2806-
2807- bool Area::DoCanFocus ()
2808- {
2809- return true;
2810- }
2811-
2812- /* override me! */
2813- void Area::DoActivateFocus ()
2814- {
2815- FocusActivated.emit (this);
2816- }
2817-
2818- void Area::QueueRelayout ()
2819- {
2820- nux::GetWindowThread ()->QueueObjectLayout (this);
2821+ return parent_area_->IsChildOf(parent);
2822+ }
2823+
2824+ void Area::QueueRelayout()
2825+ {
2826+ nux::GetWindowThread()->QueueObjectLayout(this);
2827 }
2828
2829 void Area::SetAcceptKeyboardEvent(bool accept_keyboard_event)
2830@@ -885,45 +863,70 @@
2831 return _accept_mouse_wheel_event;
2832 }
2833
2834- bool Area::TestMousePointerInclusion(const Point& mouse_position, NuxEventType event_type)
2835- {
2836- bool mouse_pointer_inside_area = false;
2837-
2838- if (Type().IsDerivedFromType(MenuPage::StaticObjectType))
2839- {
2840- // A MenuPage geometry is already in absolute coordinates.
2841- mouse_pointer_inside_area = _geometry.IsInside(mouse_position);
2842- }
2843- else
2844- {
2845- mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position);
2846- }
2847-
2848- if ((event_type == NUX_MOUSE_WHEEL) && mouse_pointer_inside_area)
2849- {
2850- if (_accept_mouse_wheel_event == false)
2851- return NULL;
2852- }
2853-
2854- return mouse_pointer_inside_area;
2855- }
2856-
2857- bool Area::TestMousePointerInclusionFilterMouseWheel(const Point& mouse_position, NuxEventType event_type)
2858- {
2859- bool mouse_pointer_inside_area = false;
2860-
2861- if (Type().IsDerivedFromType(MenuPage::StaticObjectType))
2862- {
2863- // A MenuPage geometry is already in absolute coordinates.
2864- mouse_pointer_inside_area = _geometry.IsInside(mouse_position);
2865- }
2866- else
2867- {
2868- mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position);
2869- }
2870-
2871- return mouse_pointer_inside_area;
2872- }
2873+ bool Area::TestMousePointerInclusion(const Point& mouse_position, NuxEventType event_type)
2874+ {
2875+ if ((IsLayout() == false) && ((visible_ == false) ||
2876+ (sensitive_ == false) ||
2877+ (view_enabled_ == false)))
2878+ {
2879+ // If this area is not a view and:
2880+ // - it is insensitive to input event
2881+ // - it is not enabled
2882+ // - it is not visible
2883+ // then return false.
2884+ return false;
2885+ }
2886+
2887+ bool mouse_pointer_inside_area = false;
2888+
2889+ if (Type().IsDerivedFromType(MenuPage::StaticObjectType))
2890+ {
2891+ // A MenuPage geometry is already in absolute coordinates.
2892+ mouse_pointer_inside_area = geometry_.IsInside(mouse_position);
2893+ }
2894+ else
2895+ {
2896+ mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position);
2897+ }
2898+
2899+ if ((event_type == NUX_MOUSE_WHEEL) && mouse_pointer_inside_area)
2900+ {
2901+ if (_accept_mouse_wheel_event == false)
2902+ return NULL;
2903+ }
2904+
2905+ return mouse_pointer_inside_area;
2906+ }
2907+
2908+ bool Area::TestMousePointerInclusionFilterMouseWheel(const Point& mouse_position, NuxEventType event_type)
2909+ {
2910+ if ((IsLayout() == false) && ((visible_ == false) ||
2911+ (sensitive_ == false) ||
2912+ (view_enabled_ == false)))
2913+ {
2914+ // If this area is not a view and:
2915+ // - it is insensitive to input event
2916+ // - it is not enabled
2917+ // - it is not visible
2918+ // then return false.
2919+
2920+ return false;
2921+ }
2922+
2923+ bool mouse_pointer_inside_area = false;
2924+
2925+ if (Type().IsDerivedFromType(MenuPage::StaticObjectType))
2926+ {
2927+ // A MenuPage geometry is already in absolute coordinates.
2928+ mouse_pointer_inside_area = geometry_.IsInside(mouse_position);
2929+ }
2930+ else
2931+ {
2932+ mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position);
2933+ }
2934+
2935+ return mouse_pointer_inside_area;
2936+ }
2937
2938 Area* Area::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type)
2939 {
2940@@ -970,7 +973,7 @@
2941 {
2942 next_object_to_key_focus_area_->ResetDownwardPathToKeyFocusArea();
2943 }
2944- if(next_object_to_key_focus_area_)
2945+ if (next_object_to_key_focus_area_)
2946 next_object_to_key_focus_area_->UnReference();
2947
2948 next_object_to_key_focus_area_ = NULL;
2949@@ -979,11 +982,11 @@
2950 void Area::ResetUpwardPathToKeyFocusArea()
2951 {
2952 has_key_focus_ = false;
2953- if (_parent_area)
2954+ if (parent_area_)
2955 {
2956- _parent_area->ResetUpwardPathToKeyFocusArea();
2957+ parent_area_->ResetUpwardPathToKeyFocusArea();
2958 }
2959- if(next_object_to_key_focus_area_)
2960+ if (next_object_to_key_focus_area_)
2961 next_object_to_key_focus_area_->UnReference();
2962
2963 next_object_to_key_focus_area_ = NULL;
2964@@ -998,6 +1001,9 @@
2965
2966 bool Area::AcceptKeyNavFocus()
2967 {
2968+ if (GetInputEventSensitivity() == false)
2969+ return false;
2970+
2971 return true;
2972 }
2973
2974@@ -1010,5 +1016,26 @@
2975 {
2976 return has_key_focus_;
2977 }
2978+
2979+ Direction Area::GetDirection() const
2980+ {
2981+ return _direction;
2982+ }
2983+
2984+ void Area::SetDirection(Direction direction)
2985+ {
2986+ _direction = direction;
2987+ }
2988+
2989+ bool Area::IsMousePointerInside() const
2990+ {
2991+ Geometry geo = GetAbsoluteGeometry();
2992+ Point position = GetWindowCompositor().GetMousePosition();
2993+
2994+ if (geo.IsInside(position))
2995+ return true;
2996+
2997+ return false;
2998+ }
2999 }
3000
3001
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 #include <sigc++/sigc++.h>
3007 #include "NuxCore/InitiallyUnownedObject.h"
3008 #include "NuxGraphics/Events.h"
3009-#include "Focusable.h"
3010 #include "Utils.h"
3011 #include "WidgetMetrics.h"
3012
3013@@ -65,11 +64,14 @@
3014 //! Policy for and element position in the minor dimension of a layout.
3015 typedef enum
3016 {
3017- MINOR_POSITION_TOP, //!< Place the element on the top side of the layout (Hlayout)
3018- MINOR_POSITION_BOTTOM, //!< Place the element on the bottom side of the layout (Hlayout)
3019- MINOR_POSITION_LEFT, //!< Place the element on the left side of the layout (Vlayout)
3020- MINOR_POSITION_RIGHT, //!< Place the element on the right side of the layout (Hlayout)
3021- MINOR_POSITION_CENTER, //!< Place the element at the center of the layout (Hlayout and VLayout)
3022+ MINOR_POSITION_START, //!< Place the element at the start of the layout(Hlayout and VLayout)
3023+ MINOR_POSITION_CENTER, //!< Place the element at the center of the layout(Hlayout and VLayout)
3024+ MINOR_POSITION_END, //!< Place the element at the end of the layout(Hlayout and VLayout)
3025+ MINOR_POSITION_TOP = MINOR_POSITION_START, //!< Deprecated.
3026+ MINOR_POSITION_LEFT = MINOR_POSITION_START, //!< Deprecated.
3027+ MINOR_POSITION_BOTTOM = MINOR_POSITION_END, //!< Deprecated.
3028+ MINOR_POSITION_RIGHT = MINOR_POSITION_END, //!< Deprecated.
3029+
3030 eAbove = MINOR_POSITION_TOP, //!< Deprecated.
3031 eBelow = MINOR_POSITION_BOTTOM, //!< Deprecated.
3032 eLeft = MINOR_POSITION_LEFT, //!< Deprecated.
3033@@ -84,19 +86,23 @@
3034 */
3035 typedef enum
3036 {
3037- MAJOR_POSITION_TOP, //!< Stack elements at the top (for VLayout only).
3038- MAJOR_POSITION_BOTTOM, //!< Stack elements at the bottom (for VLayout only).
3039- MAJOR_POSITION_LEFT, //!< Stack elements at the left (for HLayout only).
3040- MAJOR_POSITION_RIGHT, //!< Stack elements at the right (for HLayout only).
3041- MAJOR_POSITION_CENTER, //!< Stack elements in the center of the layout (for HLayout and VLayout).
3042- MAJOR_POSITION_EXPAND, //!< Spread elements evenly inside the layout (for HLayout and VLayout).
3043+ MAJOR_POSITION_CENTER, //!< Stack elements in the center of the layout(for HLayout and VLayout).
3044+ MAJOR_POSITION_START, //!< Stack elements at the begining of the layout(for HLayout and VLayout).
3045+ MAJOR_POSITION_END, //!< Stack elements at the end of the layout(for HLayout and VLayout).
3046+ MAJOR_POSITION_SPREAD, //!< Spread elements evenly inside the layout(for HLayout and VLayout).
3047+
3048+ MAJOR_POSITION_TOP = MAJOR_POSITION_START, //!< Deprecated.
3049+ MAJOR_POSITION_BOTTOM = MAJOR_POSITION_END, //!< Deprecated.
3050+ MAJOR_POSITION_LEFT = MAJOR_POSITION_START, //!< Deprecated.
3051+ MAJOR_POSITION_RIGHT = MAJOR_POSITION_END, //!< Deprecated.
3052+
3053
3054 eStackTop = MAJOR_POSITION_TOP, //!< Deprecated.
3055 eStackBottom = MAJOR_POSITION_BOTTOM, //!< Deprecated.
3056 eStackLeft = MAJOR_POSITION_LEFT, //!< Deprecated.
3057 eStackRight = MAJOR_POSITION_RIGHT, //!< Deprecated.
3058 eStackCenter = MAJOR_POSITION_CENTER, //!< Deprecated.
3059- eStackExpand = MAJOR_POSITION_EXPAND, //!< Deprecated.
3060+ eStackExpand = MAJOR_POSITION_SPREAD, //!< Deprecated.
3061 } LayoutContentDistribution;
3062
3063 //! For internal use only.
3064@@ -134,25 +140,21 @@
3065 KEY_NAV_ENTER,
3066 };
3067
3068+ typedef enum
3069+ {
3070+ LeftToRight,
3071+ RightToLeft
3072+ } Direction;
3073+
3074 class Layout;
3075 class View;
3076 class Area;
3077
3078- class Area: public InitiallyUnownedObject, public Focusable
3079+ class Area: public InitiallyUnownedObject
3080 {
3081- NUX_DECLARE_OBJECT_TYPE (Area, InitiallyUnownedObject);
3082- public:
3083- class LayoutProperties
3084- {
3085- public:
3086- virtual ~LayoutProperties ()
3087- {
3088-
3089- }
3090- };
3091-
3092- public:
3093- Area (NUX_FILE_LINE_DECL);
3094+ NUX_DECLARE_OBJECT_TYPE(Area, InitiallyUnownedObject);
3095+ public:
3096+ Area(NUX_FILE_LINE_DECL);
3097 virtual ~Area();
3098
3099 int GetBaseX() const;
3100@@ -171,29 +173,29 @@
3101 The size is adjusted to respect the min and max size policy
3102 \sa SetWidth(), SetHeight(), SetMinimumSize(), SetMaximumSize().
3103 */
3104- void SetBaseSize (int w, int h);
3105-
3106- void SetMinimumSize(int w, int h);
3107- void SetMaximumSize(int w, int h);
3108- void SetMinMaxSize(int w, int h);
3109-
3110- void SetMinimumWidth(int w);
3111- void SetMaximumWidth(int w);
3112- void SetMinimumHeight(int h);
3113- void SetMaximumHeight(int h);
3114-
3115- int GetMinimumWidth() const;
3116- int GetMaximumWidth() const;
3117- int GetMinimumHeight() const;
3118- int GetMaximumHeight() const;
3119-
3120- void ApplyMinWidth();
3121- void ApplyMinHeight();
3122- void ApplyMaxWidth();
3123- void ApplyMaxHeight();
3124-
3125- Size GetMinimumSize() const;
3126- Size GetMaximumSize() const;
3127+ virtual void SetBaseSize(int w, int h);
3128+
3129+ virtual void SetMinimumSize(int w, int h);
3130+ virtual void SetMaximumSize(int w, int h);
3131+ virtual void SetMinMaxSize(int w, int h);
3132+
3133+ virtual void SetMinimumWidth(int w);
3134+ virtual void SetMaximumWidth(int w);
3135+ virtual void SetMinimumHeight(int h);
3136+ virtual void SetMaximumHeight(int h);
3137+
3138+ virtual int GetMinimumWidth() const;
3139+ virtual int GetMaximumWidth() const;
3140+ virtual int GetMinimumHeight() const;
3141+ virtual int GetMaximumHeight() const;
3142+
3143+ virtual void ApplyMinWidth();
3144+ virtual void ApplyMinHeight();
3145+ virtual void ApplyMaxWidth();
3146+ virtual void ApplyMaxHeight();
3147+
3148+ virtual Size GetMinimumSize() const;
3149+ virtual Size GetMaximumSize() const;
3150
3151 //! Get the geometry of the object.
3152 /*!
3153@@ -212,7 +214,7 @@
3154
3155 \sa SetBaseWidth(), SetBaseHeight(), SetBaseX(), SetBaseY().
3156 */
3157- void SetGeometry (int x, int y, int w, int h);
3158+ void SetGeometry(int x, int y, int w, int h);
3159
3160 //! Set the geometry of the object.
3161 /*!
3162@@ -222,32 +224,36 @@
3163 @param geo Geometry object.
3164 \sa SetWidth(), SetHeight(), SetX(), SetY().
3165 */
3166- void SetGeometry (const Geometry &geo);
3167-
3168- void IncreaseSize (int x, int y);
3169-
3170- void SetBaseString (const TCHAR *Caption);
3171+ void SetGeometry(const Geometry &geo);
3172+
3173+ void IncreaseSize(int x, int y);
3174+
3175+ void SetBaseString(const char *Caption);
3176 const NString &GetBaseString() const;
3177
3178- //! Return the Top level parent of this area.
3179+ //! Deprecated. Use GetToplevel.
3180+ Area* GetToplevel();
3181+
3182+ //! Return the root parent of the rendering tree for this area.
3183 /*!
3184- The top Level parent is either a BaseWindow or the main layout.
3185+ The root parent of the rendering tree is either a BaseWindow or the main layout.
3186+ If the object isn't hooked to the rendering tree the function returns NULL.
3187
3188- @return The top level parent or Null.
3189+ @return The root parent of the rendering tree or NULL.
3190 */
3191- Area * GetToplevel ();
3192+ Area* GetRootParent();
3193
3194 //! Return the Top level BaseWindow of this area.
3195 /*!
3196 @return The top level BaseWindow or NULL.
3197 */
3198- Area * GetTopLevelViewWindow ();
3199+ Area* GetTopLevelViewWindow();
3200
3201 //! Return true is this area has a top level parent.
3202 /*!
3203 @return True if this area has a top level parent.
3204 */
3205- bool HasTopLevelParent ();
3206+ bool HasTopLevelParent();
3207
3208 //! Return true is area is a child of the given parent in the widget tree.
3209 /*!
3210@@ -260,7 +266,7 @@
3211 Test if a point is inside the area.
3212
3213 @param p A 2D point.
3214- @param event_type The type of mouse event (a parameter of FindAreaUnderMouse).
3215+ @param event_type The type of mouse event(a parameter of FindAreaUnderMouse).
3216
3217 @return True if p is located inside the Area.
3218 */
3219@@ -270,7 +276,7 @@
3220 Test if a point is inside the area and if the area accepts mouse wheel events.
3221
3222 @param p A 2D point.
3223- @param event_type The type of mouse event (a parameter of FindAreaUnderMouse).
3224+ @param event_type The type of mouse event(a parameter of FindAreaUnderMouse).
3225 @param filter_mouse_wheel_event If the event type is NUX_MOUSE_WHEEL and the mouse is over this area and this
3226 area does not accept mouse wheel events, then return false.
3227
3228@@ -278,34 +284,23 @@
3229 */
3230 bool TestMousePointerInclusionFilterMouseWheel(const Point& mouse_position, NuxEventType event);
3231
3232- virtual long ComputeChildLayout ();
3233- virtual void PositionChildLayout (float offsetX, float offsetY);
3234- virtual long ComputeLayout2 ();
3235- virtual void ComputePosition2 (float offsetX, float offsetY);
3236-
3237- virtual bool IsArea () const;
3238- virtual bool IsInputArea () const;
3239- virtual bool IsView () const;
3240- virtual bool IsLayout () const;
3241- virtual bool IsSpaceLayout () const;
3242- virtual bool IsViewWindow () const;
3243-
3244- //! Set the layout properties for this area
3245- /*!
3246- Allows the Layout managing this area to store the properties specifc to this area. Layouts
3247- should create a sub-class of LayoutProperties. The LayoutProperties of an area will
3248- be deleted upon destruction.
3249- @param properties the LayoutProperties sub-class associated with this area. Can be NULL to
3250- unset.
3251- */
3252- void SetLayoutProperties (LayoutProperties *properties);
3253-
3254- //! Get the layout properties for this area
3255- /*!
3256- Retrieves the LayoutProperties sub-class with this area. See SetLayoutProperties
3257- @return LayoutProperties sub-class associated with this area.
3258- */
3259- LayoutProperties * GetLayoutProperties ();
3260+ //! Test if the muse pointer is inside the area.
3261+ /*!
3262+ Return true if the mouse pointer is inside the area.
3263+
3264+ @return True if the mouse pointer is inside the area.
3265+ */
3266+ bool IsMousePointerInside() const;
3267+
3268+ virtual long ComputeContentSize();
3269+ virtual void ComputeContentPosition(float offsetX, float offsetY);
3270+
3271+ virtual bool IsArea() const;
3272+ virtual bool IsInputArea() const;
3273+ virtual bool IsView() const;
3274+ virtual bool IsLayout() const;
3275+ virtual bool IsSpaceLayout() const;
3276+ virtual bool IsViewWindow() const;
3277
3278 Area * GetParentObject() const;
3279
3280@@ -314,36 +309,41 @@
3281 If visible, an area will be drawn. Default: true.
3282 @param visible if the area is visible to the user
3283 */
3284- void SetVisible (bool visible);
3285+ void SetVisible(bool visible);
3286
3287 //! Get the visibility of the area
3288 /*!
3289 Gets whether the area is visible to the user and will be visible to the user. Default is true.
3290 @return whether the area is visible
3291 */
3292- bool IsVisible ();
3293-
3294- //! Set sensitivity of the area
3295+ bool IsVisible();
3296+
3297+ //! Deprecated. Use SetInputEventSensitivity.
3298+ void SetSensitive(bool);
3299+
3300+ //! Set input event sensitivity of the area.
3301 /*!
3302- If sensitive, an area will receive input events. Default is true.
3303- @param if the area should receive input events
3304+ A insensitive Area will not receive input events.\n
3305+ 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+ An area that is not sensitive will return false in \a TestMousePointerInclusion, \a TestMousePointerInclusionFilterMouseWheel and \a AcceptKeyNavFocus.\n
3307+ Sensitivity does not affect layouts since they do not process events.
3308+
3309+ By default, an area is sensitive.
3310+
3311+ @param sensitive If the area should receive input events
3312 */
3313- void SetSensitive (bool sensitive);
3314-
3315- //! Get whether the area is sensitive
3316+ void SetInputEventSensitivity(bool sensitive);
3317+
3318+ //! Deprecated. Use GetInputEventSensitivity.
3319+ bool IsSensitive() const;
3320+
3321+ //! Get input event sensitivity of the area is sensitive
3322 /*!
3323 Gets whether the area is sensitive to input events
3324 @return whether the area is visible
3325 */
3326- bool IsSensitive ();
3327+ bool GetInputEventSensitivity() const;
3328
3329- virtual bool DoGetFocused ();
3330- virtual void DoSetFocused (bool focused);
3331- virtual bool DoCanFocus ();
3332- virtual void DoActivateFocus ();
3333-
3334- sigc::signal<void, Area *> FocusActivated;
3335- sigc::signal<void, Area *> FocusChanged;
3336 sigc::signal<void, Area*> ChildFocusChanged; // sends parent + child
3337
3338 /*!
3339@@ -358,106 +358,132 @@
3340 /*!
3341 Queues a relayout before the next paint cycle. This is safe to call multiple times within a cycle.
3342 */
3343- void QueueRelayout ();
3344-
3345- virtual unsigned int GetStretchFactor();
3346- virtual void SetStretchFactor (unsigned int sf);
3347+ void QueueRelayout();
3348+
3349+ //! Get the area scale factor.
3350+ /*!
3351+ The scale factor is used to control the layout of area objects inside HLayout and VLayout.
3352+ \sa HLayout, VLayout.
3353+
3354+ @return the Area scale factor.
3355+ */
3356+ virtual unsigned int GetScaleFactor();
3357+
3358+ //! Set the area scale factor.
3359+ /*!
3360+ The scale factor is used to control the layout of area objects inside HLayout and VLayout.
3361+ \sa HLayout, VLayout.
3362+
3363+ @param the scale factor.
3364+ */
3365+ virtual void SetScaleFactor(unsigned int sf);
3366
3367 virtual MinorDimensionPosition GetPositioning();
3368- virtual void SetPositioning (MinorDimensionPosition p);
3369+ virtual void SetPositioning(MinorDimensionPosition p);
3370
3371 virtual MinorDimensionSize GetExtend();
3372- virtual void SetExtend (MinorDimensionSize ext);
3373+ virtual void SetExtend(MinorDimensionSize ext);
3374
3375 virtual float GetPercentage();
3376- virtual void SetPercentage (float f);
3377+ virtual void SetPercentage(float f);
3378 virtual bool IsLayoutDone();
3379- virtual void SetLayoutDone (bool b);
3380-
3381- void Set2DMatrix (const Matrix4 &mat);
3382- void Set2DTranslation (float tx, float ty, float tz);
3383- Matrix4 Get2DMatrix () const;
3384-
3385- Matrix4 Get3DMatrix () const;
3386- bool Is3DArea () const;
3387+ virtual void SetLayoutDone(bool b);
3388+
3389+ void Set2DMatrix(const Matrix4 &mat);
3390+ void Set2DTranslation(float tx, float ty, float tz);
3391+ Matrix4 Get2DMatrix() const;
3392+
3393+ Matrix4 Get3DMatrix() const;
3394+ bool Is3DArea() const;
3395
3396 //! Return the position of this object with regard to its top left corner of the physical window.
3397 /*!
3398 Return the position of the Area inside the physical window.
3399 For the main layout set in WindowThread, The following functions are equivalent:
3400- \li GetGeometry ()
3401- \li GetRootGeometry ()
3402- \li GetAbsoluteGeometry ()
3403+ \li GetGeometry()
3404+ \li GetRootGeometry()
3405+ \li GetAbsoluteGeometry()
3406 */
3407- virtual Geometry GetAbsoluteGeometry () const;
3408+ virtual Geometry GetAbsoluteGeometry() const;
3409
3410 //! Return the area absolute x coordinate.
3411- int GetAbsoluteX () const;
3412+ int GetAbsoluteX() const;
3413
3414 //! Return the area absolute y coordinate.
3415- int GetAbsoluteY () const;
3416+ int GetAbsoluteY() const;
3417
3418 //! Return the area absolute width.
3419 /*!
3420- As long as _2d_xform contains only translations, the absolute width is the same as value returned by GetBaseWidth ();
3421+ As long as _2d_xform contains only translations, the absolute width is the same as value returned by GetBaseWidth();
3422 */
3423- int GetAbsoluteWidth () const;
3424+ int GetAbsoluteWidth() const;
3425
3426 //! Return the area absolute height.
3427 /*!
3428- As long as _2d_xform contains only translations, the absolute height is the same as value returned by GetBaseHeight ();
3429+ As long as _2d_xform contains only translations, the absolute height is the same as value returned by GetBaseHeight();
3430 */
3431- int GetAbsoluteHeight () const;
3432+ int GetAbsoluteHeight() const;
3433
3434- //! Return the position of this object with regard to its top level parent (the main layout or a BaseWindow).
3435+ //! Return the position of this object with regard to its top level parent(the main layout or a BaseWindow).
3436 /*!
3437 Return the position of the Area inside the physical window.
3438- For the main layout set in WindowThread or for a BaseWindow, GetRootGeometry () is equivalent to GetGeometry ().
3439+ For the main layout set in WindowThread or for a BaseWindow, GetRootGeometry() is equivalent to GetGeometry().
3440 */
3441- virtual Geometry GetRootGeometry () const;
3442+ virtual Geometry GetRootGeometry() const;
3443
3444 //! Return the area root x coordinate.
3445- int GetRootX () const;
3446+ int GetRootX() const;
3447
3448 //! Return the area root y coordinate.
3449- int GetRootY () const;
3450+ int GetRootY() const;
3451
3452 //! Return the area root width.
3453 /*!
3454- As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth ();
3455+ As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth();
3456 */
3457- int GetRootWidth () const;
3458+ int GetRootWidth() const;
3459
3460 //! Return the area root height.
3461 /*!
3462- As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth ();
3463+ As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth();
3464 */
3465- int GetRootHeight () const;
3466+ int GetRootHeight() const;
3467
3468 sigc::signal<void, int, int, int, int> OnResize; //!< Signal emitted when an area is resized.
3469 sigc::signal<void, Area *, bool> OnVisibleChanged;
3470 sigc::signal<void, Area *, bool> OnSensitiveChanged;
3471+
3472+ /*!
3473+ This signal is only meant to inform of a change of size. When receiving this signal don't do anything
3474+ that could change the size of this object. Or you risk creating an infinite loop.
3475+ */
3476 sigc::signal<void, Area *, Geometry&> OnGeometryChanged;
3477
3478 /*!
3479- SetParentObject/UnParentObject are protected API. it is not meant to be used directly by users.
3480+ SetParentObject/UnParentObject are protected API. They are not meant to be used directly by users.
3481 Users add widgets to layouts and layout have to be attached to a composition for objects to be rendered.
3482 Setting a parent to and child widget does not mean that when the parent is rendered, the child is also rendered.
3483- For instance, setting a button the be the child of a check-box means absolutely nothing is terms of rendering.
3484- A widget with a parent cannot be added to a added to a layout for rendering. The widget has to be un-parented first.
3485- A layout with a parent cannot be added to a widget or another layout for rendering. The layout has to be un-parented first.
3486- In essence only View and Layouts should be calling SetParentObject/UnParentObject.
3487+ For instance, setting a button to be the child of a check-box means absolutely nothing is terms of rendering.
3488+ The check-box draw function would have to be aware of the existence of the button in order to render it.\n
3489+ A view with a parent cannot be parented to another area for rendering. It has to be un-parented first.\n
3490+ A layout with a parent cannot be parented to another area for rendering. It has to be un-parented first.\n
3491+ In essence only View and Layouts should be calling SetParentObject/UnParentObject.\n
3492+ SetParentObject returns true if it was successful.
3493+
3494+
3495+ @param parent The object that will become the parent of this area.
3496+ @return True if the object is successfully parented.
3497 */
3498- virtual void SetParentObject (Area *);
3499+ virtual bool SetParentObject(Area *parent);
3500
3501 //! Un-parent and area
3502 /*!
3503 For un-parented areas the following functions are equivalent:
3504- \li GetGeometry ()
3505- \li GetRootGeometry ()
3506- \li GetAbsoluteGeometry ()
3507+ \li GetGeometry()
3508+ \li GetRootGeometry()
3509+ \li GetAbsoluteGeometry()
3510 */
3511- virtual void UnParentObject ();
3512+ virtual void UnParentObject();
3513
3514 /*!
3515 Return the area under the mouse pointer.
3516@@ -491,7 +517,7 @@
3517 When the geometry of an area changes, the new geometry can be recursively propagated to all its
3518 parent so a layout reconfiguration is initiated.
3519 \sa ReconfigureParentLayout()
3520- \sa _on_geometry_changeg_reconfigure_parent_layout
3521+ \sa on_geometry_change_reconfigure_parent_layout_
3522
3523 @param reconfigure_parent_layout Set it to True to reconfigure this area parent layouts.
3524 */
3525@@ -527,37 +553,53 @@
3526 */
3527 bool AcceptMouseWheelEvent() const;
3528
3529+ //! Return the direction of the area.
3530+ Direction GetDirection() const;
3531+ //! Sets the direction of the area.
3532+ /*!
3533+ @param direction Either nux::LeftToRight or nux::RightToLeft
3534+ */
3535+ void SetDirection(Direction direction);
3536+
3537 protected:
3538- bool _is_focused;
3539 /*
3540 This function is reimplemented in Layout as it need to perform some special operations.
3541 It does nothing for Area and View classes.
3542 */
3543 //virtual void RemoveChildObject(smptr(Area));
3544
3545- virtual void GeometryChangePending () {}
3546- virtual void GeometryChanged () {}
3547+ /*!
3548+ This signal is only meant to inform that the size is about to change. When overriding this function,
3549+ don't do anything that could change the size of this object. Or you risk creating an infinite loop.
3550+ */
3551+ virtual void GeometryChangePending() {}
3552+
3553+ /*!
3554+ This signal is only meant to inform that the size has changed. When overriding this function,
3555+ don't do anything that could change the size of this object. Or you risk creating an infinite loop.
3556+ */
3557+ virtual void GeometryChanged() {}
3558
3559 //! Request a Layout recompute after a change of size
3560 /*
3561 When an object size changes, it is necessary for its parent structure to initiate a layout
3562 re computation in order preserve the layout structure defined by the user through the API.
3563 */
3564- virtual void RequestBottomUpLayoutComputation (Area *bo_initiator);
3565-
3566- //! Return the absolute geometry starting with a relative geometry passed as argument.
3567- void InnerGetAbsoluteGeometry (Geometry &geometry);
3568-
3569- //! Return the absolute geometry starting with a relative geometry passed as argument.
3570- void InnerGetRootGeometry (Geometry &geometry);
3571+ virtual void RequestBottomUpLayoutComputation(Area *bo_initiator);
3572+
3573+ //! Return the absolute geometry starting with a relative geometry passed as argument.
3574+ void InnerGetAbsoluteGeometry(Geometry &geometry);
3575+
3576+ //! Return the absolute geometry starting with a relative geometry passed as argument.
3577+ void InnerGetRootGeometry(Geometry &geometry);
3578
3579 // //! Add a "secondary" child to this Area. The
3580 // /*!
3581 // @return True if the child has been added; False otherwise;
3582 // */
3583-// bool Secondary (Area *child);
3584+// bool Secondary(Area *child);
3585
3586- bool _on_geometry_changeg_reconfigure_parent_layout;
3587+ bool on_geometry_change_reconfigure_parent_layout_;
3588
3589 bool has_key_focus_;
3590
3591@@ -568,32 +610,32 @@
3592 void CheckMaxSize();
3593
3594
3595- Geometry _geometry; //!< The area geometry.
3596+ Geometry geometry_; //!< The area geometry.
3597
3598 //! Define a parent child structure
3599 /*
3600 An object of the class Area may have another of the class Layout as Parent.
3601 An object of the class View may have an object of the class Layout as parent.
3602 An object of the class Layout may have a parent of the class Layout or View as parent.
3603- A Area cannot have children (that may change later).
3604+ A Area cannot have children(that may change later).
3605 */
3606- Area *_parent_area;
3607-
3608+ Area *parent_area_;
3609
3610- LayoutProperties *_layout_properties;
3611- bool _visible;
3612- bool _sensitive;
3613+ bool visible_; //!< Visible state of the area.
3614+ bool sensitive_; //!< Input sensitive state of the area
3615+ bool view_enabled_; //!< The enable state of a view.
3616
3617 NString _base_string; //!< A text string property for this area.
3618
3619- Size _min_size; //!< A text string property for this area.
3620- Size _max_size; //!< A text string property for this area.
3621+ Size min_size_; //!< A text string property for this area.
3622+ Size max_size_; //!< A text string property for this area.
3623
3624- unsigned int _stretch_factor; //!< Factor for element expansion.
3625- MinorDimensionPosition _positioning; //!< Area position hint
3626- MinorDimensionSize _extend; //!< Area dimension hint
3627- float _percentage; //!< Area size percentage value.
3628- bool _layout_done; //!< Area layout status flag.
3629+ // Parameters used in layouts
3630+ unsigned int scale_factor_; //!< Factor for element expansion.
3631+ MinorDimensionPosition minor_axis_position_; //!< Area position hint
3632+ MinorDimensionSize minor_axis_size_; //!< Area dimension hint
3633+ float minor_axis_size_scale_; //!< Area size percentage value.
3634+ bool layout_done_; //!< Area layout status flag.
3635
3636
3637 Matrix4 _2d_xform; //!< 2D transformation matrix for this area and its children. Contains only translations.
3638@@ -605,6 +647,8 @@
3639 bool _accept_mouse_wheel_event;
3640 bool _accept_keyboard_event;
3641
3642+ Direction _direction;
3643+
3644 friend class Layout;
3645 friend class View;
3646 friend class WindowThread;
3647
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 namespace nux
3653 {
3654
3655- NUX_IMPLEMENT_OBJECT_TYPE (BaseWindow);
3656+ NUX_IMPLEMENT_OBJECT_TYPE(BaseWindow);
3657
3658 const int SizeGripWidth = 20;
3659 const int SizeGripHeight = 20;
3660@@ -44,10 +44,10 @@
3661 pass the top-left corner position of the window. When drawing, make a similar adjustment.
3662 */
3663
3664- BaseWindow::BaseWindow (const TCHAR *WindowName, NUX_FILE_LINE_DECL)
3665- : View (NUX_FILE_LINE_PARAM)
3666+ BaseWindow::BaseWindow(const char *WindowName, NUX_FILE_LINE_DECL)
3667+ : View(NUX_FILE_LINE_PARAM)
3668 , _paint_layer(new ColorLayer(Color(0xFF707070)))
3669- , _opacity (1.0f)
3670+ , _opacity(1.0f)
3671 {
3672 premultiply = true;
3673 _name = WindowName;
3674@@ -70,9 +70,9 @@
3675 accept_key_nav_focus_ = false;
3676
3677 // Should be at the end of the constructor
3678- GetWindowCompositor().RegisterWindow (this);
3679+ GetWindowCompositor().RegisterWindow(this);
3680
3681- SetMinimumSize (1, 1);
3682+ SetMinimumSize(1, 1);
3683 SetGeometry(Geometry(100, 100, 320, 200));
3684 }
3685
3686@@ -80,7 +80,7 @@
3687 {
3688 if (_enter_focus_input_area)
3689 {
3690- _enter_focus_input_area->UnReference ();
3691+ _enter_focus_input_area->UnReference();
3692 }
3693
3694 #if defined(NUX_OS_LINUX)
3695@@ -89,160 +89,90 @@
3696 #endif
3697 }
3698
3699- long BaseWindow::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
3700- {
3701- long ret = TraverseInfo;
3702- long ProcEvInfo = 0;
3703-
3704- IEvent window_event = ievent;
3705- Geometry base = GetGeometry();
3706- window_event.e_x_root = base.x;
3707- window_event.e_y_root = base.y;
3708-
3709- // The child layout get the Mouse down button only if the MouseDown happened inside the client view Area
3710- Geometry viewGeometry = GetGeometry();
3711-
3712- if (ievent.e_event == NUX_MOUSE_PRESSED)
3713- {
3714- if (!viewGeometry.IsPointInside (ievent.e_x - ievent.e_x_root, ievent.e_y - ievent.e_y_root) )
3715- {
3716- ProcEvInfo = eDoNotProcess;
3717- }
3718- }
3719-
3720- if (m_layout)
3721- ret = m_layout->ProcessEvent (window_event, ret, ProcEvInfo);
3722-
3723- // PostProcessEvent2 must always have its last parameter set to 0
3724- // because the m_BackgroundArea is the real physical limit of the window.
3725- // So the previous test about IsPointInside do not prevail over m_BackgroundArea
3726- // testing the event by itself.
3727- ret = PostProcessEvent2 (ievent, ret, 0);
3728- return ret;
3729- }
3730-
3731 Area* BaseWindow::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type)
3732 {
3733 bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type);
3734
3735- if(mouse_inside == false)
3736+ if (mouse_inside == false)
3737 return NULL;
3738
3739- if(m_layout)
3740+ if (m_layout)
3741 {
3742 nuxAssert(m_layout->IsLayout());
3743 Area* found_area = m_layout->FindAreaUnderMouse(mouse_position, event_type);
3744- if(found_area)
3745+ if (found_area)
3746 return found_area;
3747 }
3748
3749- if((event_type == NUX_MOUSE_WHEEL) && (!AcceptMouseWheelEvent()))
3750+ if ((event_type == NUX_MOUSE_WHEEL) && (!AcceptMouseWheelEvent()))
3751 return NULL;
3752 return this;
3753 }
3754
3755- void BaseWindow::Draw (GraphicsEngine &GfxContext, bool force_draw)
3756+ void BaseWindow::Draw(GraphicsEngine &graphics_engine, bool force_draw)
3757 {
3758 Geometry base = GetGeometry();
3759- // The elements position inside the window are referenced to top-left window corner. So bring base to (0, 0).
3760- base.SetX (0);
3761- base.SetY (0);
3762- GfxContext.PushClippingRectangle (base);
3763+ // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
3764+ base.SetX(0);
3765+ base.SetY(0);
3766+ graphics_engine.PushClippingRectangle(base);
3767
3768- GetPainter().PushDrawLayer(GfxContext, base, _paint_layer.get());
3769+ GetPainter().PushDrawLayer(graphics_engine, base, _paint_layer.get());
3770
3771 GetPainter().PopBackground();
3772- GfxContext.PopClippingRectangle();
3773+ graphics_engine.PopClippingRectangle();
3774 }
3775
3776- void BaseWindow::DrawContent (GraphicsEngine &GfxContext, bool force_draw)
3777+ void BaseWindow::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
3778 {
3779
3780 Geometry base = GetGeometry();
3781- // The elements position inside the window are referenced to top-left window corner. So bring base to (0, 0).
3782- base.SetX (0);
3783- base.SetY (0);
3784-
3785-
3786- GetPainter().PushLayer(GfxContext, base, _paint_layer.get());
3787+ // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
3788+ base.SetX(0);
3789+ base.SetY(0);
3790+
3791+
3792+ GetPainter().PushLayer(graphics_engine, base, _paint_layer.get());
3793
3794 if (m_layout)
3795 {
3796- GfxContext.PushClippingRectangle (base);
3797- m_layout->ProcessDraw (GfxContext, force_draw);
3798- GfxContext.PopClippingRectangle();
3799+ graphics_engine.PushClippingRectangle(base);
3800+ m_layout->ProcessDraw(graphics_engine, force_draw);
3801+ graphics_engine.PopClippingRectangle();
3802 }
3803
3804 GetPainter().PopBackground();
3805 }
3806
3807- void BaseWindow::PostDraw (GraphicsEngine &GfxContext, bool force_draw)
3808+ void BaseWindow::PostDraw(GraphicsEngine &graphics_engine, bool force_draw)
3809 {
3810
3811 }
3812
3813- void BaseWindow::SetConfigureNotifyCallback (ConfigureNotifyCallback Callback, void *Data)
3814+ void BaseWindow::SetConfigureNotifyCallback(ConfigureNotifyCallback Callback, void *Data)
3815 {
3816 m_configure_notify_callback = Callback;
3817 m_configure_notify_callback_data = Data;
3818 }
3819
3820- void BaseWindow::AddWidget (View *ic)
3821- {
3822- if (ic && m_layout)
3823- {
3824- m_layout->AddView (ic, 0);
3825- // 0: the WidgetLayout geometry will be set to SetGeometry(0,0,1,1);
3826- // and the children will take their natural size by expending WidgetLayout.
3827- // If the parent of WidgetLayout offers more space, it won't be used by WidgetLayout.
3828-
3829- ComputeChildLayout();
3830- }
3831- }
3832-
3833- void BaseWindow::AddWidget (View *ic, int stretchfactor)
3834- {
3835- if (ic && m_layout)
3836- {
3837- m_layout->AddView (ic, stretchfactor);
3838- // if(stretchfactor ==0): the WidgetLayout geometry will be set to SetGeometry(0,0,1,1);
3839- // and the children will take their natural size by expending WidgetLayout.
3840- // If the parent of WidgetLayout offers more space, it won't be used by WidgetLayout.
3841-
3842- ComputeChildLayout();
3843- }
3844- }
3845-
3846- void BaseWindow::AddWidget (std::list<View *> *ViewList)
3847- {
3848- m_CompositionLayout->Clear();
3849-
3850- std::list<View *>::iterator it;
3851-
3852- for (it = ViewList->begin(); it != ViewList->end(); it++)
3853- {
3854- AddWidget ( (*it) );
3855- }
3856- }
3857-
3858- Layout* BaseWindow::GetLayout ()
3859+ Layout* BaseWindow::GetLayout()
3860 {
3861 return m_layout;
3862 }
3863
3864- bool BaseWindow::SetLayout (Layout *layout)
3865+ bool BaseWindow::SetLayout(Layout *layout)
3866 {
3867- if (View::SetLayout (layout) == false)
3868+ if (View::SetLayout(layout) == false)
3869 return false;
3870
3871 m_layout = layout;
3872 Geometry geo = GetGeometry();
3873- Geometry layout_geo = Geometry (geo.x + m_Border, geo.y + m_TopBorder,
3874+ Geometry layout_geo = Geometry(geo.x + m_Border, geo.y + m_TopBorder,
3875 geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder);
3876- m_layout->SetGeometry (layout_geo);
3877+ m_layout->SetGeometry(layout_geo);
3878
3879 // When this call returns the layout computation is done.
3880- ComputeChildLayout();
3881+ ComputeContentSize();
3882 // or use
3883 //GetWindowThread()->QueueObjectLayout(m_layout);
3884
3885@@ -257,16 +187,16 @@
3886
3887 if (m_configure_notify_callback)
3888 {
3889- (*m_configure_notify_callback) (GetGraphicsDisplay()->GetWindowWidth(), GetGraphicsDisplay()->GetWindowHeight(), geo, m_configure_notify_callback_data);
3890+ (*m_configure_notify_callback)(GetGraphicsDisplay()->GetWindowWidth(), GetGraphicsDisplay()->GetWindowHeight(), geo, m_configure_notify_callback_data);
3891
3892- if (geo.IsNull() )
3893+ if (geo.IsNull())
3894 {
3895- nuxDebugMsg (TEXT ("[BaseWindow::PreLayoutManagement] Received an invalid Geometry.") );
3896+ nuxDebugMsg("[BaseWindow::PreLayoutManagement] Received an invalid Geometry.");
3897 geo = GetGeometry();
3898 }
3899 else
3900 {
3901- Area::SetGeometry (geo);
3902+ Area::SetGeometry(geo);
3903 // Get the geometry adjusted with respect to min and max dimension of this area.
3904 geo = GetGeometry();
3905 }
3906@@ -274,30 +204,30 @@
3907
3908 if (m_layout)
3909 {
3910- Geometry layout_geo = Geometry (m_Border, m_TopBorder,
3911+ Geometry layout_geo = Geometry(m_Border, m_TopBorder,
3912 geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder);
3913
3914- if (IsSizeMatchContent ())
3915- m_layout->SetGeometry (Geometry (0, 0, 1, 1));
3916+ if (IsSizeMatchContent())
3917+ m_layout->SetGeometry(Geometry(0, 0, 1, 1));
3918 else
3919- m_layout->SetGeometry (layout_geo);
3920+ m_layout->SetGeometry(layout_geo);
3921 }
3922 }
3923
3924 // Get a change to do any work on an element.
3925 // Here we need to position the header by hand because it is not under the control of vlayout.
3926- long BaseWindow::PostLayoutManagement (long LayoutResult)
3927+ long BaseWindow::PostLayoutManagement(long LayoutResult)
3928 {
3929 if (IsSizeMatchContent() && m_layout)
3930 {
3931 Geometry layout_geometry = m_layout->GetGeometry();
3932
3933- Geometry WindowGeometry = Geometry (GetGeometry().x,
3934+ Geometry WindowGeometry = Geometry(GetGeometry().x,
3935 GetGeometry().y,
3936 layout_geometry.GetWidth() + 2 * m_Border,
3937 layout_geometry.GetHeight() + m_Border + m_TopBorder);
3938
3939- Area::SetGeometry (WindowGeometry);
3940+ Area::SetGeometry(WindowGeometry);
3941 }
3942
3943 // A BaseWindow must kill the result of the management and pass it to the parent Layout.
3944@@ -307,13 +237,13 @@
3945
3946 // Get a change to do any work on an element.
3947 // Here we need to position the header by hand because it is not under the control of vlayout.
3948- void BaseWindow::PositionChildLayout (float offsetX, float offsetY)
3949+ void BaseWindow::ComputeContentPosition(float offsetX, float offsetY)
3950 {
3951
3952 }
3953
3954 #if defined(NUX_OS_LINUX)
3955- void BaseWindow::EnableInputWindow (bool b,
3956+ void BaseWindow::EnableInputWindow(bool b,
3957 const char* title,
3958 bool take_focus,
3959 bool override_redirect)
3960@@ -321,62 +251,62 @@
3961 if (b)
3962 {
3963 if (m_input_window == 0)
3964- m_input_window = new XInputWindow (title, take_focus, override_redirect);
3965+ m_input_window = new XInputWindow(title, take_focus, override_redirect);
3966
3967- m_input_window->Show ();
3968- m_input_window->SetGeometry (GetGeometry());
3969+ m_input_window->Show();
3970+ m_input_window->SetGeometry(GetGeometry());
3971 m_input_window_enabled = true;
3972 }
3973 else
3974 {
3975 if (m_input_window)
3976- m_input_window->Hide ();
3977+ m_input_window->Hide();
3978 m_input_window_enabled = false;
3979 }
3980 }
3981
3982- bool BaseWindow::InputWindowEnabled ()
3983+ bool BaseWindow::InputWindowEnabled()
3984 {
3985 return m_input_window_enabled;
3986 }
3987
3988- void BaseWindow::InputWindowEnableStruts (bool enable)
3989- {
3990- if (m_input_window)
3991- m_input_window->EnableStruts (enable);
3992- }
3993-
3994- bool BaseWindow::InputWindowStrutsEnabled ()
3995- {
3996- return m_input_window_enabled && m_input_window->StrutsEnabled ();
3997- }
3998-
3999- void BaseWindow::SetInputFocus ()
4000- {
4001- if (m_input_window)
4002- m_input_window->SetInputFocus ();
4003+ void BaseWindow::InputWindowEnableStruts(bool enable)
4004+ {
4005+ if (m_input_window)
4006+ m_input_window->EnableStruts(enable);
4007+ }
4008+
4009+ bool BaseWindow::InputWindowStrutsEnabled()
4010+ {
4011+ return m_input_window_enabled && m_input_window->StrutsEnabled();
4012+ }
4013+
4014+ void BaseWindow::SetInputFocus()
4015+ {
4016+ if (m_input_window)
4017+ m_input_window->SetInputFocus();
4018 }
4019
4020- Window BaseWindow::GetInputWindowId ()
4021+ Window BaseWindow::GetInputWindowId()
4022 {
4023 if (m_input_window)
4024- return m_input_window->GetWindow ();
4025+ return m_input_window->GetWindow();
4026 else
4027 return 0;
4028 }
4029
4030 #endif
4031
4032- void BaseWindow::SetGeometry (const Geometry &geo)
4033+ void BaseWindow::SetGeometry(const Geometry &geo)
4034 {
4035- Area::SetGeometry (geo);
4036+ Area::SetGeometry(geo);
4037
4038 #if defined(NUX_OS_LINUX)
4039 if (m_input_window)
4040- m_input_window->SetGeometry (geo);
4041+ m_input_window->SetGeometry(geo);
4042 #endif
4043 //LayoutWindowElements();
4044- //ComputeChildLayout();
4045+ //ComputeContentSize();
4046 }
4047
4048 void BaseWindow::LayoutWindowElements()
4049@@ -386,7 +316,7 @@
4050 Geometry base = GetGeometry();
4051 }
4052
4053- void BaseWindow::SetBorder (int border)
4054+ void BaseWindow::SetBorder(int border)
4055 {
4056 if (m_Border != border)
4057 {
4058@@ -394,7 +324,7 @@
4059 }
4060 }
4061
4062- void BaseWindow::SetTopBorder (int border)
4063+ void BaseWindow::SetTopBorder(int border)
4064 {
4065 if (m_TopBorder != border)
4066 {
4067@@ -432,7 +362,7 @@
4068 sigVisible.emit(this);
4069 GetWindowCompositor().sigVisibleViewWindow.emit(this);
4070
4071- ComputeChildLayout();
4072+ ComputeContentSize();
4073 }
4074 else
4075 {
4076@@ -459,7 +389,7 @@
4077 _is_visible = false;
4078 _is_modal = false;
4079 //ShowWindow(false);
4080- GetWindowCompositor().StopModalWindow (ObjectWeakPtr<BaseWindow> (this));
4081+ GetWindowCompositor().StopModalWindow(ObjectWeakPtr<BaseWindow> (this));
4082 }
4083
4084 bool BaseWindow::IsModal() const
4085@@ -467,7 +397,7 @@
4086 return _is_modal;
4087 }
4088
4089- void BaseWindow::NotifyConfigurationChange (int Width, int Height)
4090+ void BaseWindow::NotifyConfigurationChange(int Width, int Height)
4091 {
4092 Geometry geo = GetGeometry();
4093
4094@@ -475,14 +405,14 @@
4095 {
4096 (*m_configure_notify_callback) (GetGraphicsDisplay()->GetWindowWidth(), GetGraphicsDisplay()->GetWindowHeight(), geo, m_configure_notify_callback_data);
4097
4098- if (geo.IsNull() )
4099+ if (geo.IsNull())
4100 {
4101- nuxDebugMsg (TEXT ("[BaseWindow::NotifyConfigurationChange] Received an invalid Geometry.") );
4102+ nuxDebugMsg("[BaseWindow::NotifyConfigurationChange] Received an invalid Geometry.");
4103 geo = GetGeometry();
4104 }
4105 else
4106 {
4107- Area::SetGeometry (geo);
4108+ Area::SetGeometry(geo);
4109 // Get the geometry adjusted with respect to min and max dimension of this area.
4110 geo = GetGeometry();
4111 }
4112@@ -493,68 +423,68 @@
4113 }
4114 }
4115
4116- void BaseWindow::SetBackgroundLayer (AbstractPaintLayer *layer)
4117+ void BaseWindow::SetBackgroundLayer(AbstractPaintLayer *layer)
4118 {
4119- NUX_RETURN_IF_NULL (layer);
4120+ NUX_RETURN_IF_NULL(layer);
4121 _paint_layer.reset(layer->Clone());
4122 }
4123
4124- void BaseWindow::SetBackgroundColor (const Color &color)
4125+ void BaseWindow::SetBackgroundColor(const Color &color)
4126 {
4127 _paint_layer.reset(new ColorLayer(color));
4128 }
4129
4130- void BaseWindow::PushHigher (BaseWindow* floating_view)
4131- {
4132- GetWindowCompositor().PushHigher (this, floating_view);
4133- }
4134-
4135- void BaseWindow::PushToFront ()
4136- {
4137- GetWindowCompositor().PushToFront (this);
4138- }
4139-
4140- void BaseWindow::PushToBack ()
4141- {
4142- GetWindowCompositor().PushToBack (this);
4143- }
4144-
4145- bool BaseWindow::ChildNeedsRedraw ()
4146+ void BaseWindow::PushHigher(BaseWindow* floating_view)
4147+ {
4148+ GetWindowCompositor().PushHigher(this, floating_view);
4149+ }
4150+
4151+ void BaseWindow::PushToFront()
4152+ {
4153+ GetWindowCompositor().PushToFront(this);
4154+ }
4155+
4156+ void BaseWindow::PushToBack()
4157+ {
4158+ GetWindowCompositor().PushToBack(this);
4159+ }
4160+
4161+ bool BaseWindow::ChildNeedsRedraw()
4162 {
4163 return _child_need_redraw;
4164 }
4165
4166- void* BaseWindow::GetBackupTextureData (int &width, int &height, int &format)
4167+ void* BaseWindow::GetBackupTextureData(int &width, int &height, int &format)
4168 {
4169- return GetWindowCompositor ().GetBackupTextureData (this, width, height, format);
4170+ return GetWindowCompositor().GetBackupTextureData(this, width, height, format);
4171 }
4172
4173- void BaseWindow::SetEnterFocusInputArea (InputArea *input_area)
4174+ void BaseWindow::SetEnterFocusInputArea(InputArea *input_area)
4175 {
4176 if (_enter_focus_input_area)
4177 {
4178- _enter_focus_input_area->UnReference ();
4179+ _enter_focus_input_area->UnReference();
4180 }
4181
4182 _enter_focus_input_area = input_area;
4183 if (_enter_focus_input_area)
4184- _enter_focus_input_area->Reference ();
4185+ _enter_focus_input_area->Reference();
4186
4187 }
4188
4189- void BaseWindow::SetOpacity (float opacity)
4190+ void BaseWindow::SetOpacity(float opacity)
4191 {
4192 if (_opacity == opacity)
4193 return;
4194
4195 _opacity = opacity;
4196
4197- _opacity = CLAMP (_opacity, 0.0f, 1.0f);
4198+ _opacity = CLAMP(_opacity, 0.0f, 1.0f);
4199
4200- QueueDraw ();
4201+ QueueDraw();
4202 }
4203
4204- float BaseWindow::GetOpacity ()
4205+ float BaseWindow::GetOpacity()
4206 {
4207 return _opacity;
4208 }
4209
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 @param int The height of the window.
4215 @param Geometry& The tentative size of the window.
4216 */
4217- typedef void (*ConfigureNotifyCallback) (int, int, Geometry &, void *);
4218+ typedef void(*ConfigureNotifyCallback) (int, int, Geometry &, void *);
4219
4220 /*!
4221 A floating area on top of the main window.
4222@@ -66,23 +66,18 @@
4223 */
4224 class BaseWindow: public View
4225 {
4226- NUX_DECLARE_OBJECT_TYPE (BaseWindow, View);
4227+ NUX_DECLARE_OBJECT_TYPE(BaseWindow, View);
4228 public:
4229- BaseWindow (const TCHAR *WindowName = TEXT (""), NUX_FILE_LINE_PROTO);
4230+ BaseWindow(const char *WindowName = "", NUX_FILE_LINE_PROTO);
4231 virtual ~BaseWindow();
4232
4233 nux::Property<bool> premultiply;
4234
4235 virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type);
4236- virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
4237- virtual void Draw (GraphicsEngine &GfxContext, bool force_draw);
4238- virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw);
4239- virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw);
4240+ virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
4241+ virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
4242+ virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw);
4243
4244- void AddWidget (View *ic);
4245- void AddWidget (View *ic, int stretchfactor);
4246- void AddWidget (std::list<View *> *ViewList);
4247-
4248 virtual Layout* GetLayout();
4249 virtual bool SetLayout(Layout *layout);
4250
4251@@ -90,37 +85,37 @@
4252 /*!
4253 Push this view one level up the ViewWindow stack. Does it even if the view is hidden.
4254 */
4255- void PushHigher (BaseWindow* floating_view);
4256+ void PushHigher(BaseWindow* floating_view);
4257
4258 //! Push the view one level down the ViewWindow stack.
4259 /*!
4260 Push this view one level down the ViewWindow stack. Does it even if the view is hidden.
4261 */
4262- void PushLower (BaseWindow* floating_view);
4263+ void PushLower(BaseWindow* floating_view);
4264
4265 //! Push the view to the front of the ViewWindow stack.
4266 /*!
4267 Push this view to the top of the ViewWindow stack. Does it even if the view is hidden.
4268 If a valid ViewWindow has been forced at the top of the stack with a call to WindowCompositor::SetAlwaysOnFrontWindow(),
4269 then this view will be positioned one level below that view.
4270- \sa SetAlwaysOnFrontWindow ();
4271+ \sa SetAlwaysOnFrontWindow();
4272 */
4273- void PushToFront ();
4274+ void PushToFront();
4275
4276 //! Push the view to the back of the ViewWindow stack.
4277 /*!
4278 Push this view to the back of the ViewWindow stack. Does it even if the view is hidden.
4279 */
4280- void PushToBack ();
4281+ void PushToBack();
4282
4283 //! Set the window size to respect the layout container.
4284 /*!
4285 Set the window size to be such that the container layout size remains the same after ComputeSizeLayout2 is
4286- called on the layout. The window elements (title bar, minimize and close buttons) are positioned accordingly.
4287+ called on the layout. The window elements(title bar, minimize and close buttons) are positioned accordingly.
4288 The size grip is not responding anymore.
4289 @param b If b is true, the window size respect the size the layout container.
4290 */
4291- virtual void SetWindowSizeMatchLayout (bool b)
4292+ virtual void SetWindowSizeMatchLayout(bool b)
4293 {
4294 _size_match_layout = b;
4295 }
4296@@ -134,12 +129,12 @@
4297 return _size_match_layout;
4298 }
4299
4300- virtual void ShowWindow (bool b, bool StartModal = false);
4301- void StopModal ();
4302- bool IsModal () const;
4303- bool IsVisible () const;
4304+ virtual void ShowWindow(bool b, bool StartModal = false);
4305+ void StopModal();
4306+ bool IsModal() const;
4307+ bool IsVisible() const;
4308
4309- virtual void SetGeometry (const Geometry &geo);
4310+ virtual void SetGeometry(const Geometry &geo);
4311
4312 /*!
4313 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 @param Data The callback data.
4316 */
4317
4318- void SetConfigureNotifyCallback (ConfigureNotifyCallback Callback, void *Data);
4319-
4320- void SetBackgroundLayer (AbstractPaintLayer *layer);
4321- void SetBackgroundColor (const Color &color);
4322-
4323- void SetOpacity (float opacity);
4324- float GetOpacity ();
4325+ void SetConfigureNotifyCallback(ConfigureNotifyCallback Callback, void *Data);
4326+
4327+ void SetBackgroundLayer(AbstractPaintLayer *layer);
4328+ void SetBackgroundColor(const Color &color);
4329+
4330+ void SetOpacity(float opacity);
4331+ float GetOpacity();
4332
4333 #if defined(NUX_OS_LINUX)
4334- void EnableInputWindow (bool b,
4335+ void EnableInputWindow(bool b,
4336 const char* title = "nux input window",
4337 bool take_focus = False,
4338 bool override_redirect = False);
4339- bool InputWindowEnabled ();
4340- void InputWindowEnableStruts (bool enable);
4341- bool InputWindowStrutsEnabled ();
4342- void SetInputFocus ();
4343- Window GetInputWindowId ();
4344+ bool InputWindowEnabled();
4345+ void InputWindowEnableStruts(bool enable);
4346+ bool InputWindowStrutsEnabled();
4347+ void SetInputFocus();
4348+ Window GetInputWindowId();
4349 #endif
4350
4351 //! Set an InputArea to receive the keyboard focus when the BaseWIndow receives the NUX_WINDOW_ENTER_FOCUS event.
4352@@ -172,18 +167,18 @@
4353 \sa _enter_focus_input_area.
4354 @param input_area An InputArea pointer object. Must be a child of this BaseWindow.
4355 */
4356- void SetEnterFocusInputArea (InputArea *input_area);
4357+ void SetEnterFocusInputArea(InputArea *input_area);
4358
4359
4360 //! Get the backup texture data of this BaseWindow,
4361- void* GetBackupTextureData (int &width, int &height, int &format);
4362+ void* GetBackupTextureData(int &width, int &height, int &format);
4363
4364 //! Emit a signal when the BaseWindow becomes visible.
4365 sigc::signal<void, BaseWindow*> sigVisible;
4366 //! Emit a signal when the BaseWindow becomes hidden.
4367 sigc::signal<void, BaseWindow*> sigHidden;
4368
4369- NString GetWindowName ()
4370+ NString GetWindowName()
4371 {
4372 return _name;
4373 }
4374@@ -204,9 +199,9 @@
4375
4376 friend class ComboBox_Logic_WindowView;
4377
4378- virtual void PreLayoutManagement ();
4379- virtual long PostLayoutManagement (long LayoutResult);
4380- virtual void PositionChildLayout (float offsetX, float offsetY);
4381+ virtual void PreLayoutManagement();
4382+ virtual long PostLayoutManagement(long LayoutResult);
4383+ virtual void ComputeContentPosition(float offsetX, float offsetY);
4384 //! Layout the window elements.
4385 /*!
4386 Layout elements such as button on the title bar, and the resize widget according to the current
4387@@ -220,12 +215,12 @@
4388 @param Width New width of the window.
4389 @param Height New height of the window.
4390 */
4391- virtual void NotifyConfigurationChange (int Width, int Height);
4392+ virtual void NotifyConfigurationChange(int Width, int Height);
4393
4394 int GetBorder() const;
4395 int GetTopBorder() const;
4396- void SetBorder (int border);
4397- void SetTopBorder (int border);
4398+ void SetBorder(int border);
4399+ void SetTopBorder(int border);
4400 int m_TopBorder;
4401 int m_Border;
4402 boost::scoped_ptr<AbstractPaintLayer> _paint_layer;
4403@@ -233,7 +228,7 @@
4404 bool _entering_visible_state; //!< the window is about to be made visible during event processing
4405 bool _entering_hidden_state; //!< the window is about to be made hidden during event processing
4406
4407- bool ChildNeedsRedraw ();
4408+ bool ChildNeedsRedraw();
4409
4410 #if defined(NUX_OS_LINUX)
4411 bool m_input_window_enabled;
4412
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-/*
4418- * Copyright 2010 Inalogic® Inc.
4419- *
4420- * This program is free software: you can redistribute it and/or modify it
4421- * under the terms of the GNU Lesser General Public License, as
4422- * published by the Free Software Foundation; either version 2.1 or 3.0
4423- * of the License.
4424- *
4425- * This program is distributed in the hope that it will be useful, but
4426- * WITHOUT ANY WARRANTY; without even the implied warranties of
4427- * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
4428- * PURPOSE. See the applicable version of the GNU Lesser General Public
4429- * License for more details.
4430- *
4431- * You should have received a copy of both the GNU Lesser General Public
4432- * License along with this program. If not, see <http://www.gnu.org/licenses/>
4433- *
4434- * Authored by: Jay Taoko <jaytaoko@inalogic.com>
4435- *
4436- */
4437-
4438-
4439-#include "Nux.h"
4440-#include "NuxCore/Math/Constants.h"
4441-#include "NuxCore/Math/Spline.h"
4442-#include "NuxCore/Math/Bezier.h"
4443-#include "BezierCurveControl.h"
4444-
4445-namespace nux
4446-{
4447-
4448- const int KNOT_SIZE = 2;
4449- const int KNOT_HIT_TEST = 4;
4450-
4451- BezierCurveControl::BezierCurveControl (NUX_FILE_LINE_DECL)
4452- : View (NUX_FILE_LINE_PARAM)
4453- , m_minX (0.0f),
4454- m_minY (0.0f),
4455- m_maxX (1.0f),
4456- m_maxY (1.0f),
4457- m_FunctionCallback (0)
4458- {
4459- SetMinimumSize (400, 300);
4460- SetBaseSize (400, 300);
4461-
4462- m_control_knot.push_back (Knot (0.0f, 0.0f) );
4463- m_control_knot.push_back (Knot (0.1f, 0.0f) );
4464- m_control_knot.push_back (Knot (0.7f, 0.9f) );
4465- m_control_knot.push_back (Knot (1.0f, 1.0f) );
4466-
4467- mouse_down.connect (sigc::mem_fun (this, &BezierCurveControl::RecvMouseDown) );
4468- mouse_up.connect (sigc::mem_fun (this, &BezierCurveControl::RecvMouseUp) );
4469- mouse_drag.connect (sigc::mem_fun (this, &BezierCurveControl::RecvMouseDrag) );
4470-
4471- }
4472-
4473- BezierCurveControl::~BezierCurveControl()
4474- {
4475-
4476-
4477- }
4478-
4479-
4480- long BezierCurveControl::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
4481- {
4482- long ret = TraverseInfo;
4483-
4484- if (ievent.e_event == NUX_MOUSE_PRESSED)
4485- {
4486- if (!GetGeometry().IsPointInside (ievent.e_x, ievent.e_y) )
4487- {
4488- //ProcEvInfo = eDoNotProcess;
4489- //return TraverseInfo;
4490- }
4491- }
4492-
4493- ret = PostProcessEvent2 (ievent, ret, 0);
4494- return ret;
4495- }
4496-
4497-
4498- void BezierCurveControl::Draw (GraphicsEngine &GfxContext, bool force_draw)
4499- {
4500- Geometry base = GetGeometry();
4501-
4502- GetPainter().PaintBackground (GfxContext, base);
4503- GetPainter().Paint2DQuadWireframe (GfxContext, base, Color (COLOR_BACKGROUND_SECONDARY) );
4504-
4505-#define N 3
4506- t_u32 i;
4507- t_u32 nsample = 30;
4508- double t;
4509- t_u32 nbKnot = (t_u32) m_control_knot.size();
4510-
4511- if (nbKnot > 0)
4512- {
4513- double *xcon = new double[nbKnot];
4514- double xval;
4515- double *ycon = new double[nbKnot];
4516- double yval;
4517-
4518-
4519- for (i = 0; i < nbKnot; i++)
4520- {
4521- xcon[i] = m_control_knot[i].m_X;
4522- ycon[i] = m_control_knot[i].m_Y;
4523- }
4524-
4525- int W = GetBaseWidth() - 2;
4526- int H = GetBaseHeight() - 2;
4527- int X = GetBaseX() + 1;
4528- int Y = GetBaseY() + 1;
4529-
4530- double xprev, yprev;
4531- Bezier_XY (N, 0.0, xcon, ycon, &xprev, &yprev);
4532-
4533- //GetPainter().Draw2DLine(X, Y, X+W, Y+H, Color(0xFFFF0000));
4534-
4535- base.OffsetPosition (1, 1);
4536- base.OffsetSize (-2, -2);
4537-
4538- GfxContext.PushClippingRectangle (base);
4539-
4540- GfxContext.GetRenderStates().EnableLineSmooth (TRUE, 1, GL_FASTEST);
4541- GfxContext.GetRenderStates().SetBlend (TRUE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
4542-
4543- for (i = 1; i < nsample; i++)
4544- {
4545- t = ( double ) ( i ) / ( double ) ( nsample - 1 );
4546- Bezier_XY ( N, t, xcon, ycon, &xval, &yval );
4547-
4548- int X0, Y0, X1, Y1;
4549- X0 = X + W * (xprev - m_minX) / (m_maxX - m_minX);
4550- Y0 = Y + H * ( 1 - (yprev - m_minY) / (m_maxY - m_minY) );
4551- X1 = X + W * (xval - m_minX) / (m_maxX - m_minX);
4552- Y1 = Y + H * ( 1 - (yval - m_minY) / (m_maxY - m_minY) );
4553-
4554- GetPainter().Draw2DLine (GfxContext, X0, Y0, X1, Y1, Color (0xFFFF0000) );
4555-
4556- xprev = xval;
4557- yprev = yval;
4558- }
4559-
4560- GfxContext.GetRenderStates().EnableLineSmooth (FALSE);
4561- GfxContext.GetRenderStates().SetBlend (GL_FALSE);
4562-
4563- for (i = 0; i < nbKnot - 1; i++)
4564- {
4565- int X0, Y0, X1, Y1;
4566- X0 = X + W * (m_control_knot[i].m_X - m_minX) / (m_maxX - m_minX);
4567- Y0 = Y + H * ( 1 - (m_control_knot[i].m_Y - m_minY) / (m_maxY - m_minY) );
4568- X1 = X + W * (m_control_knot[i+1].m_X - m_minX) / (m_maxX - m_minX);
4569- Y1 = Y + H * ( 1 - (m_control_knot[i+1].m_Y - m_minY) / (m_maxY - m_minY) );
4570-
4571- GetPainter().Draw2DLine (GfxContext, X0, Y0, X1, Y1, Color (0xFF0000FF) );
4572-
4573- }
4574-
4575- for (i = 0; i < nbKnot; i++)
4576- {
4577- int X0, Y0;
4578- X0 = X + W * (m_control_knot[i].m_X - m_minX) / (m_maxX - m_minX);
4579- Y0 = Y + H * ( 1 - (m_control_knot[i].m_Y - m_minY) / (m_maxY - m_minY) );
4580-
4581- if (m_control_knot[i].m_IsSelected)
4582- GetPainter().Paint2DQuadColor (GfxContext, X0 - KNOT_SIZE, Y0 - KNOT_SIZE, 2 * KNOT_SIZE, 2 * KNOT_SIZE, Color (0xFF00FF00) );
4583- else
4584- GetPainter().Paint2DQuadColor (GfxContext, X0 - KNOT_SIZE, Y0 - KNOT_SIZE, 2 * KNOT_SIZE, 2 * KNOT_SIZE, Color (0xFF777777) );
4585- }
4586-
4587- delete[] xcon;
4588- delete[] ycon;
4589- }
4590-
4591-// for(int i = 1; i < GetWidth(); i++)
4592-// {
4593-// float x1, y1;
4594-//
4595-// x1 = x0 + dX;
4596-// y1 = EvalFunction(x1);
4597-//
4598-// int X0, Y0, X1, Y1;
4599-// X0 = X + W * (x0 - m_minX) / (m_maxX - m_minX);
4600-// Y0 = Y - H * (y0 + m_minY) / (m_maxY - m_minY);
4601-// X1 = X + W * (x1 - m_minX) / (m_maxX - m_minX);
4602-// Y1 = Y - H * (y1 + m_minY) / (m_maxY - m_minY);
4603-// GetPainter().Draw2DLine(X0, Y0, X1, Y1, Color(0xFFFF0000));
4604-//
4605-// x0 = x1;
4606-// y0 = y1;
4607-//
4608-// }
4609- GfxContext.PopClippingRectangle();
4610- }
4611-
4612-
4613- void BezierCurveControl::DrawContent (GraphicsEngine &GfxContext, bool force_draw)
4614- {
4615-
4616- }
4617-
4618- void BezierCurveControl::PostDraw (GraphicsEngine &GfxContext, bool force_draw)
4619- {
4620-
4621- }
4622-
4623-
4624- void BezierCurveControl::SetXAxisBounds (float minX, float maxX)
4625- {
4626- m_minX = minX;
4627- m_maxX = maxX;
4628- QueueDraw();
4629- }
4630-
4631- void BezierCurveControl::SetYAxisBounds (float minY, float maxY)
4632- {
4633- m_minY = minY;
4634- m_maxY = maxY;
4635- QueueDraw();
4636- }
4637-
4638- void BezierCurveControl::SetFunctionCallback (FunctionCallback f)
4639- {
4640- m_FunctionCallback = f;
4641- QueueDraw();
4642- }
4643-
4644- float BezierCurveControl::EvalFunction (float x)
4645- {
4646- if (m_FunctionCallback != 0)
4647- return (*m_FunctionCallback) (x);
4648-
4649- return 0;
4650- }
4651-
4652- void BezierCurveControl::UpdateGraph()
4653- {
4654- QueueDraw();
4655- }
4656-
4657-
4658-// check if a value lies within a closed interval
4659-#ifndef INSIDE_BOUNDS
4660-#define INSIDE_BOUNDS( x, lo, hi ) ( (x) >= (lo) && (x) <= (hi) )
4661-#endif
4662-
4663-//check if a 2D point lies within a 2D box
4664-#ifndef PT_INSIDE_BOX
4665-#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-#endif
4667-
4668- void BezierCurveControl::RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags)
4669- {
4670- QueueDraw();
4671- }
4672-
4673- void BezierCurveControl::RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags)
4674- {
4675- t_u32 nbKnot = (t_u32) m_control_knot.size();
4676-
4677- for (t_u32 i = 0; i < nbKnot; i++)
4678- {
4679- m_control_knot[i].m_IsSelected = false;
4680- }
4681-
4682- int W = GetBaseWidth() - 2;
4683- int H = GetBaseHeight() - 2;
4684- int X = GetBaseX() + 1;
4685- int Y = GetBaseY() + 1;
4686-
4687- bool b = PT_INSIDE_BOX (X + x, Y + y, X, X + W, Y, Y + H);
4688-
4689- if (b == false)
4690- return;
4691-
4692- X = GetBaseX();
4693- Y = GetBaseY();
4694-
4695- for (t_u32 i = 0; i < nbKnot; i++)
4696- {
4697- int Xp, Yp;
4698- Xp = X + W * (m_control_knot[i].m_X - m_minX) / (m_maxX - m_minX);
4699- Yp = Y + H * ( 1 - (m_control_knot[i].m_Y - m_minY) / (m_maxY - m_minY) );
4700-
4701- 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- {
4703- m_control_knot[i].m_IsSelected = true;
4704- break;
4705- }
4706- }
4707-
4708- QueueDraw();
4709- }
4710-
4711- void BezierCurveControl::RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
4712- {
4713- float xp, yp;
4714-
4715- int W = GetBaseWidth();
4716- int H = GetBaseHeight();
4717- t_u32 nbKnot = (t_u32) m_control_knot.size();
4718-
4719- xp = m_minX + (m_maxX - m_minX) * dx / W;
4720- yp = m_minY + (m_maxY - m_minY) * dy / H;
4721-
4722-
4723-
4724- for (t_u32 i = 0; i < nbKnot; i++)
4725- {
4726- if (m_control_knot[i].m_IsSelected)
4727- {
4728- m_control_knot[i].m_X += xp;
4729- m_control_knot[i].m_Y -= yp;
4730-
4731- if (m_control_knot[i].m_X < m_minX)
4732- {
4733- m_control_knot[i].m_X = m_minX;
4734- }
4735-
4736- if (m_control_knot[i].m_X > m_maxX)
4737- {
4738- m_control_knot[i].m_X = m_maxX;
4739- }
4740-
4741- if (m_control_knot[i].m_Y < m_minY)
4742- {
4743- m_control_knot[i].m_Y = m_minY;
4744- }
4745-
4746- if (m_control_knot[i].m_Y > m_maxY)
4747- {
4748- m_control_knot[i].m_Y = m_maxY;
4749- }
4750-
4751- break;
4752- }
4753- }
4754-
4755- QueueDraw();
4756- }
4757-
4758-
4759-}
4760
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-/*
4766- * Copyright 2010 Inalogic® Inc.
4767- *
4768- * This program is free software: you can redistribute it and/or modify it
4769- * under the terms of the GNU Lesser General Public License, as
4770- * published by the Free Software Foundation; either version 2.1 or 3.0
4771- * of the License.
4772- *
4773- * This program is distributed in the hope that it will be useful, but
4774- * WITHOUT ANY WARRANTY; without even the implied warranties of
4775- * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
4776- * PURPOSE. See the applicable version of the GNU Lesser General Public
4777- * License for more details.
4778- *
4779- * You should have received a copy of both the GNU Lesser General Public
4780- * License along with this program. If not, see <http://www.gnu.org/licenses/>
4781- *
4782- * Authored by: Jay Taoko <jaytaoko@inalogic.com>
4783- *
4784- */
4785-
4786-
4787-#ifndef BEZIERCURVECONTROL_H
4788-#define BEZIERCURVECONTROL_H
4789-
4790-namespace nux
4791-{
4792-
4793- class Knot
4794- {
4795- public :
4796-
4797- float m_X;
4798- float m_Y;
4799-
4800- bool m_IsSelected;
4801-
4802- public :
4803-
4804- Knot()
4805- : m_X (0)
4806- , m_Y (0)
4807- , m_IsSelected (false)
4808- {} //Constructors
4809- Knot (float ptX, float ptY)
4810- : m_X (ptX)
4811- , m_Y (ptY)
4812- , m_IsSelected (false)
4813- {}
4814-
4815- void setPoint (float x, float y)
4816- {
4817- m_X = x; //Setting
4818- m_Y = y;
4819- }
4820-
4821-
4822- //Operator overloading
4823- void operator = (Knot knot)
4824- {
4825- m_X = knot.m_X;
4826- m_Y = knot.m_Y;
4827- }
4828- bool operator != (Knot knot)
4829- {
4830- bool b;
4831- b = ( (m_X != knot.m_X) || (m_Y != knot.m_Y) ) ? true : false;
4832- return b;
4833- }
4834- };
4835-
4836-
4837- typedef float (*FunctionCallback) (float);
4838-
4839- class BezierCurveControl : public View
4840- {
4841- public:
4842- BezierCurveControl (NUX_FILE_LINE_PROTO);
4843- ~BezierCurveControl();
4844- virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
4845- virtual void Draw (GraphicsEngine &GfxContext, bool force_draw);
4846- virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw);
4847- virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw);
4848-
4849-
4850- void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags);
4851- void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
4852- void RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
4853- private:
4854- void SetXAxisBounds (float minX, float maxX);
4855- void SetYAxisBounds (float minY, float maxY);
4856- void SetFunctionCallback (FunctionCallback f);
4857- float EvalFunction (float x);
4858- void UpdateGraph();
4859-
4860- std::vector<Knot> m_control_knot;
4861-
4862- float m_minX, m_minY, m_maxX, m_maxY;
4863- FunctionCallback m_FunctionCallback;
4864- };
4865-
4866-
4867-}
4868-
4869-#endif // BEZIERCURVECONTROL_H
4870
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-/*
4876- * Copyright 2010 Inalogic® Inc.
4877- *
4878- * This program is free software: you can redistribute it and/or modify it
4879- * under the terms of the GNU Lesser General Public License, as
4880- * published by the Free Software Foundation; either version 2.1 or 3.0
4881- * of the License.
4882- *
4883- * This program is distributed in the hope that it will be useful, but
4884- * WITHOUT ANY WARRANTY; without even the implied warranties of
4885- * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
4886- * PURPOSE. See the applicable version of the GNU Lesser General Public
4887- * License for more details.
4888- *
4889- * You should have received a copy of both the GNU Lesser General Public
4890- * License along with this program. If not, see <http://www.gnu.org/licenses/>
4891- *
4892- * Authored by: Jay Taoko <jaytaoko@inalogic.com>
4893- *
4894- */
4895-
4896-
4897-#include "Nux.h"
4898-
4899-#include "BezierCurveControl2.h"
4900-#include "NuxCore/Math/Bezier.h"
4901-
4902-namespace nux
4903-{
4904-
4905- static const int KNOT_SIZE = 2;
4906- static const int KNOT_HIT_TEST = 4;
4907- static const int CURVE_DEGREE = 3;
4908- static const int GRAPH_MARGIN = 2;
4909- static const int UNIT_REFERENCE = 15;
4910-
4911- unsigned long S_KEY = 0;
4912-
4913- BezierCurveControl2::BezierCurveControl2 (NUX_FILE_LINE_DECL)
4914- : View (NUX_FILE_LINE_PARAM)
4915- , m_minX (-0.10f),
4916- m_minY (-0.100f),
4917- m_maxX (1.100f),
4918- m_maxY (1.100f),
4919- m_FunctionCallback (0),
4920- m_bControlPointSelected (0),
4921- m_bPanningEnabled (true),
4922- m_bZoomingEnabled (true)
4923- {
4924- SetMinimumSize (180, 180);
4925-
4926- m_control_knot.push_back (Knot2 (0.0f, 0.0f) );
4927- m_control_knot.push_back (Knot2 (0.1f, 0.0f) );
4928- m_control_knot.push_back (Knot2 (0.7f, 0.9f) );
4929- m_control_knot.push_back (Knot2 (1.0f, 1.0f) );
4930-
4931- mouse_down.connect (sigc::mem_fun (this, &BezierCurveControl2::RecvMouseDown) );
4932- mouse_up.connect (sigc::mem_fun (this, &BezierCurveControl2::RecvMouseUp) );
4933- mouse_drag.connect (sigc::mem_fun (this, &BezierCurveControl2::RecvMouseDrag) );
4934-
4935- key_down.connect (sigc::mem_fun (this, &BezierCurveControl2::RecvKeyEvent) );
4936-
4937- NTextureData image;
4938- MakeCheckBoardImage (image.GetSurface (0), 64, 64, Color (0xff323232), Color (0xff535353), 8, 8);
4939- BaseTexture* m_CheckboardPattern = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture ();
4940- m_CheckboardPattern->Update (&image);
4941-
4942- TexCoordXForm texxform;
4943- texxform.SetTexCoordType (TexCoordXForm::OFFSET_COORD);
4944- texxform.SetWrap (TEXWRAP_REPEAT, TEXWRAP_REPEAT);
4945- m_Background = new TextureLayer (m_CheckboardPattern->GetDeviceTexture(), texxform, color::White);
4946-
4947- m_CheckboardPattern->UnReference ();
4948- }
4949-
4950- BezierCurveControl2::~BezierCurveControl2()
4951- {
4952- delete m_Background;
4953- }
4954-
4955- long BezierCurveControl2::ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
4956- {
4957- long ret = TraverseInfo;
4958-
4959- if (ievent.e_event == NUX_MOUSE_PRESSED)
4960- {
4961- if (!GetGeometry().IsPointInside (ievent.e_x, ievent.e_y) )
4962- {
4963- //ProcEvInfo = eDoNotProcess;
4964- //return TraverseInfo;
4965- }
4966- }
4967-
4968- S_KEY = ievent.GetVirtualKeyState (NUX_VK_S);
4969- ret = PostProcessEvent2 (ievent, ret, ProcessEventInfo);
4970- return ret;
4971- }
4972-
4973-
4974- void BezierCurveControl2::Draw (GraphicsEngine &GfxContext, bool force_draw)
4975- {
4976- Geometry base = GetGeometry();
4977-
4978- GetPainter().PaintBackground (GfxContext, base);
4979- GetPainter().Paint2DQuadColor (GfxContext, base, Color (COLOR_BACKGROUND_PRIMARY) );
4980- base.OffsetPosition (GRAPH_MARGIN, GRAPH_MARGIN);
4981- base.OffsetSize (-2 * GRAPH_MARGIN, -2 * GRAPH_MARGIN);
4982-
4983- int W = GetBaseWidth() - 2 * GRAPH_MARGIN;
4984- int H = GetBaseHeight() - 2 * GRAPH_MARGIN;
4985- int X = GetBaseX() + GRAPH_MARGIN;
4986- int Y = GetBaseY() + GRAPH_MARGIN;
4987-
4988- t_u32 i;
4989- int nsample = base.GetWidth();
4990- double t;
4991- t_u32 nbKnot = (t_u32) m_control_knot.size();
4992-
4993- GfxContext.PushClippingRectangle (base);
4994-
4995- GetPainter().PushDrawLayer (GfxContext, base, m_Background);
4996- GetPainter().PopBackground();
4997-
4998- //DrawGrid(GfxContext);
4999- DrawCoordinateSystem (GfxContext);
5000-
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches