summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src/coolsblib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Clist_nicer/src/coolsblib.cpp')
-rw-r--r--plugins/Clist_nicer/src/coolsblib.cpp293
1 files changed, 2 insertions, 291 deletions
diff --git a/plugins/Clist_nicer/src/coolsblib.cpp b/plugins/Clist_nicer/src/coolsblib.cpp
index f669a400a9..52cdf6f0a7 100644
--- a/plugins/Clist_nicer/src/coolsblib.cpp
+++ b/plugins/Clist_nicer/src/coolsblib.cpp
@@ -76,11 +76,6 @@ typedef BOOL(WINAPI *WPROC)(HWND, UINT, UINT);
static WPROC pEnableScrollBar = nullptr;
-void WINAPI CoolSB_SetESBProc(WPROC proc)
-{
- pEnableScrollBar = proc;
-}
-
static void RedrawNonClient(HWND hwnd, BOOL fFrameChanged)
{
if (fFrameChanged == FALSE) {
@@ -508,11 +503,11 @@ BOOL WINAPI CoolSB_ShowScrollBar(HWND hwnd, int wBar, BOOL fShow)
//
// Remove cool scrollbars from the specified window.
//
-HRESULT WINAPI UninitializeCoolSB(HWND hwnd)
+void WINAPI UninitializeCoolSB(HWND hwnd)
{
SCROLLWND *sw = GetScrollWndFromHwnd(hwnd);
if (!sw)
- return E_FAIL;
+ return;
RemoveProp(hwnd, szPropStr);
//SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
@@ -522,293 +517,9 @@ HRESULT WINAPI UninitializeCoolSB(HWND hwnd)
//Force WM_NCCALCSIZE and WM_NCPAINT so the original scrollbars can kick in
RedrawNonClient(hwnd, TRUE);
-
- return S_OK;
-}
-
-#ifdef INCLUDE_BUTTONS
-
-//
-// Cool scrollbar specific interface (BUTTON support)
-//
-
-//
-// Insert a button into the scrollbar area
-//
-// wSBflags - SB_HORZ / SB_VERT only
-// uPos - position into which to insert.
-// can be 0 to insert at the start, or -1 to insert
-// at the end of previously inserted buttons
-//
-
-BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb)
-{
- SCROLLBAR *sbar;
- SCROLLBUT *sbut;
- UINT i;
-
- if ( !psb) return FALSE;
-
- if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags)))
- return FALSE;
-
- //check that we havn't reached the maximum allowed buttons yet
- if (sbar->nButtons == MAX_COOLSB_BUTS)
- return FALSE;
-
- //insert at end
- if (nPos == -1)
- {
- sbut = &sbar->sbButtons[sbar->nButtons];
- }
- //otherwise, need to make room
- else if ((int)nPos < 0 || (int)nPos > (UINT)sbar->nButtons)
- {
- return FALSE;
- }
- else
- {
- //insert space for the button at the specified position
- for (i = sbar->nButtons; i > nPos; i--)
- {
- sbar->sbButtons[i] = sbar->sbButtons[i-1];
- }
-
- sbut = &sbar->sbButtons[nPos];
- }
-
- //only set the button's properties if they are
- //specified by the SCROLLBUT->fMask.
- //Otherwise, use a default property value
-
- if (psb->fMask & SBBF_TYPE)
- sbut->uButType = psb->uButType;
- else
- sbut->uButType = SBBT_PUSHBUTTON;
-
- if (psb->fMask & SBBF_STATE)
- sbut->uState = psb->uState;
- else
- sbut->uState = 0;
-
- if (psb->fMask & SBBF_ID)
- sbut->uCmdId = psb->uCmdId;
- else
- sbut->uCmdId = 0;
-
- if (psb->fMask & SBBF_SIZE)
- sbut->nSize = psb->nSize;
- else
- sbut->nSize = -1;
-
- if (psb->fMask & SBBF_PLACEMENT)
- sbut->uPlacement = psb->uPlacement;
- else
- sbut->uPlacement = SBBP_LEFT;
-
- if (psb->fMask & SBBF_BITMAP)
- sbut->hBmp = psb->hBmp;
- else
- sbut->hBmp = 0;
-
- if (psb->fMask & SBBF_ENHMETAFILE)
- sbut->hEmf = psb->hEmf;
- else
- sbut->hEmf = 0;
-
- if (psb->fMask & SBBF_CURSOR)
- sbut->hCurs = psb->hCurs;
- else
- sbut->hCurs = 0;
-
- /*
- We don't use the callback function anymore. The uButType
- member must now specify SBBT_OWNERDRAW, and a WM_NOTIFY will
- be sent when a button must be drawn
- if ((psb->fMask & SBBF_OWNERDRAW) && ((psb->uButType & SBBT_MASK) == SBBT_OWNERDRAW))
- pDrawProc = psb->pDrawProc;
- else
- pDrawProc = 0;*/
-
- sbar->nButtons++;
- sbut->nSizeReserved = sbut->nSize;
-
- //MAKE SURE that any resizable buttons are only to the left / above
- //a scrollbar. We don't support resize operations to the right of a scrollbar
- if ((sbut->uButType & SBBM_RESIZABLE) && sbut->uPlacement == SBBP_RIGHT)
- sbut->uButType &= ~SBBM_RESIZABLE;
-
- if (psb->fMask & SBBF_BUTMINMAX)
- {
- sbut->nMinSize = psb->nMinSize;
- sbut->nMaxSize = psb->nMaxSize;
- }
- else
- {
- sbut->nMinSize = 0;
- sbut->nMaxSize = -1;
- }
-
- return TRUE;
-}
-
-static SCROLLBUT *GetButtonFromId(SCROLLBAR *sbar, UINT uCmdId)
-{
- int i;
- for (i = 0; i < sbar->nButtons; i++)
- {
- if (sbar->sbButtons[i].uCmdId == uCmdId)
- return &sbar->sbButtons[i];
- }
-
- return 0;
}
//
-// Modify the properties of the specified scrollbar button.
-// wSBflags - SB_HORZ / SB_VERT only
-// uItem - the command identifier specified when the button was created,
-// or a non-negative position of the button, depending on if
-// fByCmd is FALSE or TRUE, respectively
-//
-BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb)
-{
- SCROLLBAR *sbar;
- SCROLLBUT *sbut;
-
- if ( !psb) return FALSE;
-
- //find if this window is CoolScroll enabled
- if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags)))
- return FALSE;
-
- //find the button to modify, depending on if we
- //are modifying by position or command id
- if (fByCmd == FALSE)
- {
- //button from position
- if ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons)
- return FALSE;
- else
- sbut = &sbar->sbButtons[uItem];
- }
- else if (fByCmd == TRUE)
- {
- //button from command identifier
- if ( !(sbut = GetButtonFromId(sbar, uItem)))
- return FALSE;
- }
-
- if (psb->fMask & SBBF_TYPE) sbut->uButType = psb->uButType;
- if (psb->fMask & SBBF_STATE) sbut->uState = psb->uState;
- if (psb->fMask & SBBF_ID) sbut->uCmdId = psb->uCmdId;
- if (psb->fMask & SBBF_SIZE) sbut->nSize = psb->nSize;
- if (psb->fMask & SBBF_PLACEMENT) sbut->uPlacement = psb->uPlacement;
- if (psb->fMask & SBBF_BITMAP) sbut->hBmp = psb->hBmp;
- if (psb->fMask & SBBF_ENHMETAFILE) sbut->hEmf = psb->hEmf;
- if (psb->fMask & SBBF_CURSOR) sbut->hCurs = psb->hCurs;
-
- if (psb->fMask & SBBF_BUTMINMAX)
- {
- sbut->nMinSize = psb->nMinSize;
- sbut->nMaxSize = psb->nMaxSize;
- }
-
- return TRUE;
-}
-
-BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd)
-{
- int i;
- SCROLLBAR *sbar;
-
- //find if this window is CoolScroll enabled
- if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags)))
- return FALSE;
-
- //find the button to modify, depending on if we
- //are modifying by position or command id
- if (fByCmd == FALSE && ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons))
- {
- return FALSE;
- }
- else if (fByCmd == TRUE)
- {
- //find the button with the specified command id
- for (i = 0; i < sbar->nButtons; i++)
- {
- if (sbar->sbButtons[i].uCmdId == uItem)
- {
- //change the id to an index
- uItem = i;
- break;
- }
- }
-
- //if we failed to find the button...
- if (i == sbar->nButtons) return FALSE;
- }
-
- //remove the button!
- for (i = uItem; i < sbar->nButtons - 1; i++)
- {
- sbar->sbButtons[i] = sbar->sbButtons[i+1];
- }
-
- sbar->nButtons--;
-
- RedrawNonClient(hwnd, TRUE);
-
- return TRUE;
-}
-
-//
-// fill in the supplied SCROLLBUT structure
-//
-BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb)
-{
- SCROLLBAR *sbar;
- SCROLLBUT *sbut;
-
- if ( !psb) return FALSE;
-
- //find if this window is CoolScroll enabled
- if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags)))
- return FALSE;
-
- //find the button to modify, depending on if we
- //are modifying by position or command id
- if (fByCmd == FALSE)
- {
- //button from position
- if ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons)
- return FALSE;
- else
- sbut = &sbar->sbButtons[uItem];
- }
- else if (fByCmd == TRUE)
- {
- //button from command identifier
- if ( !(sbut = GetButtonFromId(sbar, uItem)))
- return FALSE;
- }
-
- //copy them across
- *psb = *sbut;
-
- return FALSE;
-}
-
-#else
-
-BOOL WINAPI CoolSB_InsertButton(HWND, int, UINT, SCROLLBUT*) { return FALSE; }
-BOOL WINAPI CoolSB_ModifyButton(HWND, int, UINT, BOOL, SCROLLBUT*) { return FALSE; }
-BOOL WINAPI CoolSB_RemoveButton(HWND, int, UINT, BOOL) { return FALSE; }
-BOOL WINAPI CoolSB_GetButton(HWND, int, UINT, BOOL, SCROLLBUT*) { return FALSE; }
-
-#endif //INCLUDE_BUTTONS
-
-//
// Set the size of the scrollbars
//
BOOL WINAPI CoolSB_SetSize(HWND hwnd, int wBar, int nLength, int nWidth)