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/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 (2930B)
       ---
            1 /*
            2  * Copyright (c) 2020-2024 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 *root_widget;
           37         ltk_widget *hover_widget;
           38         ltk_widget *active_widget;
           39         ltk_widget *pressed_widget;
           40 
           41         ltk_rect rect;
           42         ltk_rect dirty_rect;
           43         /* FIXME: generic array */
           44         ltk_widget **popups;
           45         size_t popups_num;
           46         size_t popups_alloc;
           47         /* This is a hack so ltk_window_unregister_all_popups can
           48            call hide for all popup widgets even if the hide function
           49            already calls ltk_window_unregister_popup */
           50         char popups_locked;
           51 } ltk_window;
           52 
           53 /* FIXME: which of these should be internal to LTK? */
           54 void ltk_window_handle_event(ltk_window *window, ltk_event *event);
           55 void ltk_window_fake_motion_event(ltk_window *window, int x, int y);
           56 
           57 void ltk_window_invalidate_rect(ltk_window *window, ltk_rect rect);
           58 void ltk_window_invalidate_widget_rect(ltk_window *window, ltk_widget *widget);
           59 
           60 void ltk_window_set_root_widget(ltk_window *window, ltk_widget *widget);
           61 void ltk_window_set_hover_widget(ltk_window *window, ltk_widget *widget, ltk_motion_event *event);
           62 void ltk_window_set_active_widget(ltk_window *window, ltk_widget *widget);
           63 void ltk_window_set_pressed_widget(ltk_window *window, ltk_widget *widget, int release);
           64 
           65 /* IMPORTANT: Callers must call ltk_widget_recalc_ideal_size and ltk_widget_resize
           66    first to take DPI changes into account. It wouldn't make sense for ltk_window_register_popup
           67    to call these functions because the calling function usually needs to know the actual size
           68    of the popup to determine where to place it. */
           69 void ltk_window_register_popup(ltk_window *window, ltk_widget *popup);
           70 void ltk_window_unregister_popup(ltk_window *window, ltk_widget *popup);
           71 void ltk_window_unregister_all_popups(ltk_window *window);
           72 
           73 #endif  /* LTK_WINDOW_H */