2016-03-10 10:18:12 +00:00
|
|
|
//
|
|
|
|
|
// Definition of Apple Cocoa Screen interface
|
|
|
|
|
// for the Fast Light Tool Kit (FLTK).
|
|
|
|
|
//
|
2018-02-09 13:48:22 +00:00
|
|
|
// Copyright 2010-2018 by Bill Spitzak and others.
|
2016-03-10 10:18:12 +00:00
|
|
|
//
|
|
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
|
//
|
2020-07-01 16:03:10 +00:00
|
|
|
// https://www.fltk.org/COPYING.php
|
2016-03-10 10:18:12 +00:00
|
|
|
//
|
2020-07-01 16:03:10 +00:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2016-03-10 10:18:12 +00:00
|
|
|
//
|
2020-07-01 16:03:10 +00:00
|
|
|
// https://www.fltk.org/bugs.php
|
2016-03-10 10:18:12 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
/**
|
2016-03-21 22:51:23 +00:00
|
|
|
\file Fl_Cocoa_Screen_Driver.H
|
2016-03-10 10:18:12 +00:00
|
|
|
\brief Definition of Apple Cocoa Screen interface.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef FL_COCOA_SCREEN_DRIVER_H
|
|
|
|
|
#define FL_COCOA_SCREEN_DRIVER_H
|
|
|
|
|
|
2018-06-26 14:04:09 +00:00
|
|
|
#include "../../Fl_Screen_Driver.H"
|
2016-03-10 10:18:12 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Move everything here that manages the native screen interface.
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2016-03-10 10:18:12 +00:00
|
|
|
There is exactly one screen driver in the system.
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2016-03-10 10:18:12 +00:00
|
|
|
- screen configuration and sizes
|
|
|
|
|
- multiple screens
|
|
|
|
|
- native dialog boxes
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Fl_Window;
|
2016-04-06 19:39:15 +00:00
|
|
|
class Fl_Input;
|
2018-02-09 13:48:22 +00:00
|
|
|
class Fl_RGB_Image;
|
2020-01-11 13:51:30 +00:00
|
|
|
#ifdef __OBJC__
|
|
|
|
|
@class NSImage;
|
|
|
|
|
#else
|
|
|
|
|
class NSImage;
|
|
|
|
|
#endif
|
2016-03-10 10:18:12 +00:00
|
|
|
|
2020-07-01 16:03:10 +00:00
|
|
|
class FL_EXPORT Fl_Cocoa_Screen_Driver : public Fl_Screen_Driver
|
2016-03-10 10:18:12 +00:00
|
|
|
{
|
|
|
|
|
protected:
|
2016-03-29 19:52:51 +00:00
|
|
|
struct XRectangle {int x, y, width, height;};
|
2016-03-10 10:18:12 +00:00
|
|
|
XRectangle screens[MAX_SCREENS];
|
|
|
|
|
float dpi_h[MAX_SCREENS];
|
|
|
|
|
float dpi_v[MAX_SCREENS];
|
2016-03-31 19:23:38 +00:00
|
|
|
static int insertion_point_x;
|
|
|
|
|
static int insertion_point_y;
|
|
|
|
|
static int insertion_point_height;
|
|
|
|
|
static bool insertion_point_location_is_valid;
|
2016-03-10 10:18:12 +00:00
|
|
|
public:
|
2020-01-11 13:51:30 +00:00
|
|
|
NSImage *default_icon;
|
2016-04-01 14:49:29 +00:00
|
|
|
Fl_Cocoa_Screen_Driver();
|
2016-04-02 09:34:17 +00:00
|
|
|
static int next_marked_length; // next length of marked text after current marked text will have been replaced
|
2018-05-12 16:44:31 +00:00
|
|
|
static void breakMacEventLoop();
|
2016-03-10 10:18:12 +00:00
|
|
|
// --- display management
|
|
|
|
|
// --- screen configuration
|
|
|
|
|
virtual void init();
|
|
|
|
|
virtual int x();
|
|
|
|
|
virtual int y();
|
|
|
|
|
virtual int w();
|
|
|
|
|
virtual int h();
|
|
|
|
|
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n);
|
|
|
|
|
virtual void screen_dpi(float &h, float &v, int n=0);
|
2016-04-15 11:30:10 +00:00
|
|
|
// implemented in Fl_cocoa.mm because uses Objective-c
|
2016-03-10 10:18:12 +00:00
|
|
|
virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n);
|
|
|
|
|
// --- audible output
|
|
|
|
|
virtual void beep(int type);
|
|
|
|
|
// --- global events
|
|
|
|
|
virtual double wait(double time_to_wait);
|
|
|
|
|
virtual int ready();
|
|
|
|
|
virtual void grab(Fl_Window* win);
|
|
|
|
|
// --- global colors
|
|
|
|
|
virtual void get_system_colors();
|
|
|
|
|
// --- global timers
|
|
|
|
|
virtual void add_timeout(double time, Fl_Timeout_Handler cb, void *argp);
|
|
|
|
|
virtual void repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp);
|
|
|
|
|
virtual int has_timeout(Fl_Timeout_Handler cb, void *argp);
|
|
|
|
|
virtual void remove_timeout(Fl_Timeout_Handler cb, void *argp);
|
2016-03-31 17:25:18 +00:00
|
|
|
virtual int has_marked_text();
|
|
|
|
|
virtual void reset_marked_text();
|
|
|
|
|
virtual void insertion_point_location(int x, int y, int height);
|
2016-03-31 19:23:38 +00:00
|
|
|
int insertion_point_location(int *px, int *py, int *pheight);
|
2016-03-31 19:55:03 +00:00
|
|
|
virtual int dnd(int use_selection);
|
|
|
|
|
virtual int compose(int &del);
|
2016-04-06 19:39:15 +00:00
|
|
|
virtual int input_widget_handle_key(int key, unsigned mods, unsigned shift, Fl_Input *input);
|
2017-06-17 06:53:44 +00:00
|
|
|
virtual int get_mouse(int &x, int &y);
|
2016-04-15 15:12:22 +00:00
|
|
|
virtual void enable_im();
|
|
|
|
|
virtual void disable_im();
|
2017-06-01 14:05:47 +00:00
|
|
|
virtual void open_display_platform();
|
2016-12-14 18:54:12 +00:00
|
|
|
// --- compute dimensions of an Fl_Offscreen
|
|
|
|
|
virtual void offscreen_size(Fl_Offscreen o, int &width, int &height);
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2017-12-18 08:52:55 +00:00
|
|
|
virtual APP_SCALING_CAPABILITY rescalable() { return SYSTEMWIDE_APP_SCALING; }
|
|
|
|
|
virtual float scale(int n) {return scale_;}
|
|
|
|
|
virtual void scale(int n, float f) { scale_ = f;}
|
2019-08-21 10:01:01 +00:00
|
|
|
virtual Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win, bool may_capture_subwins, bool *did_capture_subwins);
|
2020-01-11 13:51:30 +00:00
|
|
|
virtual void default_icons(const Fl_RGB_Image *icons[], int count);
|
2017-12-18 08:52:55 +00:00
|
|
|
private:
|
|
|
|
|
float scale_;
|
2016-03-10 10:18:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // FL_COCOA_SCREEN_DRIVER_H
|