Beispiel #1
0
gResizerBar::gResizerBar(int X,int Y,int W,int H)
	: Fl_Box(X,Y,W,H)
{
	orig_h = H;
	last_y = 0;
	min_h  = 30;
	align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
	labelfont(FL_COURIER);
	labelsize(H);
	visible_focus(0);
	box(FL_FLAT_BOX);
}
Beispiel #2
0
void
Controller_Module::take_focus ( void )
{
    bool v = visible_focus();

    if ( ! v ) 
        set_visible_focus();

    Fl_Widget::take_focus();
    
    if ( ! v )
        clear_visible_focus();
}
Beispiel #3
0
geResizerBar::geResizerBar(int X, int Y, int W, int H, int minSize, bool type)
	: Fl_Box   (X, Y, W, H), 
	  m_type   (type),
	  m_minSize(minSize),
	  m_lastPos(0),
	  m_hover  (false)
{
	if (m_type == VERTICAL) {
		m_origSize = H;
		labelsize(H);
	}
	else {
		m_origSize = W;
		labelsize(W);
	}
	align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE);
	labelfont(FL_COURIER);
	visible_focus(0);
}
Beispiel #4
0
int Int_Slider::handle(int in)
{
    const Box2i & box = frame_geom();

    switch (in)
    {
    case FL_PUSH:
    case FL_DRAG:
    {
        take_focus();

        const int size = handle_size();

        const double v = (
                             Fl::event_x() - box.x - ((size - 1) / 2) +
                             ((box.w - size - 1) / static_cast<double>(max() - min()) / 2)) /
                         static_cast<double>(box.w - size - 1);

        set(min() + static_cast<int>(v * (max() - min())));
    }

    return 1;

    case FL_KEYBOARD:
        if (! Fl::event_state(FL_SHIFT | FL_CTRL | FL_ALT))
        {
            switch (Fl::event_key())
            {
            case FL_Home:
                min_action();
                return 1;

            case FL_End:
                max_action();
                return 1;

            case FL_Left:
            case FL_Down:
                dec_small_action();
                return 1;

            case FL_Right:
            case FL_Up:
                inc_small_action();
                return 1;

            case FL_Page_Down:
                dec_large_action();
                return 1;

            case FL_Page_Up:
                inc_large_action();
                return 1;
            }
        }

        break;
    }

    if (Abstract_Int_Input::handle(in, visible_focus()))
    {
        return 1;
    }

    return Abstract_Slider::handle(in);
}