Skip to content

Instantly share code, notes, and snippets.

@1vanK
Created November 21, 2017 13:31
Show Gist options
  • Save 1vanK/c59c9417c9422d700c3984d24f0832c3 to your computer and use it in GitHub Desktop.
Save 1vanK/c59c9417c9422d700c3984d24f0832c3 to your computer and use it in GitHub Desktop.

Revisions

  1. 1vanK created this gist Nov 21, 2017.
    425 changes: 425 additions & 0 deletions Header parser example
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,425 @@
    //
    // Copyright (c) 2008-2017 the Urho3D project.
    //
    // Permission is hereby granted, free of charge, to any person obtaining a copy
    // of this software and associated documentation files (the "Software"), to deal
    // in the Software without restriction, including without limitation the rights
    // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    // copies of the Software, and to permit persons to whom the Software is
    // furnished to do so, subject to the following conditions:
    //
    // The above copyright notice and this permission notice shall be included in
    // all copies or substantial portions of the Software.
    //
    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    // THE SOFTWARE.
    //

    #pragma once

    #include "../UI/BorderImage.h"

    namespace Urho3D
    {

    /// Push button %UI element.
    class URHO3D_API Button : public BorderImage
    {
    URHO3D_OBJECT(Button, BorderImage);

    public:
    /// Construct.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // Button(Context* context);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = , ИМЯ = Button, ПАРАМЕТРЫ = Context* context
    // C++
    URHO3D_API Button* Button_Button(Context* nativeContext)
    {
    return new Button(Context* nativeContext);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern IntPtr Button_Button(IntPtr nativeContext);



    /// Destruct.
    virtual ~Button() override;
    /// Register object factory.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // static void RegisterObject(Context* context);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = static void, ИМЯ = RegisterObject, ПАРАМЕТРЫ = Context* context
    // C++
    URHO3D_API static void Button_RegisterObject(Button* nativeInstance, Context* nativeContext)
    {
    nativeInstance->RegisterObject(nativeContext);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern static void Button_RegisterObject(IntPtr nativeInstance, IntPtr nativeContext);




    /// Perform UI element update.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // virtual void Update(float timeStep) override;
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = virtual void, ИМЯ = Update, ПАРАМЕТРЫ = float timeStep
    // C++
    URHO3D_API virtual void Button_Update(Button* nativeInstance, float timeStep)
    {
    nativeInstance->Update(timeStep);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern virtual void Button_Update(IntPtr nativeInstance, float timeStep);



    /// Return UI rendering batches.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // virtual void GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor) override;
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = virtual void, ИМЯ = GetBatches, ПАРАМЕТРЫ = PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor
    // C++
    URHO3D_API virtual void Button_GetBatches(Button* nativeInstance, PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor)
    {
    nativeInstance->GetBatches(batches, vertexData, currentScissor);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern virtual void Button_GetBatches(IntPtr nativeInstance, PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor);



    /// React to mouse click begin.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // virtual void OnClickBegin (const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor) override;
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = virtual void, ИМЯ = OnClickBegin, ПАРАМЕТРЫ = const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor
    // C++
    URHO3D_API virtual void Button_OnClickBegin(Button* nativeInstance, const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor)
    {
    nativeInstance->OnClickBegin(position, screenPosition, button, buttons, qualifiers, cursor);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern virtual void Button_OnClickBegin(IntPtr nativeInstance, const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, IntPtr cursor);



    /// React to mouse click end.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // virtual void OnClickEnd (const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor, UIElement* beginElement) override;
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = virtual void, ИМЯ = OnClickEnd, ПАРАМЕТРЫ = const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor, UIElement* beginElement
    // C++
    URHO3D_API virtual void Button_OnClickEnd(Button* nativeInstance, const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, Cursor* cursor, UIElement* beginElement)
    {
    nativeInstance->OnClickEnd(position, screenPosition, button, buttons, qualifiers, cursor, beginElement);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern virtual void Button_OnClickEnd(IntPtr nativeInstance, const IntVector2& position, const IntVector2& screenPosition, int button, int buttons, int qualifiers, IntPtr cursor, IntPtr beginElement);



    /// React to mouse drag motion.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // virtual void OnDragMove (const IntVector2& position, const IntVector2& screenPosition, const IntVector2& deltaPos, int buttons, int qualifiers, Cursor* cursor) override;
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = virtual void, ИМЯ = OnDragMove, ПАРАМЕТРЫ = const IntVector2& position, const IntVector2& screenPosition, const IntVector2& deltaPos, int buttons, int qualifiers, Cursor* cursor
    // C++
    URHO3D_API virtual void Button_OnDragMove(Button* nativeInstance, const IntVector2& position, const IntVector2& screenPosition, const IntVector2& deltaPos, int buttons, int qualifiers, Cursor* cursor)
    {
    nativeInstance->OnDragMove(position, screenPosition, deltaPos, buttons, qualifiers, cursor);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern virtual void Button_OnDragMove(IntPtr nativeInstance, const IntVector2& position, const IntVector2& screenPosition, const IntVector2& deltaPos, int buttons, int qualifiers, IntPtr cursor);



    /// React to a key press.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // virtual void OnKey(int key, int buttons, int qualifiers) override;
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = virtual void, ИМЯ = OnKey, ПАРАМЕТРЫ = int key, int buttons, int qualifiers
    // C++
    URHO3D_API virtual void Button_OnKey(Button* nativeInstance, int key, int buttons, int qualifiers)
    {
    nativeInstance->OnKey(key, buttons, qualifiers);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern virtual void Button_OnKey(IntPtr nativeInstance, int key, int buttons, int qualifiers);




    /// Set offset to image rectangle used when pressed.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetPressedOffset(const IntVector2& offset);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetPressedOffset, ПАРАМЕТРЫ = const IntVector2& offset
    // C++
    URHO3D_API void Button_SetPressedOffset(Button* nativeInstance, const IntVector2& offset)
    {
    nativeInstance->SetPressedOffset(offset);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetPressedOffset(IntPtr nativeInstance, const IntVector2& offset);



    /// Set offset to image rectangle used when pressed.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetPressedOffset(int x, int y);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetPressedOffset, ПАРАМЕТРЫ = int x, int y
    // C++
    URHO3D_API void Button_SetPressedOffset(Button* nativeInstance, int x, int y)
    {
    nativeInstance->SetPressedOffset(x, y);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetPressedOffset(IntPtr nativeInstance, int x, int y);



    /// Set offset to image rectangle used when disabled.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetDisabledOffset(const IntVector2& offset);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetDisabledOffset, ПАРАМЕТРЫ = const IntVector2& offset
    // C++
    URHO3D_API void Button_SetDisabledOffset(Button* nativeInstance, const IntVector2& offset)
    {
    nativeInstance->SetDisabledOffset(offset);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetDisabledOffset(IntPtr nativeInstance, const IntVector2& offset);



    /// Set offset to image rectangle used when disabled.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetDisabledOffset(int x, int y);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetDisabledOffset, ПАРАМЕТРЫ = int x, int y
    // C++
    URHO3D_API void Button_SetDisabledOffset(Button* nativeInstance, int x, int y)
    {
    nativeInstance->SetDisabledOffset(x, y);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetDisabledOffset(IntPtr nativeInstance, int x, int y);



    /// Set offset of child elements when pressed.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetPressedChildOffset(const IntVector2& offset);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetPressedChildOffset, ПАРАМЕТРЫ = const IntVector2& offset
    // C++
    URHO3D_API void Button_SetPressedChildOffset(Button* nativeInstance, const IntVector2& offset)
    {
    nativeInstance->SetPressedChildOffset(offset);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetPressedChildOffset(IntPtr nativeInstance, const IntVector2& offset);



    /// Set offset of child elements when pressed.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetPressedChildOffset(int x, int y);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetPressedChildOffset, ПАРАМЕТРЫ = int x, int y
    // C++
    URHO3D_API void Button_SetPressedChildOffset(Button* nativeInstance, int x, int y)
    {
    nativeInstance->SetPressedChildOffset(x, y);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetPressedChildOffset(IntPtr nativeInstance, int x, int y);



    /// Set repeat properties. Rate 0 (default) disables repeat.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetRepeat(float delay, float rate);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetRepeat, ПАРАМЕТРЫ = float delay, float rate
    // C++
    URHO3D_API void Button_SetRepeat(Button* nativeInstance, float delay, float rate)
    {
    nativeInstance->SetRepeat(delay, rate);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetRepeat(IntPtr nativeInstance, float delay, float rate);



    /// Set repeat delay.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetRepeatDelay(float delay);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetRepeatDelay, ПАРАМЕТРЫ = float delay
    // C++
    URHO3D_API void Button_SetRepeatDelay(Button* nativeInstance, float delay)
    {
    nativeInstance->SetRepeatDelay(delay);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetRepeatDelay(IntPtr nativeInstance, float delay);



    /// Set repeat rate.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetRepeatRate(float rate);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetRepeatRate, ПАРАМЕТРЫ = float rate
    // C++
    URHO3D_API void Button_SetRepeatRate(Button* nativeInstance, float rate)
    {
    nativeInstance->SetRepeatRate(rate);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetRepeatRate(IntPtr nativeInstance, float rate);




    /// Return pressed image offset.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // const IntVector2& GetPressedOffset() const { return pressedOffset_; }
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = const IntVector2&, ИМЯ = GetPressedOffset, ПАРАМЕТРЫ =
    // C++
    URHO3D_API const IntVector2& Button_GetPressedOffset(Button* nativeInstance)
    {
    return nativeInstance->GetPressedOffset();
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern const IntVector2& Button_GetPressedOffset(IntPtr nativeInstance);




    /// Return disabled image offset.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // const IntVector2& GetDisabledOffset() const { return disabledOffset_; }
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = const IntVector2&, ИМЯ = GetDisabledOffset, ПАРАМЕТРЫ =
    // C++
    URHO3D_API const IntVector2& Button_GetDisabledOffset(Button* nativeInstance)
    {
    return nativeInstance->GetDisabledOffset();
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern const IntVector2& Button_GetDisabledOffset(IntPtr nativeInstance);




    /// Return offset of child elements when pressed.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // const IntVector2& GetPressedChildOffset() const { return pressedChildOffset_; }
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = const IntVector2&, ИМЯ = GetPressedChildOffset, ПАРАМЕТРЫ =
    // C++
    URHO3D_API const IntVector2& Button_GetPressedChildOffset(Button* nativeInstance)
    {
    return nativeInstance->GetPressedChildOffset();
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern const IntVector2& Button_GetPressedChildOffset(IntPtr nativeInstance);




    /// Return repeat delay.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // float GetRepeatDelay() const { return repeatDelay_; }
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = float, ИМЯ = GetRepeatDelay, ПАРАМЕТРЫ =
    // C++
    URHO3D_API float Button_GetRepeatDelay(Button* nativeInstance)
    {
    return nativeInstance->GetRepeatDelay();
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern float Button_GetRepeatDelay(IntPtr nativeInstance);




    /// Return repeat rate.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // float GetRepeatRate() const { return repeatRate_; }
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = float, ИМЯ = GetRepeatRate, ПАРАМЕТРЫ =
    // C++
    URHO3D_API float Button_GetRepeatRate(Button* nativeInstance)
    {
    return nativeInstance->GetRepeatRate();
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern float Button_GetRepeatRate(IntPtr nativeInstance);




    /// Return whether is currently pressed.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // bool IsPressed() const { return pressed_; }
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = bool, ИМЯ = IsPressed, ПАРАМЕТРЫ =
    // C++
    URHO3D_API bool Button_IsPressed(Button* nativeInstance)
    {
    return nativeInstance->IsPressed();
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern bool Button_IsPressed(IntPtr nativeInstance);




    protected:
    /// Set new pressed state.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // void SetPressed(bool enable);
    // КЛАСС = Button, ВОЗВРАЩАЕМЫЙ ТИП = void, ИМЯ = SetPressed, ПАРАМЕТРЫ = bool enable
    // C++
    URHO3D_API void Button_SetPressed(Button* nativeInstance, bool enable)
    {
    nativeInstance->SetPressed(enable);
    }
    // C#
    [DllImport(Consts.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
    private static extern void Button_SetPressed(IntPtr nativeInstance, bool enable);




    /// Pressed image offset.
    IntVector2 pressedOffset_;
    /// Disabled image offset.
    IntVector2 disabledOffset_;
    /// Pressed label offset.
    IntVector2 pressedChildOffset_;
    /// Repeat delay.
    float repeatDelay_;
    /// Repeat rate.
    float repeatRate_;
    /// Repeat timer.
    float repeatTimer_;
    /// Current pressed state.
    bool pressed_;
    };

    }