Mercurial > hg > xemacs-beta
comparison src/scrollbar.c @ 282:c42ec1d1cded r21-0b39
Import from CVS: tag r21-0b39
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:33:18 +0200 |
parents | 7df0dd720c89 |
children | 558f606b08ae |
comparison
equal
deleted
inserted
replaced
281:090b52736db2 | 282:c42ec1d1cded |
---|---|
55 Lisp_Object Qscrollbar_horizontal_drag; | 55 Lisp_Object Qscrollbar_horizontal_drag; |
56 | 56 |
57 #define DEFAULT_SCROLLBAR_WIDTH 15 | 57 #define DEFAULT_SCROLLBAR_WIDTH 15 |
58 #define DEFAULT_SCROLLBAR_HEIGHT 15 | 58 #define DEFAULT_SCROLLBAR_HEIGHT 15 |
59 | 59 |
60 /* Width of the scrollbar. */ | 60 /* Width and height of the scrollbar. */ |
61 Lisp_Object Vscrollbar_width; | 61 Lisp_Object Vscrollbar_width; |
62 | |
63 /* Height of the scrollbar. */ | |
64 Lisp_Object Vscrollbar_height; | 62 Lisp_Object Vscrollbar_height; |
63 | |
64 /* Scrollbar visibility specifiers */ | |
65 Lisp_Object Vhorizontal_scrollbar_visible_p; | |
66 Lisp_Object Vvertical_scrollbar_visible_p; | |
67 | |
68 /* Scrollbar location specifiers */ | |
69 Lisp_Object Vscrollbar_on_left_p; | |
70 Lisp_Object Vscrollbar_on_top_p; | |
65 | 71 |
66 Lisp_Object Vscrollbar_pointer_glyph; | 72 Lisp_Object Vscrollbar_pointer_glyph; |
67 | 73 |
68 EXFUN (Fcenter_to_window_line, 2); | 74 EXFUN (Fcenter_to_window_line, 2); |
69 | 75 |
458 int x_offset, y_offset; | 464 int x_offset, y_offset; |
459 | 465 |
460 /* Scrollbars are always the farthest from the text area. */ | 466 /* Scrollbars are always the farthest from the text area. */ |
461 if (vertical) | 467 if (vertical) |
462 { | 468 { |
463 x_offset = (f->scrollbar_on_left | 469 x_offset = (!NILP (w->scrollbar_on_left_p) |
464 ? WINDOW_LEFT (w) | 470 ? WINDOW_LEFT (w) |
465 : WINDOW_RIGHT (w) - scrollbar_width); | 471 : WINDOW_RIGHT (w) - scrollbar_width); |
466 y_offset = WINDOW_TEXT_TOP (w) + f->scrollbar_y_offset; | 472 y_offset = WINDOW_TEXT_TOP (w) + f->scrollbar_y_offset; |
467 } | 473 } |
468 else | 474 else |
469 { | 475 { |
470 x_offset = WINDOW_TEXT_LEFT (w); | 476 x_offset = WINDOW_TEXT_LEFT (w); |
471 y_offset = f->scrollbar_y_offset + | 477 y_offset = f->scrollbar_y_offset + |
472 (f->scrollbar_on_top | 478 (!NILP (w->scrollbar_on_top_p) |
473 ? WINDOW_TOP (w) | 479 ? WINDOW_TOP (w) |
474 : WINDOW_TEXT_BOTTOM (w) + window_bottom_toolbar_height (w)); | 480 : WINDOW_TEXT_BOTTOM (w) + window_bottom_toolbar_height (w)); |
475 } | 481 } |
476 | 482 |
477 new_x = x_offset; | 483 new_x = x_offset; |
577 call_critical_lisp_code (d, | 583 call_critical_lisp_code (d, |
578 Qinit_scrollbar_from_resources, | 584 Qinit_scrollbar_from_resources, |
579 Qglobal); | 585 Qglobal); |
580 unbind_to (depth, Qnil); | 586 unbind_to (depth, Qnil); |
581 } | 587 } |
582 } | |
583 | |
584 | |
585 /* This function is called as a result of a change to the | |
586 `scrollbar-width' specifier. */ | |
587 static void | |
588 scrollbar_width_changed_in_frame (Lisp_Object specifier, struct frame *f, | |
589 Lisp_Object oldval) | |
590 { | |
591 MAYBE_FRAMEMETH (f, scrollbar_width_changed_in_frame, | |
592 (specifier, f, oldval)); | |
593 } | |
594 | |
595 /* This function is called as a result of a change to the | |
596 `scrollbar-height' specifier. */ | |
597 static void | |
598 scrollbar_height_changed_in_frame (Lisp_Object specifier, struct frame *f, | |
599 Lisp_Object oldval) | |
600 { | |
601 MAYBE_FRAMEMETH (f, scrollbar_height_changed_in_frame, | |
602 (specifier, f, oldval)); | |
603 } | 588 } |
604 | 589 |
605 /* This function is called as a result of a change to the | 590 /* This function is called as a result of a change to the |
606 `scrollbar-pointer' glyph. */ | 591 `scrollbar-pointer' glyph. */ |
607 static void | 592 static void |
944 slot_offset (struct window, | 929 slot_offset (struct window, |
945 scrollbar_width), | 930 scrollbar_width), |
946 some_window_value_changed, | 931 some_window_value_changed, |
947 slot_offset (struct frame, | 932 slot_offset (struct frame, |
948 scrollbar_width), | 933 scrollbar_width), |
949 scrollbar_width_changed_in_frame); | 934 frame_size_slipped); |
950 | 935 |
951 DEFVAR_SPECIFIER ("scrollbar-height", &Vscrollbar_height /* | 936 DEFVAR_SPECIFIER ("scrollbar-height", &Vscrollbar_height /* |
952 *Height of horizontal scrollbars. | 937 *Height of horizontal scrollbars. |
953 This is a specifier; use `set-specifier' to change it. | 938 This is a specifier; use `set-specifier' to change it. |
954 */ ); | 939 */ ); |
960 slot_offset (struct window, | 945 slot_offset (struct window, |
961 scrollbar_height), | 946 scrollbar_height), |
962 some_window_value_changed, | 947 some_window_value_changed, |
963 slot_offset (struct frame, | 948 slot_offset (struct frame, |
964 scrollbar_height), | 949 scrollbar_height), |
965 scrollbar_height_changed_in_frame); | 950 frame_size_slipped); |
951 | |
952 DEFVAR_SPECIFIER ("horizontal-scrollbar-visible-p", &Vhorizontal_scrollbar_visible_p /* | |
953 *Whether the horizontal scrollbar is visible. | |
954 This is a specifier; use `set-specifier' to change it. | |
955 */ ); | |
956 Vhorizontal_scrollbar_visible_p = Fmake_specifier (Qboolean); | |
957 set_specifier_fallback (Vhorizontal_scrollbar_visible_p, | |
958 list1 (Fcons (Qnil, Qt))); | |
959 set_specifier_caching (Vhorizontal_scrollbar_visible_p, | |
960 slot_offset (struct window, | |
961 horizontal_scrollbar_visible_p), | |
962 some_window_value_changed, | |
963 slot_offset (struct frame, | |
964 horizontal_scrollbar_visible_p), | |
965 frame_size_slipped); | |
966 | |
967 DEFVAR_SPECIFIER ("vertical-scrollbar-visible-p", &Vvertical_scrollbar_visible_p /* | |
968 *Whether the vertical scrollbar is visible. | |
969 This is a specifier; use `set-specifier' to change it. | |
970 */ ); | |
971 Vvertical_scrollbar_visible_p = Fmake_specifier (Qboolean); | |
972 set_specifier_fallback (Vvertical_scrollbar_visible_p, | |
973 list1 (Fcons (Qnil, Qt))); | |
974 set_specifier_caching (Vvertical_scrollbar_visible_p, | |
975 slot_offset (struct window, | |
976 vertical_scrollbar_visible_p), | |
977 some_window_value_changed, | |
978 slot_offset (struct frame, | |
979 vertical_scrollbar_visible_p), | |
980 frame_size_slipped); | |
981 | |
982 DEFVAR_SPECIFIER ("scrollbar-on-left-p", &Vscrollbar_on_left_p /* | |
983 *Whether the verical scrollbar is on the left side of window or frame. | |
984 This is a specifier; use `set-specifier' to change it. | |
985 */ ); | |
986 Vscrollbar_on_left_p = Fmake_specifier (Qboolean); | |
987 | |
988 { | |
989 /* Klugde. Under X, we want athena scrollbars on the left, | |
990 while all other scrollbars go on the right by default. */ | |
991 Lisp_Object fallback = list1 (Fcons (Qnil, Qnil)); | |
992 #if defined (HAVE_X_WINDOWS) \ | |
993 && !defined (LWLIB_SCROLLBARS_MOTIF) \ | |
994 && !defined (LWLIB_SCROLLBARS_LUCID) \ | |
995 && !defined (LWLIB_SCROLLBARS_ATHENA3D) | |
996 | |
997 fallback = Fcons (Fcons (list1 (Qx), Qt), fallback); | |
998 #endif | |
999 set_specifier_fallback (Vscrollbar_on_left_p, fallback); | |
1000 } | |
1001 | |
1002 set_specifier_caching (Vscrollbar_on_left_p, | |
1003 slot_offset (struct window, | |
1004 scrollbar_on_left_p), | |
1005 some_window_value_changed, | |
1006 slot_offset (struct frame, | |
1007 scrollbar_on_left_p), | |
1008 frame_size_slipped); | |
1009 | |
1010 DEFVAR_SPECIFIER ("scrollbar-on-top-p", &Vscrollbar_on_top_p /* | |
1011 *Whether the verical scrollbar is on the top side of window or frame. | |
1012 This is a specifier; use `set-specifier' to change it. | |
1013 */ ); | |
1014 Vscrollbar_on_top_p = Fmake_specifier (Qboolean); | |
1015 set_specifier_fallback (Vscrollbar_on_top_p, | |
1016 list1 (Fcons (Qnil, Qnil))); | |
1017 set_specifier_caching (Vscrollbar_on_top_p, | |
1018 slot_offset (struct window, | |
1019 scrollbar_on_top_p), | |
1020 some_window_value_changed, | |
1021 slot_offset (struct frame, | |
1022 scrollbar_on_top_p), | |
1023 frame_size_slipped); | |
966 } | 1024 } |
967 | 1025 |
968 void | 1026 void |
969 complex_vars_of_scrollbar (void) | 1027 complex_vars_of_scrollbar (void) |
970 { | 1028 { |