mirror of https://github.com/fltk/fltk
Begin to remove platform-dependent code from the Fl.H header file.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11482 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
62f9813e4e
commit
059664e7d4
9
FL/Fl.H
9
FL/Fl.H
|
@ -207,17 +207,8 @@ public: // should be private!
|
|||
static Fl_Window* grab_;
|
||||
static int compose_state; // used for dead keys (WIN32) or marked text (MacOS)
|
||||
static void call_screen_init(); // recompute screen number and dimensions
|
||||
#ifdef __APPLE__ // PORTME: add for all platforms - additional functions
|
||||
static void reset_marked_text(); // resets marked text
|
||||
static void insertion_point_location(int x, int y, int height); // sets window coordinates & height of insertion point
|
||||
#elif defined(WIN32)
|
||||
// not needed in WIN32
|
||||
#elif defined(FL_PORTING)
|
||||
# pragma message "FL_PORTING: add these functions to all platforms?"
|
||||
// no default implementation
|
||||
#else
|
||||
// not needed in X11
|
||||
#endif
|
||||
#endif // FL_DOXYGEN
|
||||
|
||||
|
||||
|
|
|
@ -120,6 +120,13 @@ public:
|
|||
virtual unsigned utf8from_mb(char* dst, unsigned dstlen, const char* src, unsigned srclen);
|
||||
// implement to shield fprintf() from locale changes in decimal point
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
/* 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) {}
|
||||
};
|
||||
|
||||
#endif // FL_SYSTEM_DRIVER_H
|
||||
|
|
|
@ -1882,6 +1882,14 @@ int Fl::dnd()
|
|||
return Fl_System_Driver::driver()->dnd();
|
||||
}
|
||||
|
||||
void Fl::reset_marked_text() {
|
||||
Fl_System_Driver::driver()->reset_marked_text();
|
||||
}
|
||||
|
||||
void Fl::insertion_point_location(int x, int y, int height) { // sets window coordinates & height of insertion point
|
||||
Fl_System_Driver::driver()->insertion_point_location(x, y, height);
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
|
|
@ -599,14 +599,12 @@ int Fl_Input::handle(int event) {
|
|||
static int dnd_save_position, dnd_save_mark, drag_start = -1, newpos;
|
||||
static Fl_Widget *dnd_save_focus = NULL;
|
||||
switch (event) {
|
||||
#ifdef __APPLE__ // PORTME: compose text
|
||||
case FL_UNFOCUS:
|
||||
if (Fl::compose_state) {
|
||||
if (Fl_System_Driver::driver()->has_marked_text() && Fl::compose_state) {
|
||||
this->mark( this->position() );
|
||||
Fl::reset_marked_text();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case FL_FOCUS:
|
||||
switch (Fl::event_key()) {
|
||||
case FL_Right:
|
||||
|
|
|
@ -395,9 +395,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
|
|||
} else {
|
||||
fl_rectf((int)(xpos+curx+0.5), Y+ypos, 2, height);
|
||||
}
|
||||
#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - compose
|
||||
Fl::insertion_point_location(xpos+curx, Y+ypos+height, height);
|
||||
#endif
|
||||
}
|
||||
|
||||
CONTINUE:
|
||||
|
|
|
@ -2303,9 +2303,7 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) {
|
|||
if ( X < text_area.x - 1 || X > text_area.x + text_area.w )
|
||||
return;
|
||||
|
||||
#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose
|
||||
Fl::insertion_point_location(X, bot, fontHeight);
|
||||
#endif
|
||||
/* For cursors other than the block, make them around 2/3 of a character
|
||||
width, rounded to an even number of pixels so that X will draw an
|
||||
odd number centered on the stem at x. */
|
||||
|
|
|
@ -586,13 +586,11 @@ int Fl_Text_Editor::handle(int event) {
|
|||
|
||||
case FL_UNFOCUS:
|
||||
show_cursor(mCursorOn); // redraws the cursor
|
||||
#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose
|
||||
if (buffer()->selected() && Fl::compose_state) {
|
||||
if (Fl_System_Driver::driver()->has_marked_text() && buffer()->selected() && Fl::compose_state) {
|
||||
int pos = insert_position();
|
||||
buffer()->select(pos, pos);
|
||||
Fl::reset_marked_text();
|
||||
}
|
||||
#endif
|
||||
if (buffer()->selected()) redraw(); // Redraw selections...
|
||||
case FL_HIDE:
|
||||
if (when() & FL_WHEN_RELEASE) maybe_do_callback();
|
||||
|
|
|
@ -64,6 +64,9 @@ public:
|
|||
virtual int rmdir(const char* f) {return ::rmdir(f);}
|
||||
virtual int rename(const char* f, const char *n) {return ::rename(f, n);}
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
virtual int has_marked_text();
|
||||
virtual void reset_marked_text();
|
||||
virtual void insertion_point_location(int x, int y, int height);
|
||||
};
|
||||
|
||||
#endif // FL_DARWIN_SYSTEM_DRIVER_H
|
||||
|
|
|
@ -64,7 +64,11 @@ static int insertion_point_y = 0;
|
|||
static int insertion_point_height = 0;
|
||||
static bool insertion_point_location_is_valid = false;
|
||||
|
||||
void Fl::reset_marked_text() {
|
||||
int Fl_Darwin_System_Driver::has_marked_text() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Fl_Darwin_System_Driver::reset_marked_text() {
|
||||
Fl::compose_state = 0;
|
||||
Fl_X::next_marked_length = 0;
|
||||
insertion_point_location_is_valid = false;
|
||||
|
@ -80,7 +84,7 @@ int Fl_X::insertion_point_location(int *px, int *py, int *pheight)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Fl::insertion_point_location(int x, int y, int height) {
|
||||
void Fl_Darwin_System_Driver::insertion_point_location(int x, int y, int height) {
|
||||
insertion_point_location_is_valid = true;
|
||||
insertion_point_x = x;
|
||||
insertion_point_y = y;
|
||||
|
|
Loading…
Reference in New Issue