FLTK 1.4.0
Loading...
Searching...
No Matches
platform.H
1//
2// Platform header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2023 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17// These are FLTK symbols that are necessary or useful for calling
18// platform specific functions. This file #include's certain platform
19// specific system header files that are necessary to declare platform
20// specific FLTK functions, for instance "Windows.h" under Windows.
21
22// You should include this file if (and ONLY if) you need to call
23// platform specific functions directly.
24
25// See FLTK documentation: chapter "Operating System Issues" on when
26// you need to #include <FL/platform.H>
27
28#if !defined(FL_PLATFORM_H) && !defined(FL_DOXYGEN)
29# define FL_PLATFORM_H
30
31# include <FL/Fl_Export.H>
32# include <FL/platform_types.h> // will bring in FL/fl_config.h
33# include <FL/fl_types.h> // for uchar
34class Fl_Window;
35
36# ifdef _WIN32
37# include "win32.H"
38# elif defined(FLTK_USE_WAYLAND)
39# include "wayland.H"
40# elif defined(FLTK_USE_X11)
41# include "x11.H"
42# elif defined(__APPLE__)
43# include "mac.H"
44# endif // _WIN32
45
46//
47// cross-platform declarations
48//
49#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
50# include <FL/Fl_Window.H>
51
52class FL_EXPORT Fl_X {
53public:
54 fl_uintptr_t xid;
55 Fl_Window* w;
56 Fl_Region region;
57 Fl_X *next;
58 // static variables, static functions and member functions
59 static Fl_X* first;
60 static Fl_X* flx(const Fl_Window* w) {return w ? (Fl_X*)w->flx_ : 0;}
61# if defined(FLTK_USE_X11) && FLTK_USE_X11 // for backward compatibility
62 static void make_xid(Fl_Window*, XVisualInfo* =fl_visual, Colormap=fl_colormap);
63 static Fl_X* set_xid(Fl_Window*, Window);
64 static inline Fl_X* i(const Fl_Window* w) {return flx(w);}
65# endif
66};
67
68inline Window fl_xid(const Fl_Window* w) { Fl_X *xTemp = Fl_X::flx(w); return xTemp ? (Window)xTemp->xid : 0; }
69#else
70extern FL_EXPORT Window fl_xid_(const Fl_Window* w);
71# define fl_xid(w) fl_xid_(w)
72#endif // FL_LIBRARY || FL_INTERNALS
73
74extern FL_EXPORT Fl_Window* fl_find(Window xid);
75extern FL_EXPORT void fl_open_display();
76extern FL_EXPORT void fl_close_display();
77extern FL_EXPORT Window fl_window;
78extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
79extern FL_EXPORT void fl_open_callback(void (*)(const char *));
80
81#endif // !FL_PLATFORM_H
Fl_Window * fl_find(Window xid)
Returns the Fl_Window that corresponds to the given window reference, or NULL if not found.
Definition Fl.cxx:705
void fl_open_display()
Opens the display.
Definition Fl.cxx:2170
Fl_Window widget .
int fl_parse_color(const char *p, uchar &r, uchar &g, uchar &b)
Parse a string containing a description of a color and write r, g, and b.
Definition Fl_get_system_colors.cxx:114
This widget produces an actual window.
Definition Fl_Window.H:55
This file contains simple "C"-style type definitions.
unsigned char uchar
unsigned char
Definition fl_types.h:30
void fl_open_callback(void(*cb)(const char *))
Register a function called for each file dropped onto an application icon.
Definition Fl.cxx:2213
Mac OS X-specific symbols.
Definitions of platform-dependent types.
opaque fl_uintptr_t
An unsigned integral type large enough to store a pointer or an unsigned long value.
Definition platform_types.h:36
struct opaque * Fl_Region
Pointer to a platform-specific structure representing a collection of rectangles.
Definition platform_types.h:56
Definitions of functions specific to the Wayland platform.
Definitions of functions specific to the Windows platform.
Definitions of functions specific to the X11 platform.