> > > On 25 Mar 2008, at 18:38, Dmitry wrote:
> > >
> > > >
> > > >>> I need to disable dotted square when pressing Fl_Button, how
> > > >>> can I do it?
> > > >>
..

I make this little hack to Fl_Widget.cxx before compiling,
so instead of a square box i get a little triangle, made of 3 points
(it works both in linux and win32):

// draw a focus box for the widget...
void
Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
  if (!Fl::visible_focus()) return;
  switch (B) {
    case FL_DOWN_BOX:
    case FL_DOWN_FRAME:
    case FL_THIN_DOWN_BOX:
    case FL_THIN_DOWN_FRAME:
      X ++;
      Y ++;
    default:
      break;
  }

  fl_color(fl_contrast(FL_BLACK, color()));

// ### Added this 3 lines:
fl_point(X + Fl::box_dx(B)+1, Y + Fl::box_dy(B)+1);
fl_point(X + Fl::box_dx(B)+1, Y + Fl::box_dy(B)+2);
fl_point(X + Fl::box_dx(B)+2, Y + Fl::box_dy(B)+1);

/* ### Commented until #endif:
#if defined(WIN32) || defined(__APPLE_QD__)
  // Windows 95/98/ME do not implement the dotted line style, so draw
  // every other pixel around the focus area...
  //
  // Also, QuickDraw (MacOS) does not support line styles specifically,
  // and the hack we use in fl_line_style() will not draw horizontal lines
  // on odd-numbered rows...
  int i, xx, yy;

  X += Fl::box_dx(B);
  Y += Fl::box_dy(B);
  W -= Fl::box_dw(B) + 2;
  H -= Fl::box_dh(B) + 2;

  for (xx = 0, i = 1; xx < W; xx ++, i ++) if (i & 1) fl_point(X + xx, Y);
  for (yy = 0; yy < H; yy ++, i ++) if (i & 1) fl_point(X + W, Y + yy);
  for (xx = W; xx > 0; xx --, i ++) if (i & 1) fl_point(X + xx, Y + H);
  for (yy = H; yy > 0; yy --, i ++) if (i & 1) fl_point(X, Y + yy);
#else
  fl_line_style(FL_DOT);
  fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B),
          W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1);
  fl_line_style(FL_SOLID);
#endif // WIN32
*/
}

bye, Rogx.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to