1/* 2 * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26#ifndef AWT_SCROLLPANE_H 27#define AWT_SCROLLPANE_H 28 29#include "awt_Canvas.h" 30 31#include "java_awt_ScrollPane.h" 32#include "java_awt_Insets.h" 33#include "sun_awt_windows_WScrollPanePeer.h" 34 35 36/************************************************************************ 37 * AwtScrollPane class 38 */ 39 40class AwtScrollPane : public AwtCanvas { 41public: 42 43 /* java.awt.ScrollPane fields */ 44 static jfieldID scrollbarDisplayPolicyID; 45 static jfieldID hAdjustableID; 46 static jfieldID vAdjustableID; 47 48 /* java.awt.ScrollPaneAdjustable fields */ 49 static jfieldID unitIncrementID; 50 static jfieldID blockIncrementID; 51 52 /* sun.awt.windows.WScrollPanePeer methods */ 53 static jmethodID postScrollEventID; 54 55 AwtScrollPane(); 56 57 virtual LPCTSTR GetClassName(); 58 59 static AwtScrollPane* Create(jobject self, jobject hParent); 60 61 void SetInsets(JNIEnv *env); 62 void RecalcSizes(int parentWidth, int parentHeight, 63 int childWidth, int childHeight); 64 virtual void Show(JNIEnv *env); 65 virtual void Reshape(int x, int y, int w, int h); 66 virtual void BeginValidate() {} 67 virtual void EndValidate() {} 68 69 /* 70 * Fix for bug 4046446 71 * Returns scroll position for the appropriate scrollbar. 72 */ 73 int GetScrollPos(int orient); 74 75 /* 76 * Windows message handler functions 77 */ 78 virtual MsgRouting WmNcHitTest(UINT x, UINT y, LRESULT& retVal); 79 virtual MsgRouting WmHScroll(UINT scrollCode, UINT pos, HWND hScrollBar); 80 virtual MsgRouting WmVScroll(UINT scrollCode, UINT pos, HWND hScrollBar); 81 82 virtual MsgRouting HandleEvent(MSG *msg, BOOL synthetic); 83 84 // some methods invoked on Toolkit thread 85 static jint _GetOffset(void *param); 86 static void _SetInsets(void *param); 87 static void _SetScrollPos(void *param); 88 static void _SetSpans(void *param); 89 90#ifdef DEBUG 91 virtual void VerifyState(); /* verify target and peer are in sync. */ 92#endif 93 94private: 95 void PostScrollEvent(int orient, int scrollCode, int pos); 96 void SetScrollInfo(int orient, int max, int page, BOOL disableNoScroll); 97}; 98 99#endif /* AWT_SCROLLPANE_H */ 100