/* Copyright (c) 2023 Alex Diener This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Alex Diener alex@ludobloom.com */ #ifndef __UIPopUpView_H__ #define __UIPopUpView_H__ #ifdef __cplusplus extern "C" { #endif typedef struct UIPopUpView UIPopUpView; #define UIPopUpView_superclass UIContainer #include "uitoolkit/UIContainer.h" #include "uitoolkit/UITypes.h" typedef void (* UIPopUpView_callback)(UIPopUpView * popUpView, void * context); #define UIPopUpView_ivars \ UIContainer_ivars \ \ Rect4f invokerBounds; \ UISidePreference sidePreference; \ Rect4f lastUIBounds; \ bool boundsDirty; \ Vector2f tailPosition; \ UIPopUpView_callback closeCallback; \ void * callbackContext; #define UIPopUpView_vtable(self_type) \ UIContainer_vtable(self_type) \ \ void (* setInvokerBounds)(self_type * self, Rect4f invokerBounds); \ void (* setSidePreference)(self_type * self, UISidePreference sidePreference); stemobject_declare(UIPopUpView) UIPopUpView * UIPopUpView_create(Rect4f invokerBounds, UISidePreference sidePreference, Vector2f size, bool clipContents, UIPopUpView_callback closeCallback, void * callbackContext, UIAppearance appearance); bool UIPopUpView_init(UIPopUpView * self, Rect4f invokerBounds, UISidePreference sidePreference, Vector2f size, bool clipContents, UIPopUpView_callback closeCallback, void * callbackContext, UIAppearance appearance); void UIPopUpView_dispose(UIPopUpView * self); bool UIPopUpView_hitTest(UIPopUpView * self, float x, float y, UIHitTestType type, int * outPriority, bool * outForwardNext); void UIPopUpView_hitTestList(UIPopUpView * self, float x, float y, UIHitTestType type, int priorityOffset, UIHitTestResultIO * resultIO); UIEventResponse UIPopUpView_mouseDown(UIPopUpView * self, unsigned int buttonNumber, unsigned int buttonMask, float x, float y, unsigned int modifiers, bool isFinalTarget, double referenceTime); UIEventResponse UIPopUpView_scrollWheel(UIPopUpView * self, float x, float y, int deltaX, int deltaY, unsigned int modifiers, bool isFinalTarget, double referenceTime); UIEventResponse UIPopUpView_keyDown(UIPopUpView * self, unsigned int charCode, unsigned int keyCode, unsigned int modifiers, bool isRepeat, bool isFinalTarget, double referenceTime); Rect4f UIPopUpView_getBounds(UIPopUpView * self); void UIPopUpView_draw(UIPopUpView * self, Vector2f offset, UIDrawingInterface * drawingInterface, VertexIO * vertexIO); void UIPopUpView_listRenderables(UIPopUpView * self, RenderableIO * renderableIO, int drawOrderOffset, Rect4i clipBounds); void UIPopUpView_setInvokerBounds(UIPopUpView * self, Rect4f invokerBounds); void UIPopUpView_setSidePreference(UIPopUpView * self, UISidePreference sidePreference); #ifdef __cplusplus } #endif #endif