From 275a2a3782bbae3a29f6d8cb9508b7d886fb11f2 Mon Sep 17 00:00:00 2001 From: kojima Date: Wed, 11 Oct 2000 16:21:50 +0000 Subject: [PATCH] added scrolled notifcation to scroller added GetVisibleRect function to scrollview --- WINGs/ChangeLog | 4 +++- WINGs/Tests/wtest.c | 1 + WINGs/WINGs.h | 4 ++++ WINGs/wscroller.c | 15 +++++++++++++++ WINGs/wscrollview.c | 13 ++++++++++++- 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/WINGs/ChangeLog b/WINGs/ChangeLog index 238ec88d..43100057 100644 --- a/WINGs/ChangeLog +++ b/WINGs/ChangeLog @@ -17,7 +17,7 @@ changes since wmaker 0.62.1: subdirectories - removed WMArrayBag and reorganized WMTreeBag to be WMBag. - added WMArray class. -- added WMSetWindowUserPosition(). +- added WMSetWindowUserPosition() - added WMGetListSelectedItems() - added WMSetListAllowMultipleSelection(), WMListAllowsMultipleSelection(). - added WMSetListAllowEmptySelection(), WMListAllowsEmptySelection(). @@ -40,6 +40,8 @@ changes since wmaker 0.62.1: - Added WMGetBrowserPaths() to retrieve the paths for browsers that allow multiple selections. - WMDestroyWidget() now calls WMUnmapWidget() first +- added WMScrollerDidScrollNotification to scroller +- added WMGetScrollViewVisibleRect() changes since wmaker 0.62.0: diff --git a/WINGs/Tests/wtest.c b/WINGs/Tests/wtest.c index ac5e5b28..86bb2923 100644 --- a/WINGs/Tests/wtest.c +++ b/WINGs/Tests/wtest.c @@ -1219,6 +1219,7 @@ main(int argc, char **argv) testScrollView(scr); +#if 0 testButton(scr); testFrame(scr); diff --git a/WINGs/WINGs.h b/WINGs/WINGs.h index 1c9bf1df..ce59a5ca 100644 --- a/WINGs/WINGs.h +++ b/WINGs/WINGs.h @@ -1068,6 +1068,8 @@ void WMSetScrollerAction(WMScroller *sPtr, WMAction *action, void *clientData); void WMSetScrollerArrowsPosition(WMScroller *sPtr, WMScrollArrowPosition position); +extern char *WMScrollerDidScrollNotification; + /* ....................................................................... */ WMList *WMCreateList(WMWidget *parent); @@ -1384,6 +1386,8 @@ void WMSetScrollViewRelief(WMScrollView *sPtr, WMReliefType type); void WMSetScrollViewContentView(WMScrollView *sPtr, WMView *view); +WMRect WMGetScrollViewVisibleRect(WMScrollView *sPtr); + WMScroller *WMGetScrollViewHorizontalScroller(WMScrollView *sPtr); WMScroller *WMGetScrollViewVerticalScroller(WMScrollView *sPtr); diff --git a/WINGs/wscroller.c b/WINGs/wscroller.c index 10a89676..480c94d1 100644 --- a/WINGs/wscroller.c +++ b/WINGs/wscroller.c @@ -14,6 +14,10 @@ #define AUTOSCROLL_DELAY 40 +char *WMScrollerDidScrollNotification = "WMScrollerDidScrollNotification"; + + + typedef struct W_Scroller { W_Class widgetClass; W_View *view; @@ -672,6 +676,8 @@ handlePush(Scroller *sPtr, int pushX, int pushY, int alternate) if (doAction && sPtr->action) { (*sPtr->action)(sPtr, sPtr->clientData); + + WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, NULL); } } @@ -751,6 +757,8 @@ handleMotion(Scroller *sPtr, int mouseX, int mouseY) WMSetScrollerParameters(sPtr, newFloatValue, sPtr->knobProportion); if (sPtr->action) { (*sPtr->action)(sPtr, sPtr->clientData); + WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, + NULL); } } else { int part; @@ -780,6 +788,7 @@ autoScroll(void *clientData) if (sPtr->action) { (*sPtr->action)(sPtr, sPtr->clientData); + WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, NULL); } sPtr->timerID= WMAddTimerHandler(AUTOSCROLL_DELAY, autoScroll, clientData); } @@ -825,6 +834,8 @@ handleActionEvents(XEvent *event, void *data) } if (sPtr->action) { (*sPtr->action)(sPtr, sPtr->clientData); + WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, + NULL); } } else if (event->xbutton.button==WINGsConfiguration.mouseWheelDown) { @@ -837,6 +848,8 @@ handleActionEvents(XEvent *event, void *data) } if (sPtr->action) { (*sPtr->action)(sPtr, sPtr->clientData); + WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, + NULL); } } else { handlePush(sPtr, event->xbutton.x, event->xbutton.y, @@ -855,6 +868,8 @@ handleActionEvents(XEvent *event, void *data) if (sPtr->flags.draggingKnob) { if (sPtr->action) { (*sPtr->action)(sPtr, sPtr->clientData); + WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, + NULL); } } if (sPtr->timerID) { diff --git a/WINGs/wscrollview.c b/WINGs/wscrollview.c index 09496007..4a0cb92d 100644 --- a/WINGs/wscrollview.c +++ b/WINGs/wscrollview.c @@ -236,6 +236,17 @@ WMSetScrollViewPageScroll(WMScrollView *sPtr, int amount) } +WMRect +WMGetScrollViewVisibleRect(WMScrollView *sPtr) +{ + WMRect rect; + + rect.pos = sPtr->contentView->pos; + rect.size = sPtr->viewport->size; + + return rect; +} + static void doScrolling(WMWidget *self, void *data) { @@ -522,7 +533,7 @@ handleEvents(XEvent *event, void *data) static void destroyScrollView(ScrollView *sPtr) { - + puts("destroyScrollView not implemented"); wfree(sPtr); } -- 2.11.4.GIT