FLTK logo

Re: How to disable dotted square over Fl_Button

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: How to disable dotted square over Fl_Button rogx.libero Mar 25, 2008  
 
> > > 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.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.