ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

flatsb.c
Go to the documentation of this file.
00001 /*
00002  * Flat Scrollbar control
00003  *
00004  * Copyright 1998, 1999 Eric Kohl
00005  * Copyright 1998 Alex Priem
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00020  *
00021  * NOTES
00022  *   This is just a dummy control. An author is needed! Any volunteers?
00023  *   I will only improve this control once in a while.
00024  *     Eric <ekohl@abo.rhein-zeitung.de>
00025  *
00026  * TODO:
00027  *   - All messages.
00028  *   - All notifications.
00029  *
00030  */
00031 
00032 #include <stdarg.h>
00033 #include <string.h>
00034 #include "windef.h"
00035 #include "winbase.h"
00036 #include "winerror.h"
00037 #include "winuser.h"
00038 #include "commctrl.h"
00039 #include "comctl32.h"
00040 #include "wine/debug.h"
00041 
00042 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
00043 
00044 typedef struct
00045 {
00046     DWORD dwDummy;  /* just to keep the compiler happy ;-) */
00047 } FLATSB_INFO, *LPFLATSB_INFO;
00048 
00049 
00050 /***********************************************************************
00051  *      InitializeFlatSB (COMCTL32.@)
00052  *
00053  * Initializes flat scroll bars for the specified window.
00054  *
00055  * RETURNS
00056  *     Success: Non-zero
00057  *     Failure: Zero
00058  *
00059  * NOTES
00060  *     Subclasses specified window so that flat scroll bars may be drawn
00061  *     and used.
00062  */
00063 BOOL WINAPI InitializeFlatSB(HWND hwnd)
00064 {
00065     TRACE("[%p]\n", hwnd);
00066     return FALSE;
00067 }
00068 
00069 /***********************************************************************
00070  *      UninitializeFlatSB (COMCTL32.@)
00071  *
00072  * Uninitializes flat scroll bars for the specified window.
00073  *
00074  * RETURNS
00075  *  E_FAIL      if one of the scroll bars is currently in use
00076  *  S_FALSE     if InitializeFlatSB() was never called on this hwnd
00077  *  S_OK        otherwise
00078  *
00079  * NOTES
00080  *     Removes any subclassing on the specified window so that regular
00081  *     scroll bars are drawn and used.
00082  */
00083 HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
00084 {
00085     TRACE("[%p]\n", hwnd);
00086     return S_FALSE;
00087 }
00088 
00089 /***********************************************************************
00090  *      FlatSB_GetScrollProp (COMCTL32.@)
00091  *
00092  * Retrieves flat-scroll-bar-specific properties for the specified window.
00093  *
00094  * RETURNS
00095  *     nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
00096  *     the return is nonzero if InitializeFlatSB has been called for this window, or
00097  *     zero otherwise.
00098  */
00099 BOOL WINAPI
00100 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
00101 {
00102     TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
00103     return FALSE;
00104 }
00105 
00106 /***********************************************************************
00107  *      FlatSB_SetScrollProp (COMCTL32.@)
00108  *
00109  * Sets flat-scroll-bar-specific properties for the specified window.
00110  *
00111  * RETURNS
00112  *     Success: Non-zero
00113  *     Failure: Zero
00114  */
00115 BOOL WINAPI
00116 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
00117 {
00118     TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
00119     return FALSE;
00120 }
00121 
00122 /***********************************************************************
00123  *  From the Microsoft docs:
00124  *  "If flat scroll bars haven't been initialized for the
00125  *  window, the flat scroll bar APIs will defer to the corresponding
00126  *  standard APIs.  This allows the developer to turn flat scroll
00127  *  bars on and off without having to write conditional code."
00128  *
00129  *  So, if we just call the standard functions until we implement
00130  *  the flat scroll bar functions, flat scroll bars will show up and
00131  *  behave properly, as though they had simply not been setup to
00132  *  have flat properties.
00133  *
00134  *  Susan <sfarley@codeweavers.com>
00135  *
00136  */
00137 
00138 /***********************************************************************
00139  *      FlatSB_EnableScrollBar (COMCTL32.@)
00140  *
00141  * See EnableScrollBar.
00142  */
00143 BOOL WINAPI
00144 FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
00145 {
00146     return EnableScrollBar(hwnd, nBar, flags);
00147 }
00148 
00149 /***********************************************************************
00150  *      FlatSB_ShowScrollBar (COMCTL32.@)
00151  *
00152  * See ShowScrollBar.
00153  */
00154 BOOL WINAPI
00155 FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
00156 {
00157     return ShowScrollBar(hwnd, nBar, fShow);
00158 }
00159 
00160 /***********************************************************************
00161  *      FlatSB_GetScrollRange (COMCTL32.@)
00162  *
00163  * See GetScrollRange.
00164  */
00165 BOOL WINAPI
00166 FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
00167 {
00168     return GetScrollRange(hwnd, nBar, min, max);
00169 }
00170 
00171 /***********************************************************************
00172  *      FlatSB_GetScrollInfo (COMCTL32.@)
00173  *
00174  * See GetScrollInfo.
00175  */
00176 BOOL WINAPI
00177 FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
00178 {
00179     return GetScrollInfo(hwnd, nBar, info);
00180 }
00181 
00182 /***********************************************************************
00183  *      FlatSB_GetScrollPos (COMCTL32.@)
00184  *
00185  * See GetScrollPos.
00186  */
00187 INT WINAPI
00188 FlatSB_GetScrollPos(HWND hwnd, int nBar)
00189 {
00190     return GetScrollPos(hwnd, nBar);
00191 }
00192 
00193 /***********************************************************************
00194  *      FlatSB_SetScrollPos (COMCTL32.@)
00195  *
00196  * See SetScrollPos.
00197  */
00198 INT WINAPI
00199 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
00200 {
00201     return SetScrollPos(hwnd, nBar, pos, bRedraw);
00202 }
00203 
00204 /***********************************************************************
00205  *      FlatSB_SetScrollInfo (COMCTL32.@)
00206  *
00207  * See SetScrollInfo.
00208  */
00209 INT WINAPI
00210 FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
00211 {
00212     return SetScrollInfo(hwnd, nBar, info, bRedraw);
00213 }
00214 
00215 /***********************************************************************
00216  *      FlatSB_SetScrollRange (COMCTL32.@)
00217  *
00218  * See SetScrollRange.
00219  */
00220 INT WINAPI
00221 FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
00222 {
00223     return SetScrollRange(hwnd, nBar, min, max, bRedraw);
00224 }
00225 
00226 
00227 static LRESULT
00228 FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
00229 {
00230     TRACE("[%p] wParam=%04lx lParam=%08lx\n", hwnd, wParam, lParam);
00231     return 0;
00232 }
00233 
00234 
00235 static LRESULT
00236 FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
00237 {
00238     TRACE("[%p] wParam=%04lx lParam=%08lx\n", hwnd, wParam, lParam);
00239     return 0;
00240 }
00241 
00242 
00243 static LRESULT WINAPI
00244 FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
00245 {
00246     if (!GetWindowLongPtrW(hwnd, 0) && (uMsg != WM_CREATE))
00247     return DefWindowProcW( hwnd, uMsg, wParam, lParam );
00248 
00249     switch (uMsg)
00250     {
00251     case WM_CREATE:
00252         return FlatSB_Create (hwnd, wParam, lParam);
00253 
00254     case WM_DESTROY:
00255         return FlatSB_Destroy (hwnd, wParam, lParam);
00256 
00257     default:
00258         if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
00259         ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
00260                     uMsg, wParam, lParam);
00261         return DefWindowProcW (hwnd, uMsg, wParam, lParam);
00262     }
00263 }
00264 
00265 
00266 VOID
00267 FLATSB_Register (void)
00268 {
00269     WNDCLASSW wndClass;
00270 
00271     ZeroMemory (&wndClass, sizeof(WNDCLASSW));
00272     wndClass.style         = CS_GLOBALCLASS;
00273     wndClass.lpfnWndProc   = FlatSB_WindowProc;
00274     wndClass.cbClsExtra    = 0;
00275     wndClass.cbWndExtra    = sizeof(FLATSB_INFO *);
00276     wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
00277     wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
00278     wndClass.lpszClassName = FLATSB_CLASSW;
00279 
00280     RegisterClassW (&wndClass);
00281 }
00282 
00283 
00284 VOID
00285 FLATSB_Unregister (void)
00286 {
00287     UnregisterClassW (FLATSB_CLASSW, NULL);
00288 }

Generated on Sat May 26 2012 04:21:32 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.