URI:
       window.h - ltk - GUI toolkit for X11 (WIP)
  HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/git/ltk.git (encrypted, but very slow)
  HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/ltk.git (over tor)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       window.h (3299B)
       ---
            1 /*
            2  * Copyright (c) 2020-2026 lumidify <nobody@lumidify.org>
            3  *
            4  * Permission to use, copy, modify, and/or distribute this software for any
            5  * purpose with or without fee is hereby granted, provided that the above
            6  * copyright notice and this permission notice appear in all copies.
            7  *
            8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
            9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
           10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
           11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
           12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
           13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
           14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
           15  */
           16 
           17 #ifndef LTK_WINDOW_H
           18 #define LTK_WINDOW_H
           19 
           20 #include <stddef.h>
           21 #include "event.h"
           22 #include "graphics.h"
           23 #include "rect.h"
           24 #include "surface_cache.h"
           25 #include "widget.h"
           26 
           27 #define LTK_WINDOW_SIGNAL_CLOSE -1
           28 #define LTK_WINDOW_SIGNAL_INVALID -2
           29 
           30 typedef struct ltk_window {
           31         ltk_widget widget;
           32         ltk_renderwindow *renderwindow;
           33         ltk_surface_cache *surface_cache;
           34         ltk_surface *surface;
           35         /* FIXME: check if these are reset properly if widget is deleted */
           36         ltk_widget_id root_widget;
           37         ltk_widget_id hover_widget;
           38         ltk_widget_id active_widget;
           39         ltk_widget_id pressed_widget;
           40 
           41         ltk_rect rect;
           42         ltk_rect dirty_rect;
           43         ltk_array(widget_id) *popups;
           44         /* This is a hack so ltk_window_unregister_all_popups can
           45            call hide for all popup widgets even if the hide function
           46            already calls ltk_window_unregister_popup */
           47         char popups_locked;
           48 } ltk_window;
           49 
           50 /* FIXME: which of these should be internal to LTK? */
           51 /* FIXME: should this maybe still take ltk_window directly? */
           52 void ltk_window_handle_event(ltk_widget_id windowid, ltk_event *event);
           53 void ltk_window_fake_motion_event(ltk_widget_id window, int x, int y);
           54 
           55 /* FIXME: should there be versions that directly take window and widget instead of IDs?
           56    -> I guess for invalidate_widget_rect, it doesn't really change much efficiency-wise
           57       since getting the absolute widget rect goes through the parent hierarchy and needs
           58       to look up all the widgets on the path anyways */
           59 void ltk_window_invalidate_rect(ltk_widget_id window, ltk_rect rect);
           60 void ltk_window_invalidate_widget_rect(ltk_widget_id window, ltk_widget_id widget);
           61 
           62 void ltk_window_set_root_widget(ltk_widget_id window, ltk_widget_id widget);
           63 void ltk_window_set_hover_widget(ltk_widget_id window, ltk_widget_id widget, ltk_motion_event *event);
           64 void ltk_window_set_active_widget(ltk_widget_id window, ltk_widget_id widget);
           65 void ltk_window_set_pressed_widget(ltk_widget_id window, ltk_widget_id widget, int release);
           66 
           67 /* IMPORTANT: Callers must call ltk_widget_recalc_ideal_size and ltk_widget_resize
           68    first to take DPI changes into account. It wouldn't make sense for ltk_window_register_popup
           69    to call these functions because the calling function usually needs to know the actual size
           70    of the popup to determine where to place it. */
           71 void ltk_window_register_popup(ltk_widget_id window, ltk_widget_id popup);
           72 void ltk_window_unregister_popup(ltk_widget_id window, ltk_widget_id popup);
           73 void ltk_window_unregister_all_popups(ltk_widget_id window);
           74 
           75 #endif  /* LTK_WINDOW_H */