Ejemplo n.º 1
0
        internal int WidgetFuncCallback(WidgetMessage inMessage, WidgetID inWidget, IntPtr inParam1, IntPtr inParam2)
        {
            if (!IsEnabled)
            {
                return(0);
            }

            return(HandleMessageCore(inMessage, inWidget, inParam1, inParam2));
        }
Ejemplo n.º 2
0
            static int StandardWidgetCallback(WidgetMessage inmessage, WidgetID inwidget, IntPtr inparam1, IntPtr inparam2)
            {
                try
                {
                    if (TryGetById(inwidget, out var widget) && widget is StandardWidget standardWidget)
                    {
                        return(standardWidget.HandleMessage(inmessage, inparam1, inparam2).ToInt());
                    }
                }
                finally
                {
                    if (inmessage == WidgetMessage.Destroy)
                    {
                        Unregister(inwidget);
                    }
                }

                return(0);
            }
Ejemplo n.º 3
0
 private Widget(WidgetID id)
 {
     Id     = id;
     IsRoot = WidgetsAPI.GetParentWidget(id) == id;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Low-level message handling routine.
        /// </summary>
        /// <remarks>
        /// You should generally prefer overriding <see cref="HandleMessage"/> as it provides higher-level abstraction.
        /// </remarks>
        /// <param name="message">The message.</param>
        /// <param name="widgetId">The widget ID.</param>
        /// <param name="param1">The first message parameter.</param>
        /// <param name="param2">The second message parameter.</param>
        /// <returns>1 if the message was handled; 0 otherwise.</returns>
        /// <seealso cref="HandleMessage"/>
        protected virtual int HandleMessageCore(WidgetMessage message, WidgetID widgetId, IntPtr param1, IntPtr param2)
        {
            var widget = Widget.GetOrCreate(widgetId);

            return(HandleMessage(message, widget, param1, param2).ToInt());
        }