| @@ -494,6 +494,8 @@ enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C): | |||||
| _FL_OVAL_FRAME, ///< see figure 1 | _FL_OVAL_FRAME, ///< see figure 1 | ||||
| _FL_OFLAT_BOX, ///< see figure 1 | _FL_OFLAT_BOX, ///< see figure 1 | ||||
| FL_FOCUS_FRAME, | FL_FOCUS_FRAME, | ||||
| _FL_ASYM_BOX, | |||||
| _FL_ASYM_FLAT_BOX, | |||||
| FL_FREE_BOXTYPE ///< the first free box type for creation of new box types | FL_FREE_BOXTYPE ///< the first free box type for creation of new box types | ||||
| }; | }; | ||||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX(); | extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX(); | ||||
| @@ -518,6 +520,10 @@ extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX(); | |||||
| #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2) | #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2) | ||||
| #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3) | #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3) | ||||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_ASYM_BOX(); | |||||
| #define FL_ASYM_BOX fl_define_FL_ASYM_BOX() | |||||
| #define FL_ASYM_FLAT_BOX (Fl_Boxtype)(fl_define_FL_ASYM_BOX()+1) | |||||
| #define FL_PLASTIC_UP_BOX FL_UP_BOX | #define FL_PLASTIC_UP_BOX FL_UP_BOX | ||||
| #define FL_PLASTIC_DOWN_BOX FL_DOWN_BOX | #define FL_PLASTIC_DOWN_BOX FL_DOWN_BOX | ||||
| #define FL_PLASTIC_UP_FRAME FL_UP_FRAME | #define FL_PLASTIC_UP_FRAME FL_UP_FRAME | ||||
| @@ -1,4 +1,3 @@ | |||||
| // | |||||
| // "$Id: fl_boxtype.cxx 7903 2010-11-28 21:06:39Z matt $" | // "$Id: fl_boxtype.cxx 7903 2010-11-28 21:06:39Z matt $" | ||||
| // | // | ||||
| // Box drawing code for the Fast Light Tool Kit (FLTK). | // Box drawing code for the Fast Light Tool Kit (FLTK). | ||||
| @@ -316,6 +315,8 @@ static struct { | |||||
| {fl_border_frame, 1,1,2,2,0}, // _FL_OVAL_FRAME | {fl_border_frame, 1,1,2,2,0}, // _FL_OVAL_FRAME | ||||
| {fl_rectf, 0,0,0,0,0}, // _FL_OVAL_FLAT_BOX, | {fl_rectf, 0,0,0,0,0}, // _FL_OVAL_FLAT_BOX, | ||||
| {fl_focus_frame, 1,1,1,1,1}, // FL_FOCUS_FRAME | {fl_focus_frame, 1,1,1,1,1}, // FL_FOCUS_FRAME | ||||
| {fl_up_box, 1,1,1,1,0}, | |||||
| {fl_border_box, 1,1,1,1,0}, | |||||
| {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+0 | {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+0 | ||||
| {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+1 | {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+1 | ||||
| {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+2 | {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+2 | ||||
| @@ -414,18 +415,22 @@ void fl_draw_box(Fl_Boxtype t, int x, int y, int w, int h, Fl_Color c) { | |||||
| /** Draws the widget box according its box style */ | /** Draws the widget box according its box style */ | ||||
| void Fl_Widget::draw_box() const { | void Fl_Widget::draw_box() const { | ||||
| if (box_) draw_box((Fl_Boxtype)box_, x_, y_, w_, h_, color_); | if (box_) draw_box((Fl_Boxtype)box_, x_, y_, w_, h_, color_); | ||||
| draw_backdrop(); | |||||
| } | } | ||||
| /** If FL_ALIGN_IMAGE_BACKDROP is set, the image or deimage will be drawn */ | /** If FL_ALIGN_IMAGE_BACKDROP is set, the image or deimage will be drawn */ | ||||
| void Fl_Widget::draw_backdrop() const { | void Fl_Widget::draw_backdrop() const { | ||||
| if (align() & FL_ALIGN_IMAGE_BACKDROP) { | |||||
| if (align() & FL_ALIGN_IMAGE_BACKDROP || | |||||
| type() >= FL_WINDOW ) { | |||||
| const Fl_Image *img = image(); | const Fl_Image *img = image(); | ||||
| // if there is no image, we will not draw the deimage either | // if there is no image, we will not draw the deimage either | ||||
| if (img && deimage() && !active_r()) | if (img && deimage() && !active_r()) | ||||
| img = deimage(); | img = deimage(); | ||||
| if (img) | if (img) | ||||
| ((Fl_Image*)img)->draw(x_+(w_-img->w())/2, y_+(h_-img->h())/2); | |||||
| } | |||||
| { | |||||
| ((Fl_Image*)img)->draw(x_+(w_-img->w())/2, y_+(h_-img->h())/2); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| /** Draws a box of type t, of color c at the widget's position and size. */ | /** Draws a box of type t, of color c at the widget's position and size. */ | ||||
| void Fl_Widget::draw_box(Fl_Boxtype t, Fl_Color c) const { | void Fl_Widget::draw_box(Fl_Boxtype t, Fl_Color c) const { | ||||
| @@ -433,8 +438,12 @@ void Fl_Widget::draw_box(Fl_Boxtype t, Fl_Color c) const { | |||||
| } | } | ||||
| /** Draws a box of type t, of color c at the position X,Y and size W,H. */ | /** Draws a box of type t, of color c at the position X,Y and size W,H. */ | ||||
| void Fl_Widget::draw_box(Fl_Boxtype t, int X, int Y, int W, int H, Fl_Color c) const { | void Fl_Widget::draw_box(Fl_Boxtype t, int X, int Y, int W, int H, Fl_Color c) const { | ||||
| if ( type() >= FL_WINDOW ) | |||||
| printf( "NTK: drawing window box\n" ); | |||||
| draw_it_active = active_r(); | draw_it_active = active_r(); | ||||
| fl_box_table[t].f(X, Y, W, H, c); | fl_box_table[t].f(X, Y, W, H, c); | ||||
| draw_backdrop(); | |||||
| draw_it_active = 1; | draw_it_active = 1; | ||||
| } | } | ||||
| @@ -34,7 +34,7 @@ | |||||
| static double offset[RN] = { 0.0, 0.07612, 0.29289, 0.61732, 1.0}; | static double offset[RN] = { 0.0, 0.07612, 0.29289, 0.61732, 1.0}; | ||||
| static void rbox(int fill, int x, int y, int w, int h) { | |||||
| static void rbox(int fill, int x, int y, int w, int h, int asym = 0 ) { | |||||
| int i; | int i; | ||||
| int rsx ,rsy, rs; | int rsx ,rsy, rs; | ||||
| rsx = w*2/5; rsy = h*2/5; | rsx = w*2/5; rsy = h*2/5; | ||||
| @@ -43,14 +43,25 @@ static void rbox(int fill, int x, int y, int w, int h) { | |||||
| rsx = rs; rsy = rs; | rsx = rs; rsy = rs; | ||||
| if (fill) fl_begin_polygon(); else fl_begin_loop(); | if (fill) fl_begin_polygon(); else fl_begin_loop(); | ||||
| for (i=0; i<RN; i++) | for (i=0; i<RN; i++) | ||||
| fl_vertex(x + offset[RN-i-1]*rsx, y + offset[i] * rsy); | |||||
| for (i=0; i<RN; i++) | |||||
| fl_vertex(x + offset[i]*rsx, y + h-1 - offset[RN-i-1] * rsy); | |||||
| for (i=0; i<RN; i++) | |||||
| fl_vertex(x + w-1 - offset[RN-i-1]*rsx, y + h-1 - offset[i] * rsy); | |||||
| fl_vertex(x + offset[RN-i-1]*rsx, y + offset[i] * rsy); | |||||
| if ( ! asym ) | |||||
| for (i=0; i<RN; i++) | |||||
| fl_vertex(x + offset[i]*rsx, y + h-1 - offset[RN-i-1] * rsy); | |||||
| else | |||||
| fl_vertex( x, y + h - 1 ); | |||||
| for (i=0; i<RN; i++) | for (i=0; i<RN; i++) | ||||
| fl_vertex(x + w-1 - offset[i]*rsx, y + offset[RN-i-1] * rsy); | |||||
| fl_vertex(x + w-1 - offset[RN-i-1]*rsx, y + h-1 - offset[i] * rsy); | |||||
| if ( ! asym ) | |||||
| for (i=0; i<RN; i++) | |||||
| fl_vertex(x + w-1 - offset[i]*rsx, y + offset[RN-i-1] * rsy); | |||||
| else | |||||
| fl_vertex( x + w - 1, y ); | |||||
| if (fill) fl_end_polygon(); else fl_end_loop(); | if (fill) fl_end_polygon(); else fl_end_loop(); | ||||
| } | } | ||||
| @@ -67,6 +78,15 @@ static void fl_rounded_box(int x, int y, int w, int h, Fl_Color c) { | |||||
| fl_color(FL_BLACK); rbox(0, x, y, w, h); | fl_color(FL_BLACK); rbox(0, x, y, w, h); | ||||
| } | } | ||||
| static void fl_asym_box(int x, int y, int w, int h, Fl_Color c) { | |||||
| fl_color(c); rbox(1, x, y, w, h, 1); | |||||
| fl_color(FL_BLACK); rbox(0, x, y, w, h, 1 ); | |||||
| } | |||||
| static void fl_asym_flat_box(int x, int y, int w, int h, Fl_Color c) { | |||||
| fl_color(c); rbox(1, x, y, w, h, 1); | |||||
| } | |||||
| static void fl_rshadow_box(int x, int y, int w, int h, Fl_Color c) { | static void fl_rshadow_box(int x, int y, int w, int h, Fl_Color c) { | ||||
| // draw shadow: | // draw shadow: | ||||
| fl_color(FL_DARK3); | fl_color(FL_DARK3); | ||||
| @@ -94,6 +114,12 @@ Fl_Boxtype fl_define_FL_RSHADOW_BOX() { | |||||
| return _FL_RSHADOW_BOX; | return _FL_RSHADOW_BOX; | ||||
| } | } | ||||
| Fl_Boxtype fl_define_FL_ASYM_BOX() { | |||||
| fl_internal_boxtype(_FL_ASYM_BOX, fl_asym_box); | |||||
| fl_internal_boxtype(_FL_ASYM_FLAT_BOX, fl_asym_flat_box); | |||||
| return _FL_ASYM_BOX; | |||||
| } | |||||
| // | // | ||||
| // End of "$Id: fl_rounded_box.cxx 7903 2010-11-28 21:06:39Z matt $". | // End of "$Id: fl_rounded_box.cxx 7903 2010-11-28 21:06:39Z matt $". | ||||
| // | // | ||||
| @@ -96,8 +96,8 @@ int main(int argc, char ** argv) { | |||||
| bt("FL_DIAMOND_UP_BOX",FL_DIAMOND_UP_BOX); | bt("FL_DIAMOND_UP_BOX",FL_DIAMOND_UP_BOX); | ||||
| bt("FL_DIAMOND_DOWN_BOX",FL_DIAMOND_DOWN_BOX); | bt("FL_DIAMOND_DOWN_BOX",FL_DIAMOND_DOWN_BOX); | ||||
| bt("FL_PLASTIC_UP_BOX",FL_PLASTIC_UP_BOX); | |||||
| bt("FL_PLASTIC_DOWN_BOX",FL_PLASTIC_DOWN_BOX); | |||||
| bt("FL_ASYM_BOX",FL_ASYM_BOX); | |||||
| bt("FL_ASYM_FLAT_BOX",FL_ASYM_FLAT_BOX); | |||||
| bt("FL_PLASTIC_UP_FRAME",FL_PLASTIC_UP_FRAME); | bt("FL_PLASTIC_UP_FRAME",FL_PLASTIC_UP_FRAME); | ||||
| bt("FL_PLASTIC_DOWN_FRAME",FL_PLASTIC_DOWN_FRAME); | bt("FL_PLASTIC_DOWN_FRAME",FL_PLASTIC_DOWN_FRAME); | ||||
| bt("FL_PLASTIC_THIN_UP_BOX",FL_PLASTIC_THIN_UP_BOX); | bt("FL_PLASTIC_THIN_UP_BOX",FL_PLASTIC_THIN_UP_BOX); | ||||