STR $1099: The Quartz version of FLTK now draws a very nice resize

control in the lower right corner of top-level windows if that 
window is resizable. The color of the control adapts to the 
background color of the window.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4711 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2005-12-14 13:51:51 +00:00
parent 31d3e28bba
commit e3883f0384
3 changed files with 29 additions and 2 deletions

View File

@ -3,6 +3,8 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #571, STR #648, STR #692, STR
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
STR #969)
- OS X Quartz version now draw a nice resize control (STR
#1099)
- FLTK now enables large file support when available (STR
#1087)
- Fl_Clock_Output depended on a time value that was the

View File

@ -35,6 +35,10 @@
#include <stdlib.h>
#include "flstring.h"
#ifdef __APPLE_QUARTZ__
#include <FL/fl_draw.h>
#endif
void Fl_Window::_Fl_Window() {
type(FL_WINDOW);
box(FL_FLAT_BOX);
@ -102,6 +106,26 @@ void Fl_Window::draw() {
// Make sure we don't draw the window title in the window background...
Fl_Widget::label(0);
Fl_Group::draw();
#ifdef __APPLE_QUARTZ__
if (!parent() && resizable()) {
int dx = Fl::box_dw(box())-Fl::box_dx(box());
int dy = Fl::box_dh(box())-Fl::box_dy(box());
if (dx<=0) dx = 1;
if (dy<=0) dy = 1;
int x1 = w()-dx-1, x2 = x1, y1 = h()-dx-1, y2 = y1;
Fl_Color c[4] = {
color(),
fl_color_average(color(), FL_WHITE, 0.7f),
fl_color_average(color(), FL_BLACK, 0.6f),
fl_color_average(color(), FL_BLACK, 0.8f),
};
int i;
for (i=dx; i<12; i++) {
fl_color(c[i&3]);
fl_line(x1--, y1, x2, y2--);
}
}
#endif
// Restore the label...
Fl_Widget::label(savelabel);
set_flag(saveflags);

View File

@ -240,8 +240,7 @@ void fl_line(int x, int y, int x1, int y1) {
MoveTo(x, y);
LineTo(x1, y1);
#elif defined(__APPLE_QUARTZ__)
if (( x==x1 || y==y1 ) && fl_quartz_line_width_!=1.0f )
CGContextSetShouldAntialias(fl_gc, false);
if (fl_quartz_line_width_==1.0f ) CGContextSetShouldAntialias(fl_gc, false);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x1, y1);
CGContextStrokePath(fl_gc);
@ -264,10 +263,12 @@ void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
LineTo(x1, y1);
LineTo(x2, y2);
#elif defined(__APPLE_QUARTZ__)
if (fl_quartz_line_width_==1.0f ) CGContextSetShouldAntialias(fl_gc, false);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x1, y1);
CGContextAddLineToPoint(fl_gc, x2, y2);
CGContextStrokePath(fl_gc);
if (fl_quartz_line_width_==1.0f ) CGContextSetShouldAntialias(fl_gc, true);
#else
XPoint p[3];
p[0].x = x; p[0].y = y;