⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flv_list.cxx

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 CXX
📖 第 1 页 / 共 3 页
字号:
    get_default_style(s);	//      Get default style information    s = global_style;		//      Add global style information    rows = row_style.skip_to(R);    if (rows)	s = *rows;		//      Add row style information    if (R < 0)			//      Headers/Labels have different default    {				//  Note: we can still override at cell level	if (parent())	    s.background(parent()->color());	else	    s.background(FL_WHITE);	s.frame(FL_THIN_UP_BOX);	s.border(FLVB_NONE);	s.border_spacing(0);    }    if (R == -3)		//      If title use label information    {	s.font(label_font());	s.font_size(label_size());	s.foreground(label_color());	s.align(FL_ALIGN_CLIP);    }    if (rows && R < 0) {	rows = rows->cell_style.skip_to(0);	if (rows && R < 0)	    s = *rows;    }}Flv_FeatureFlv_List::feature(Flv_Feature v){    if (v != vfeature) {	vfeature = v;	vlast_row = vrow;	//      Redraw all!	if (DOcb(FLVEcb_FEATURE_CHANGED)) {	    vwhy_event = FLVE_FEATURE_CHANGED;	    do_callback(this, user_data());	    vwhy_event = 0;	}	damage(FL_DAMAGE_CHILD);	//      Because features are visible    }    return vfeature;}Flv_FeatureFlv_List::feature_add(Flv_Feature v){    if ((vfeature & v) != v) {	vfeature |= v;	if (DOcb(FLVEcb_FEATURE_CHANGED)) {	    vwhy_event = FLVE_FEATURE_CHANGED;	    do_callback(this, user_data());	    vwhy_event = 0;	}	damage(FL_DAMAGE_CHILD);	//      Because features are visible    }    return vfeature;}Flv_FeatureFlv_List::feature_remove(Flv_Feature v){    if ((vfeature & v) != 0) {	vfeature &= (Flv_Feature) (~v);	if (DOcb(FLVEcb_FEATURE_CHANGED)) {	    vwhy_event = FLVE_FEATURE_CHANGED;	    do_callback(this, user_data());	    vwhy_event = 0;	}	damage(FL_DAMAGE_CHILD);	//      Because features are visible    }    return vfeature;}Flv_ShowScrollbarFlv_List::has_scrollbar(Flv_ShowScrollbar v){    if (v != vhas_scrollbars) {	vhas_scrollbars = v;	damage(FL_DAMAGE_CHILD);    }    return vhas_scrollbars;}intFlv_List::edit_when(int v){    if (v != vedit_when) {	vedit_when = v;	if (vedit_when != FLV_EDIT_ALWAYS)	    end_edit();	else	    start_edit();    }    return vedit_when;}intFlv_List::bottom_row(void){    int r, rh;    int X, Y, W, H, B;    client_area(X, Y, W, H);    B = Y + H;    for (r = vtop_row; Y < B && r < vrows; r++, Y += rh)	rh = row_height(r);    if (r == vrows)	r = vrows - 1;    return r;}intFlv_List::row(int n){    int X, Y, W, H;    if (n >= vrows)	n = vrows - 1;    if (n < 0)	n = 0;    if (n != vrow) {	vrow = n;	client_area(X, Y, W, H);	update_top_row(H);	vlast_row = vrow;	if (DOcb(FLVEcb_ROW_CHANGED)) {	    vwhy_event = FLVE_ROW_CHANGED;	    do_callback(this, user_data());	    vwhy_event = 0;	}	damage(FL_DAMAGE_CHILD);    }    return vrow;}boolFlv_List::row_resizable(int r)	//      Get/Set row locked status{    Flv_Style s;    get_style(s, r);    return s.resizable();}boolFlv_List::row_resizable(bool n, int r){    row_style[r].resizable(n);    return n;}intFlv_List::row_offset(int n){    if (n > vrow_width)	n = vrow_width;    if (n < 0)	n = 0;    if (n != vrow_offset) {	vrow_offset = n;	vlast_row = vrow;	//      Make sure we draw everything	damage(FL_DAMAGE_CHILD);    }    return vrow_offset;}intFlv_List::rows(int n){    if (n >= 0 && n != vrows) {	vrows = n;	if (vrow >= vrows)	    row(vrows - 1);	if (vselect_row > vrow)	    select_start_row(vrow);	if (DOcb(FLVEcb_ROW_CHANGED)) {	    vwhy_event = FLVE_ROW_CHANGED;	    do_callback(this, user_data());	    vwhy_event = 0;	}	damage(FL_DAMAGE_CHILD);    }    return vrows;}intFlv_List::rows_per_page(int n){    if (n != vrows_per_page && n >= 0)	vrows_per_page = n;    return vrows_per_page;}boolFlv_List::row_selected(int n){    if (vselect_row < vrow)	return (vselect_row <= n && n <= vrow);    else	return (vrow <= n && n <= vselect_row);}intFlv_List::row_width(int n){    if (n >= 0 && n != vrow_width) {	vrow_width = n;	damage(FL_DAMAGE_CHILD);    }    return vrow_width;}intFlv_List::scrollbar_width(int n){    if (n != vscrollbar_width && n > 0) {	vscrollbar_width = n;	damage(FL_DAMAGE_CHILD);    }    return vscrollbar_width;}intFlv_List::select_start_row(int n)	//      Set first selected row{    if (n >= vrows)	n = vrows - 1;    if (n < 0)	n = 0;    if (n != vselect_row) {	vselect_row = n;	vlast_row = vrow;	if (DOcb(FLVEcb_SELECTION_CHANGED)) {	    vwhy_event = FLVE_SELECTION_CHANGED;	    do_callback(this, user_data());	    vwhy_event = 0;	}	damage(FL_DAMAGE_CHILD);    }    return vselect_row;}//================================================================//      Protected functions//================================================================voidFlv_List::client_area(int &X, int &Y, int &W, int &H){    char sv = 0, sh = 0;    int th, v, rw;    X = x();    Y = y();    W = w();    H = h();#if FL_MAJOR_VERSION == 2    box()->inset(X, Y, W, H);#else    Fl_Boxtype b = box();    X += Fl::box_dx(b);    Y += Fl::box_dy(b);    W -= Fl::box_dw(b);    H -= Fl::box_dh(b);#endif    rw = vrow_width;    if (rw == 0)	rw = W;    if ((vhas_scrollbars & FLVS_HORIZONTAL_ALWAYS) == FLVS_HORIZONTAL_ALWAYS)	sh = 1;    else if ((vhas_scrollbars & FLVS_HORIZONTAL) == FLVS_HORIZONTAL) {	if (vrow_width != 0) {	    if (rw > W)		sh = 1;	    else if (rw > W - vscrollbar_width)		sh = -1;	//      Turn on if rows won't fit	}    }    //      We need total height    if ((vhas_scrollbars & FLVS_VERTICAL_ALWAYS) == FLVS_VERTICAL_ALWAYS)	sv = 1;    else if ((vhas_scrollbars & FLVS_VERTICAL) == FLVS_VERTICAL) {	th = (label()? row_height(-3) : 0);	th += (row_header()? row_height(-1) : 0);	th += (row_footer()? row_height(-2) : 0);	for (v = 0; th <= H && v < rows(); v++)	    th += row_height(v);	if (th > H)	    sv = 1;	else if (th > H - vscrollbar_width)	    sv = -1;		//      Turn on if width in region    }    if (sh < 0 && sv > 0)	sh = 1;			// Extends to scrollbar obscured region so turn on    if (sv < 0 && sh > 0)	sv = 1;			// Extends to scrollbar obscured region so turn on    if (sv > 0)	W -= vscrollbar_width;    if (sh > 0)	H -= vscrollbar_width;}voidFlv_List::draw_border(Flv_Style & s, int &X, int &Y, int &W, int &H){    int t;    //    Draw outer border if defined    fl_color(s.border_color());    if (s.left_border())	fl_yxline(X, Y, Y + H - 1);    if (s.right_border())	fl_yxline(X + W - 1, Y, Y + H - 1);    if (s.left_border()) {	X++;	W--;    }    if (s.right_border())	W--;    if (s.top_border())	fl_xyline(X, Y, X + W - 1);    if (s.bottom_border())	fl_xyline(X, Y + H - 1, X + W - 1);    if (s.top_border()) {	Y++;	H--;    }    if (s.bottom_border())	H--;    //    Draw spacing between borders    fl_color(color());    for (t = 0; t < s.border_spacing(); t++) {	fl_rect(X, Y, W, H);	if (s.left_border()) {	    X++;	    W--;	}	if (s.right_border())	    W--;	if (s.top_border()) {	    Y++;	    H--;	}	if (s.bottom_border())	    H--;    }    //    Draw inner border if defined    fl_color(s.border_color());    if (s.inner_left_border())	fl_yxline(X, Y, Y + H - 1);    if (s.inner_right_border())	fl_yxline(X + W - 1, Y, Y + H - 1);    if (s.inner_left_border()) {	X++;	W--;    }    if (s.inner_right_border())	W--;    if (s.inner_top_border())	fl_xyline(X, Y, X + W - 1);    if (s.inner_bottom_border())	fl_xyline(X, Y + H - 1, X + W - 1);    if (s.inner_top_border()) {	Y++;	H--;    }    if (s.inner_bottom_border())	H--;}//      Determine if scrollbars are visible/position and draw//      them if nessasary, also update X,Y,W,H to be inside boxvoidFlv_List::draw_scrollbars(int &X, int &Y, int &W, int &H){    char sv = 0, sh = 0;    int th, x, rw;    rw = vrow_width;    if (rw == 0)	rw = W;    if ((vhas_scrollbars & FLVS_HORIZONTAL_ALWAYS) == FLVS_HORIZONTAL_ALWAYS)	sh = 1;    else if ((vhas_scrollbars & FLVS_HORIZONTAL) == FLVS_HORIZONTAL) {	if (vrow_width != 0) {	    if (rw > W)		sh = 1;	    else if (rw > W - vscrollbar_width)		sh = -1;	//      Turn on if rows won't fit	}    }    //      We need total height    if ((vhas_scrollbars & FLVS_VERTICAL_ALWAYS) == FLVS_VERTICAL_ALWAYS)	sv = 1;    else if ((vhas_scrollbars & FLVS_VERTICAL) == FLVS_VERTICAL) {	th = (label()? row_height(-3) : 0);	th += (row_header()? row_height(-1) : 0);	th += (row_footer()? row_height(-2) : 0);	for (x = 0; th <= H && x < rows(); x++)	    th += row_height(x);	if (th > H)	    sv = 1;	else if (th > H - vscrollbar_width)	    sv = -1;		//      Turn on if width in region    }    if (sh < 0 && sv > 0)	sh = 1;			// Extends to scrollbar obscured region so turn on    if (sv < 0 && sh > 0)	sv = 1;			// Extends to scrollbar obscured region so turn on    if (sv > 0)	W -= vscrollbar_width;    if (sh > 0)	H -= vscrollbar_width;    //      Place scrollbars where they should be    if (sv > 0) {#if FL_MAJOR_VERSION == 2	scrollbar.resize(X + W, Y, vscrollbar_width, H);#else	scrollbar.damage_resize(X + W, Y, vscrollbar_width, H);#endif	scrollbar.value(top_row(), page_size() + 1, 0, vrows);	//      Fake out page size	scrollbar.linesize(1);	scrollbar.minimum(0);	scrollbar.maximum(vrows - 1);	x = H - (vrows * 2) - vscrollbar_width * 2;	if (x < vscrollbar_width)	    x = vscrollbar_width;#if FL_MAJOR_VERSION == 2	scrollbar.slider_size(x);#else	scrollbar.	    slider_size((double)			((double) x / (double) (H - vscrollbar_width * 2)));#endif	scrollbar.Fl_Valuator::value(top_row());	//      , 1,    0, vrows );	if (!scrollbar.visible())	    scrollbar.set_visible();	draw_child(scrollbar);    } else	scrollbar.clear_visible();    if (rw - vrow_offset < W && rw > W) {	vrow_offset = rw - W;	vlast_row = vrow;	//      Make sure we update the entire widget    }    if (sh > 0) {#if FL_MAJOR_VERSION == 2	hscrollbar.resize(X, Y + H, W, vscrollbar_width);#else	hscrollbar.damage_resize(X, Y + H, W, vscrollbar_width);#endif	hscrollbar.value(vrow_offset, 50, 0, vrow_width);	//      Fake out page size	hscrollbar.linesize(10);	hscrollbar.minimum(0);	hscrollbar.maximum(vrow_width - W);#if FL_MAJOR_VERSION == 2	x = W - vrow_width / 10 - vscrollbar_width * 2;	if (x < vscrollbar_width)	    x = vscrollbar_width;	hscrollbar.slider_size(x);#else	x = vrow_width / 10;	hscrollbar.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -