1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 14:08:06 +01:00

added scrolled notifcation to scroller

added GetVisibleRect function to scrollview
This commit is contained in:
kojima
2000-10-11 16:21:50 +00:00
parent bdaacb6daa
commit 275a2a3782
5 changed files with 35 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ changes since wmaker 0.62.1:
subdirectories subdirectories
- removed WMArrayBag and reorganized WMTreeBag to be WMBag. - removed WMArrayBag and reorganized WMTreeBag to be WMBag.
- added WMArray class. - added WMArray class.
- added WMSetWindowUserPosition(). - added WMSetWindowUserPosition()
- added WMGetListSelectedItems() - added WMGetListSelectedItems()
- added WMSetListAllowMultipleSelection(), WMListAllowsMultipleSelection(). - added WMSetListAllowMultipleSelection(), WMListAllowsMultipleSelection().
- added WMSetListAllowEmptySelection(), WMListAllowsEmptySelection(). - added WMSetListAllowEmptySelection(), WMListAllowsEmptySelection().
@@ -40,6 +40,8 @@ changes since wmaker 0.62.1:
- Added WMGetBrowserPaths() to retrieve the paths for browsers that allow - Added WMGetBrowserPaths() to retrieve the paths for browsers that allow
multiple selections. multiple selections.
- WMDestroyWidget() now calls WMUnmapWidget() first - WMDestroyWidget() now calls WMUnmapWidget() first
- added WMScrollerDidScrollNotification to scroller
- added WMGetScrollViewVisibleRect()
changes since wmaker 0.62.0: changes since wmaker 0.62.0:

View File

@@ -1219,6 +1219,7 @@ main(int argc, char **argv)
testScrollView(scr); testScrollView(scr);
#if 0
testButton(scr); testButton(scr);
testFrame(scr); testFrame(scr);

View File

@@ -1068,6 +1068,8 @@ void WMSetScrollerAction(WMScroller *sPtr, WMAction *action, void *clientData);
void WMSetScrollerArrowsPosition(WMScroller *sPtr, void WMSetScrollerArrowsPosition(WMScroller *sPtr,
WMScrollArrowPosition position); WMScrollArrowPosition position);
extern char *WMScrollerDidScrollNotification;
/* ....................................................................... */ /* ....................................................................... */
WMList *WMCreateList(WMWidget *parent); WMList *WMCreateList(WMWidget *parent);
@@ -1384,6 +1386,8 @@ void WMSetScrollViewRelief(WMScrollView *sPtr, WMReliefType type);
void WMSetScrollViewContentView(WMScrollView *sPtr, WMView *view); void WMSetScrollViewContentView(WMScrollView *sPtr, WMView *view);
WMRect WMGetScrollViewVisibleRect(WMScrollView *sPtr);
WMScroller *WMGetScrollViewHorizontalScroller(WMScrollView *sPtr); WMScroller *WMGetScrollViewHorizontalScroller(WMScrollView *sPtr);
WMScroller *WMGetScrollViewVerticalScroller(WMScrollView *sPtr); WMScroller *WMGetScrollViewVerticalScroller(WMScrollView *sPtr);

View File

@@ -14,6 +14,10 @@
#define AUTOSCROLL_DELAY 40 #define AUTOSCROLL_DELAY 40
char *WMScrollerDidScrollNotification = "WMScrollerDidScrollNotification";
typedef struct W_Scroller { typedef struct W_Scroller {
W_Class widgetClass; W_Class widgetClass;
W_View *view; W_View *view;
@@ -672,6 +676,8 @@ handlePush(Scroller *sPtr, int pushX, int pushY, int alternate)
if (doAction && sPtr->action) { if (doAction && sPtr->action) {
(*sPtr->action)(sPtr, sPtr->clientData); (*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); WMSetScrollerParameters(sPtr, newFloatValue, sPtr->knobProportion);
if (sPtr->action) { if (sPtr->action) {
(*sPtr->action)(sPtr, sPtr->clientData); (*sPtr->action)(sPtr, sPtr->clientData);
WMPostNotificationName(WMScrollerDidScrollNotification, sPtr,
NULL);
} }
} else { } else {
int part; int part;
@@ -780,6 +788,7 @@ autoScroll(void *clientData)
if (sPtr->action) { if (sPtr->action) {
(*sPtr->action)(sPtr, sPtr->clientData); (*sPtr->action)(sPtr, sPtr->clientData);
WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, NULL);
} }
sPtr->timerID= WMAddTimerHandler(AUTOSCROLL_DELAY, autoScroll, clientData); sPtr->timerID= WMAddTimerHandler(AUTOSCROLL_DELAY, autoScroll, clientData);
} }
@@ -825,6 +834,8 @@ handleActionEvents(XEvent *event, void *data)
} }
if (sPtr->action) { if (sPtr->action) {
(*sPtr->action)(sPtr, sPtr->clientData); (*sPtr->action)(sPtr, sPtr->clientData);
WMPostNotificationName(WMScrollerDidScrollNotification, sPtr,
NULL);
} }
} }
else if (event->xbutton.button==WINGsConfiguration.mouseWheelDown) { else if (event->xbutton.button==WINGsConfiguration.mouseWheelDown) {
@@ -837,6 +848,8 @@ handleActionEvents(XEvent *event, void *data)
} }
if (sPtr->action) { if (sPtr->action) {
(*sPtr->action)(sPtr, sPtr->clientData); (*sPtr->action)(sPtr, sPtr->clientData);
WMPostNotificationName(WMScrollerDidScrollNotification, sPtr,
NULL);
} }
} else { } else {
handlePush(sPtr, event->xbutton.x, event->xbutton.y, handlePush(sPtr, event->xbutton.x, event->xbutton.y,
@@ -855,6 +868,8 @@ handleActionEvents(XEvent *event, void *data)
if (sPtr->flags.draggingKnob) { if (sPtr->flags.draggingKnob) {
if (sPtr->action) { if (sPtr->action) {
(*sPtr->action)(sPtr, sPtr->clientData); (*sPtr->action)(sPtr, sPtr->clientData);
WMPostNotificationName(WMScrollerDidScrollNotification, sPtr,
NULL);
} }
} }
if (sPtr->timerID) { if (sPtr->timerID) {

View File

@@ -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 static void
doScrolling(WMWidget *self, void *data) doScrolling(WMWidget *self, void *data)
{ {
@@ -522,7 +533,7 @@ handleEvents(XEvent *event, void *data)
static void static void
destroyScrollView(ScrollView *sPtr) destroyScrollView(ScrollView *sPtr)
{ {
puts("destroyScrollView not implemented");
wfree(sPtr); wfree(sPtr);
} }