Ignore:
Timestamp:
Mar 18, 2000, 5:17:35 PM (25 years ago)
Author:
cbratschi
Message:

Corel 20000317 merge, ccbase finished, bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/tab.cpp

    r2875 r3154  
    1 /* $Id: tab.cpp,v 1.1 2000-02-23 17:09:48 cbratschi Exp $ */
     1/* $Id: tab.cpp,v 1.2 2000-03-18 16:17:30 cbratschi Exp $ */
    22/*
    33 * Tab control
     
    1616
    1717/* inconsistent: report! */
    18 /* WINE 991212 level */
     18/*
     19 - Corel WINE 20000317 level
     20 - (WINE 991212 level)
     21*/
    1922
    2023#include <string.h>
     
    2225#include "winbase.h"
    2326#include "commctrl.h"
     27#include "ccbase.h"
    2428#include "tab.h"
    2529#include "comctl32.h"
     
    4246#define DEFAULT_TAB_WIDTH       96
    4347
    44 #define TAB_GetInfoPtr(hwnd) ((TAB_INFO *)GetWindowLongA(hwnd,0))
     48#define TAB_GetInfoPtr(hwnd) ((TAB_INFO*)getInfoPtr(hwnd))
    4549
    4650/******************************************************************************
     
    5054static void TAB_InvalidateTabArea(HWND      hwnd, TAB_INFO* infoPtr);
    5155static void TAB_EnsureSelectionVisible(HWND hwnd, TAB_INFO* infoPtr);
    52 
    53 static BOOL
    54 TAB_SendSimpleNotify (HWND hwnd, UINT code)
    55 {
    56     NMHDR nmhdr;
    57 
    58     nmhdr.hwndFrom = hwnd;
    59     nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
    60     nmhdr.code = code;
    61 
    62     return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
    63             (WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr);
    64 }
    65 
    6656
    6757static VOID
     
    8272}
    8373
    84 
    85 
    8674static LRESULT
    8775TAB_GetCurSel (HWND hwnd)
     
    140128  } else {
    141129    if (infoPtr->iSelected != iItem) {
    142       if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE)  {
     130      if (sendNotify(hwnd,TCN_SELCHANGING) != TRUE)  {
    143131        infoPtr->iSelected = iItem;
    144         TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
     132        sendNotify(hwnd,TCN_SELCHANGE);
    145133
    146134        TAB_EnsureSelectionVisible(hwnd, infoPtr);
     
    282270       (infoPtr->uFocus != newItem) )
    283271  {
    284     if (!TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING))
     272    if (!sendNotify(hwnd,TCN_SELCHANGING))
    285273    {
    286274      infoPtr->iSelected = newItem;
    287275      infoPtr->uFocus    = newItem;
    288       TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
     276      sendNotify(hwnd,TCN_SELCHANGE);
    289277
    290278      TAB_EnsureSelectionVisible(hwnd, infoPtr);
     
    404392       (infoPtr->iSelected != newItem) )
    405393  {
    406     if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE)
     394    if (sendNotify(hwnd,TCN_SELCHANGING) != TRUE)
    407395    {
    408396      infoPtr->iSelected = newItem;
    409397      infoPtr->uFocus    = newItem;
    410       TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
     398      sendNotify(hwnd, TCN_SELCHANGE);
    411399
    412400      TAB_EnsureSelectionVisible(hwnd, infoPtr);
     
    440428       (infoPtr->iSelected != newItem) )
    441429  {
    442     if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE)
     430    if (sendNotify(hwnd,TCN_SELCHANGING) != TRUE)
    443431    {
    444432      infoPtr->iSelected = newItem;
    445433      infoPtr->uFocus    = newItem;
    446       TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
     434      sendNotify(hwnd,TCN_SELCHANGE);
    447435
    448436      TAB_EnsureSelectionVisible(hwnd, infoPtr);
     
    451439    }
    452440  }
    453   TAB_SendSimpleNotify(hwnd, NM_CLICK);
     441  sendNotify(hwnd,NM_CLICK);
    454442
    455443  return 0;
     
    459447TAB_RButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
    460448{
    461   TAB_SendSimpleNotify(hwnd, NM_RCLICK);
     449  sendNotify(hwnd,NM_RCLICK);
     450
    462451  return 0;
    463452}
     
    805794                             clientRect.right);
    806795
     796  /* Don't need scrolling, then update infoPtr->leftmostVisible */
     797  if(!infoPtr->needsScrolling)
     798    infoPtr->leftmostVisible = 0;
     799
    807800  TAB_SetupScrolling(hwnd, infoPtr, &clientRect);
    808801
     
    13791372    infoPtr->items[iItem].lParam = pti->lParam;
    13801373
     1374  TAB_SetItemBounds(hwnd);
    13811375  TAB_InvalidateTabArea(hwnd, infoPtr);
    13821376
     
    13841378//      hwnd, iItem, infoPtr->items[iItem].pszText);
    13851379
    1386   TAB_SetItemBounds(hwnd);
    13871380  return iItem;
    13881381}
     
    14461439    infoPtr->items[iItem].lParam = pti->lParam;
    14471440
     1441  TAB_SetItemBounds(hwnd);
    14481442  TAB_InvalidateTabArea(hwnd, infoPtr);
    14491443
     
    14511445//      hwnd, iItem, infoPtr->items[iItem].pszText);
    14521446
    1453   TAB_SetItemBounds(hwnd);
    14541447  return iItem;
    14551448}
     
    17831776  HDC hdc;
    17841777  HFONT hOldFont;
    1785 
    1786   infoPtr = (TAB_INFO *)COMCTL32_Alloc (sizeof(TAB_INFO));
    1787 
    1788   SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
     1778  DWORD dwStyle;
     1779
     1780  infoPtr = (TAB_INFO*)initControl(hwnd,sizeof(TAB_INFO));
    17891781
    17901782  infoPtr->uNumItem        = 0;
     
    18001792  infoPtr->leftmostVisible = 0;
    18011793
    1802 //  TRACE(tab, "Created tab control, hwnd [%04x]\n", hwnd);
    1803   if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_TOOLTIPS) {
    1804     /* Create tooltip control */
    1805     infoPtr->hwndToolTip =
    1806       CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
    1807                        CW_USEDEFAULT, CW_USEDEFAULT,
    1808                        CW_USEDEFAULT, CW_USEDEFAULT,
    1809                        hwnd, 0, 0, 0);
    1810 
    1811     /* Send NM_TOOLTIPSCREATED notification */
    1812     if (infoPtr->hwndToolTip) {
    1813       NMTOOLTIPSCREATED nmttc;
    1814 
    1815       nmttc.hdr.hwndFrom = hwnd;
    1816       nmttc.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
    1817       nmttc.hdr.code = NM_TOOLTIPSCREATED;
    1818       nmttc.hwndToolTips = infoPtr->hwndToolTip;
    1819 
    1820       SendMessageA (GetParent (hwnd), WM_NOTIFY,
    1821                     (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc);
    1822     }
    1823   }
     1794  /* The tab control always has the WS_CLIPSIBLINGS style. Even
     1795     if you don't specify in CreateWindow. This is necesary in
     1796     order for paint to work correctly. This follows windows behaviour. */
     1797  dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     1798  SetWindowLongA(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS);
     1799
     1800
     1801  /* Create tooltip control */
     1802  if (dwStyle & TCS_TOOLTIPS)
     1803    infoPtr->hwndToolTip = createToolTip(hwnd,0,FALSE);
    18241804
    18251805  /*
     
    18731853    DestroyWindow(infoPtr->hwndUpDown);
    18741854
    1875   COMCTL32_Free (infoPtr);
     1855  doneControl(hwnd);
     1856
    18761857  return 0;
    18771858}
     
    20442025//      ERR (tab, "unknown msg %04x wp=%08x lp=%08lx\n",
    20452026//           uMsg, wParam, lParam);
    2046       return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     2027      return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    20472028    }
    20482029
     
    20552036{
    20562037  WNDCLASSA wndClass;
    2057 
    2058 //SvL: Don't check this now
    2059 //  if (GlobalFindAtomA (WC_TABCONTROLA)) return;
    20602038
    20612039  ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     
    20752053TAB_Unregister (VOID)
    20762054{
    2077   if (GlobalFindAtomA (WC_TABCONTROLA))
    2078     UnregisterClassA (WC_TABCONTROLA, (HINSTANCE)NULL);
    2079 }
    2080 
     2055  UnregisterClassA (WC_TABCONTROLA, (HINSTANCE)NULL);
     2056}
     2057
Note: See TracChangeset for help on using the changeset viewer.