2016-02-10 22:49:35 +03:00
|
|
|
//
|
|
|
|
// "$Id$"
|
|
|
|
//
|
|
|
|
// All screen related calls in a driver style class.
|
|
|
|
//
|
|
|
|
// Copyright 1998-2016 by Bill Spitzak and others.
|
|
|
|
//
|
|
|
|
// 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:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/COPYING.php
|
|
|
|
//
|
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef FL_SCREEN_DRIVER_H
|
|
|
|
#define FL_SCREEN_DRIVER_H
|
|
|
|
|
|
|
|
#include <FL/Fl_Device.H>
|
2016-04-01 13:28:03 +03:00
|
|
|
#include <FL/fl_types.h>
|
|
|
|
#include <FL/Fl.H> // for Fl_Timeout_Handler
|
2016-04-01 17:49:29 +03:00
|
|
|
#include <FL/Fl_Text_Editor.H>
|
2016-04-01 13:28:03 +03:00
|
|
|
|
2016-02-10 22:49:35 +03:00
|
|
|
|
2016-02-11 01:43:45 +03:00
|
|
|
// TODO: add text composition?
|
|
|
|
// TODO: add Fl::display
|
|
|
|
// TODO: add copy/paste, drag/drop?
|
|
|
|
// TODO: get key/get mouse?
|
|
|
|
// TODO: system colors/colormaps
|
|
|
|
// TODO: system menu?
|
|
|
|
// TODO: native filechooser
|
|
|
|
// TODO: native message boxes
|
|
|
|
// TODO: read screen to image
|
|
|
|
// TODO: application shortcuts
|
|
|
|
|
2016-02-13 19:12:57 +03:00
|
|
|
class Fl_Window;
|
2016-04-03 09:51:09 +03:00
|
|
|
class Fl_RGB_Image;
|
|
|
|
class Fl_Group;
|
2016-04-06 22:39:15 +03:00
|
|
|
class Fl_Input;
|
2016-02-13 19:12:57 +03:00
|
|
|
|
2016-04-23 09:27:31 +03:00
|
|
|
/** A base class describing the interface between FLTK and screen-related operations.
|
|
|
|
This class is only for internal use by the FLTK library.
|
|
|
|
Each supported platform implements several of the virtual methods of this class.
|
|
|
|
*/
|
2016-02-26 14:13:43 +03:00
|
|
|
class FL_EXPORT Fl_Screen_Driver {
|
2016-02-10 22:49:35 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Fl_Screen_Driver();
|
2016-02-26 16:41:48 +03:00
|
|
|
virtual ~Fl_Screen_Driver();
|
2016-02-10 22:49:35 +03:00
|
|
|
|
|
|
|
static const int MAX_SCREENS = 16;
|
|
|
|
|
2016-02-10 23:26:51 +03:00
|
|
|
int num_screens;
|
2016-02-10 22:49:35 +03:00
|
|
|
|
2016-02-13 16:17:29 +03:00
|
|
|
public:
|
|
|
|
static char bg_set;
|
|
|
|
static char bg2_set;
|
|
|
|
static char fg_set;
|
|
|
|
|
2016-02-10 22:49:35 +03:00
|
|
|
public:
|
|
|
|
static Fl_Screen_Driver *newScreenDriver();
|
2016-02-13 15:57:00 +03:00
|
|
|
// --- display management
|
|
|
|
virtual void display(const char *disp);
|
2016-02-13 19:12:57 +03:00
|
|
|
virtual int visual(int flags);
|
2016-02-11 01:43:45 +03:00
|
|
|
// --- screen configuration
|
2016-02-10 22:49:35 +03:00
|
|
|
virtual void init() = 0;
|
|
|
|
virtual int x() = 0;
|
|
|
|
virtual int y() = 0;
|
|
|
|
virtual int w() = 0;
|
|
|
|
virtual int h() = 0;
|
|
|
|
virtual int screen_count();
|
|
|
|
virtual void screen_xywh(int &X, int &Y, int &W, int &H);
|
|
|
|
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
|
|
|
|
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n) = 0;
|
|
|
|
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh);
|
|
|
|
virtual int screen_num(int x, int y);
|
|
|
|
virtual int screen_num(int x, int y, int w, int h);
|
|
|
|
virtual void screen_dpi(float &h, float &v, int n=0) = 0;
|
|
|
|
virtual void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my);
|
|
|
|
virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n) = 0;
|
|
|
|
virtual void screen_work_area(int &X, int &Y, int &W, int &H);
|
2016-02-11 01:43:45 +03:00
|
|
|
// --- audible output
|
|
|
|
virtual void beep(int type) = 0;
|
2016-02-11 03:10:49 +03:00
|
|
|
// --- global events
|
|
|
|
virtual void flush() = 0;
|
2016-02-13 19:12:57 +03:00
|
|
|
virtual double wait(double time_to_wait) = 0;
|
|
|
|
virtual int ready() = 0;
|
|
|
|
virtual void grab(Fl_Window* win) = 0;
|
2016-02-13 15:57:00 +03:00
|
|
|
// --- global colors
|
|
|
|
virtual int parse_color(const char* p, uchar& r, uchar& g, uchar& b) = 0;
|
2016-02-13 16:17:29 +03:00
|
|
|
virtual void get_system_colors() = 0;
|
2016-02-13 19:12:57 +03:00
|
|
|
virtual const char *get_system_scheme();
|
2016-03-01 03:54:21 +03:00
|
|
|
// --- global timers
|
|
|
|
virtual void add_timeout(double time, Fl_Timeout_Handler cb, void *argp) = 0;
|
|
|
|
virtual void repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) = 0;
|
|
|
|
virtual int has_timeout(Fl_Timeout_Handler cb, void *argp) = 0;
|
|
|
|
virtual void remove_timeout(Fl_Timeout_Handler cb, void *argp) = 0;
|
2016-03-31 18:57:35 +03:00
|
|
|
|
|
|
|
static int secret_input_character;
|
2016-03-31 20:25:18 +03:00
|
|
|
/* Implement to indicate whether complex text input may involve marked text.
|
|
|
|
When it does, has_marked_text returns non zero and reset_marked_text() and
|
|
|
|
insertion_point_location() must also be implemented.
|
|
|
|
*/
|
|
|
|
virtual int has_marked_text() { return 0; }
|
|
|
|
virtual void reset_marked_text() {}
|
|
|
|
virtual void insertion_point_location(int x, int y, int height) {}
|
2016-03-31 22:55:03 +03:00
|
|
|
// implement so text-editing widgets support dead keys
|
|
|
|
virtual int compose(int &del) {del = 0; return 0;}
|
|
|
|
// default implementation may be enough
|
|
|
|
virtual void compose_reset();
|
|
|
|
// implement to support drag-n-drop. use_selection = 1 means the GUI is welcome to display
|
|
|
|
// the selected text during the D&D operation
|
|
|
|
virtual int dnd(int use_selection = 0) {return 0;}
|
2016-04-01 17:49:29 +03:00
|
|
|
// null means no platform-specific key bindings for Fl_Text_Editor
|
|
|
|
Fl_Text_Editor::Key_Binding *text_editor_extra_key_bindings;
|
2016-04-01 18:37:19 +03:00
|
|
|
// default implementation may be enough
|
|
|
|
virtual int text_display_can_leak() { return 0; }
|
2016-04-02 16:22:48 +03:00
|
|
|
// an implementation which returns NULL may be enough
|
|
|
|
static struct Fl_Fontdesc *calc_fl_fonts();
|
2016-04-02 18:37:03 +03:00
|
|
|
// API to the platform-dependent Fl_Fontdesc structure
|
|
|
|
static unsigned font_desc_size();
|
|
|
|
static const char *font_name(int num);
|
|
|
|
static void font_name(int num, const char *name);
|
2016-04-03 09:51:09 +03:00
|
|
|
// read raw image from a window or an offscreen buffer
|
|
|
|
#if defined(FL_PORTING)
|
|
|
|
# pragma message "FL_PORTING: implement code to read RGB data from screen"
|
|
|
|
#endif
|
|
|
|
virtual uchar *read_image(uchar *p, int x, int y, int w, int h, int alpha);
|
|
|
|
virtual uchar *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha) {return NULL;}
|
|
|
|
static void write_image_inside(Fl_RGB_Image *to, Fl_RGB_Image *from, int to_x, int to_y);
|
|
|
|
static Fl_RGB_Image *traverse_to_gl_subwindows(Fl_Group *g, uchar *p, int x, int y, int w, int h, int alpha,
|
|
|
|
Fl_RGB_Image *full_img);
|
2016-04-06 22:39:15 +03:00
|
|
|
// optional platform-specific key handling for Fl_Input widget
|
|
|
|
// the default implementation may be enough
|
|
|
|
virtual int input_widget_handle_key(int key, unsigned mods, unsigned shift, Fl_Input *input);
|
2016-04-15 17:18:37 +03:00
|
|
|
// implement to support Fl::get_mouse()
|
|
|
|
virtual void get_mouse(int &x, int &y) {}
|
2016-04-15 18:12:22 +03:00
|
|
|
// optional methods to enable/disable input methods for complex scripts
|
|
|
|
virtual void enable_im() {}
|
|
|
|
virtual void disable_im() {}
|
2016-04-15 18:36:10 +03:00
|
|
|
// implement to open access to the display
|
|
|
|
virtual void open_display() {}
|
|
|
|
// optional method to close display access
|
|
|
|
virtual void close_display() {}
|
2016-02-10 22:49:35 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !FL_SCREEN_DRIVER_H
|
|
|
|
|
|
|
|
//
|
|
|
|
// End of "$Id$".
|
|
|
|
//
|