Changeset 45:f4a025bb42e9

Show
Ignore:
Timestamp:
02/02/08 12:33:51 (1 year ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

CoolBar?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/internal/win32/OS.d

    r44 r45  
    14051405    public static const int RDW_UPDATENOW = 0x100; 
    14061406    public static const int READ_CONTROL = 0x20000; 
    1407     public static const char[] REBARCLASSNAME = "ReBarWindow32"; //$NON-NLS-1$ 
     1407    public static const TCHAR[] REBARCLASSNAME = "ReBarWindow32"; //$NON-NLS-1$ 
    14081408    public static const int RGN_AND = 0x1; 
    14091409    public static const int RGN_COPY = 5; 
  • dwt/internal/win32/WINTYPES.d

    r44 r45  
    3737alias HANDLE HTHEME; 
    3838 
     39struct NMREBARCHILDSIZE { 
     40    NMHDR hdr; 
     41    UINT uBand; 
     42    UINT wID; 
     43    RECT rcChild; 
     44    RECT rcBand; 
     45} 
    3946// .... 
    4047//-------------------------------------------------------------------------------- 
  • dwt/widgets/CoolBar.d

    r31 r45  
    1515import dwt.widgets.Composite; 
    1616 
    17 class CoolBar : Composite { 
    18 
    19 /++ 
     17 
    2018import dwt.DWT; 
    2119import dwt.DWTException; 
    2220import dwt.graphics.Point; 
    2321import dwt.graphics.Rectangle; 
    24 import dwt.internal.win32.INITCOMMONCONTROLSEX; 
    25 import dwt.internal.win32.LRESULT; 
    26 import dwt.internal.win32.MARGINS; 
    27 import dwt.internal.win32.NMCUSTOMDRAW; 
    28 import dwt.internal.win32.NMHDR; 
    29 import dwt.internal.win32.NMREBARCHEVRON; 
    30 import dwt.internal.win32.NMREBARCHILDSIZE; 
    3122import dwt.internal.win32.OS; 
    32 import dwt.internal.win32.POINT; 
    33 import dwt.internal.win32.REBARBANDINFO; 
    34 import dwt.internal.win32.RECT; 
    35 import dwt.internal.win32.TCHAR; 
    36 import dwt.internal.win32.WNDCLASS; 
     23 
     24import dwt.widgets.Composite; 
     25import dwt.widgets.Control; 
     26import dwt.widgets.CoolItem; 
     27import dwt.widgets.Event; 
     28 
     29import dwt.dwthelper.utils; 
    3730 
    3831/** 
     
    6053 */ 
    6154 
    62 public class CoolBar extends Composite { 
     55public class CoolBar : Composite { 
     56 
    6357    CoolItem [] items; 
    6458    CoolItem [] originalItems; 
    6559    bool locked; 
    6660    bool ignoreResize; 
    67     static final int ReBarProc; 
    68     static final TCHAR ReBarClass = new TCHAR (0, OS.REBARCLASSNAME, true)
    69     static
    70         INITCOMMONCONTROLSEX icex = new INITCOMMONCONTROLSEX ()
     61    static const WNDPROC ReBarProc; 
     62    static const TCHAR* ReBarClass = OS.REBARCLASSNAME.ptr
     63    static this()
     64        INITCOMMONCONTROLSEX icex
    7165        icex.dwSize = INITCOMMONCONTROLSEX.sizeof; 
    7266        icex.dwICC = OS.ICC_COOL_CLASSES; 
    73         OS.InitCommonControlsEx (icex); 
    74         WNDCLASS lpWndClass = new WNDCLASS ()
    75         OS.GetClassInfo (0, ReBarClass, lpWndClass); 
     67        OS.InitCommonControlsEx (&icex); 
     68        WNDCLASS lpWndClass
     69        OS.GetClassInfo (null, ReBarClass, &lpWndClass); 
    7670        ReBarProc = lpWndClass.lpfnWndProc; 
    7771    } 
    78     static final int SEPARATOR_WIDTH = 2; 
    79     static final int MAX_WIDTH = 0x7FFF; 
    80     static final int DEFAULT_COOLBAR_WIDTH = 0; 
    81     static final int DEFAULT_COOLBAR_HEIGHT = 0; 
     72    static const int SEPARATOR_WIDTH = 2; 
     73    static const int MAX_WIDTH = 0x7FFF; 
     74    static const int DEFAULT_COOLBAR_WIDTH = 0; 
     75    static const int DEFAULT_COOLBAR_HEIGHT = 0; 
    8276 
    8377/** 
     
    109103 * @see Widget#getStyle 
    110104 */ 
    111 public CoolBar (Composite parent, int style) { 
     105public this (Composite parent, int style) { 
    112106    super (parent, checkStyle (style)); 
    113107    /* 
     
    131125} 
    132126 
    133 int callWindowProc (int hwnd, int msg, int wParam, int lParam) { 
    134     if (handle is 0) return 0
    135     return OS.CallWindowProc (ReBarProc, hwnd, msg, wParam, lParam); 
     127LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { 
     128    if (handle is null) return LRESULT.NULL
     129    return cast(LRESULT) OS.CallWindowProc (ReBarProc, hwnd, msg, wParam, lParam); 
    136130} 
    137131 
     
    175169            } 
    176170        } 
    177         RECT oldRect = new RECT ()
    178         OS.GetWindowRect (handle, oldRect); 
     171        RECT oldRect
     172        OS.GetWindowRect (handle, &oldRect); 
    179173        int oldWidth = oldRect.right - oldRect.left; 
    180174        int oldHeight = oldRect.bottom - oldRect.top; 
    181175        int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOREDRAW | OS.SWP_NOZORDER; 
    182         SetWindowPos (handle, 0, 0, 0, newWidth, newHeight, flags); 
    183         RECT rect = new RECT ()
    184         OS.SendMessage (handle, OS.RB_GETRECT, count - 1, rect); 
     176        SetWindowPos (handle, null, 0, 0, newWidth, newHeight, flags); 
     177        RECT rect
     178        OS.SendMessage (handle, OS.RB_GETRECT, count - 1, &rect); 
    185179        height = Math.max (height, rect.bottom); 
    186         SetWindowPos (handle, 0, 0, 0, oldWidth, oldHeight, flags); 
    187         REBARBANDINFO rbBand = new REBARBANDINFO ()
     180        SetWindowPos (handle, null, 0, 0, oldWidth, oldHeight, flags); 
     181        REBARBANDINFO rbBand
    188182        rbBand.cbSize = REBARBANDINFO.sizeof; 
    189183        rbBand.fMask = OS.RBBIM_IDEALSIZE | OS.RBBIM_STYLE; 
    190184        int rowWidth = 0; 
    191185        for (int i = 0; i < count; i++) { 
    192             OS.SendMessage(handle, OS.RB_GETBANDINFO, i, rbBand); 
     186            OS.SendMessage(handle, OS.RB_GETBANDINFO, i, &rbBand); 
    193187            if ((rbBand.fStyle & OS.RBBS_BREAK) !is 0) { 
    194188                width = Math.max(width, rowWidth); 
     
    237231    * create. 
    238232    */ 
    239     int hFont = OS.GetStockObject (OS.SYSTEM_FONT); 
     233    auto hFont = OS.GetStockObject (OS.SYSTEM_FONT); 
    240234    OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0); 
    241235} 
     
    251245        items = newItems; 
    252246    } 
    253     int hHeap = OS.GetProcessHeap (); 
    254     int lpText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof); 
    255     REBARBANDINFO rbBand = new REBARBANDINFO ()
     247    auto hHeap = OS.GetProcessHeap (); 
     248    auto lpText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof); 
     249    REBARBANDINFO rbBand
    256250    rbBand.cbSize = REBARBANDINFO.sizeof; 
    257251    rbBand.fMask = OS.RBBIM_TEXT | OS.RBBIM_STYLE | OS.RBBIM_ID; 
     
    290284 
    291285    /* Insert the item */ 
    292     if (OS.SendMessage (handle, OS.RB_INSERTBAND, index, rbBand) is 0) { 
     286    if (OS.SendMessage (handle, OS.RB_INSERTBAND, index, &rbBand) is 0) { 
    293287        error (DWT.ERROR_ITEM_NOT_ADDED); 
    294288    } 
     
    381375} 
    382376 
    383 void drawThemeBackground (int hDC, int hwnd, RECT rect) { 
     377void drawThemeBackground (HDC hDC, HWND hwnd, RECT* rect) { 
    384378    if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { 
    385379        if (background is -1 && (style & DWT.FLAT) !is 0) { 
     
    391385        } 
    392386    } 
    393     RECT rect2 = new RECT ()
    394     OS.GetClientRect (handle, rect2); 
    395     OS.MapWindowPoints (handle, hwnd, rect2, 2); 
    396     POINT lpPoint = new POINT ()
    397     OS.SetWindowOrgEx (hDC, -rect2.left, -rect2.top, lpPoint); 
     387    RECT rect2
     388    OS.GetClientRect (handle, &rect2); 
     389    OS.MapWindowPoints (handle, hwnd, cast(POINT*) &rect2, 2); 
     390    POINT lpPoint
     391    OS.SetWindowOrgEx (hDC, -rect2.left, -rect2.top, &lpPoint); 
    398392    OS.SendMessage (handle, OS.WM_PRINT, hDC, OS.PRF_CLIENT | OS.PRF_ERASEBKGND); 
    399393    OS.SetWindowOrgEx (hDC, lpPoint.x, lpPoint.y, null); 
     
    408402    int margin = 0; 
    409403    if (OS.COMCTL32_MAJOR >= 6) { 
    410         MARGINS margins = new MARGINS ()
    411         OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, margins); 
     404        MARGINS margins
     405        OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, &margins); 
    412406        margin += margins.cxLeftWidth + margins.cxRightWidth; 
    413407    } 
    414     RECT rect = new RECT ()
    415     OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, rect); 
     408    RECT rect
     409    OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, &rect); 
    416410    if ((style & DWT.FLAT) !is 0) { 
    417411        /* 
     
    460454    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    461455    if (!(0 <= index && index < count)) error (DWT.ERROR_INVALID_RANGE); 
    462     REBARBANDINFO rbBand = new REBARBANDINFO ()
     456    REBARBANDINFO rbBand
    463457    rbBand.cbSize = REBARBANDINFO.sizeof; 
    464458    rbBand.fMask = OS.RBBIM_ID; 
    465     OS.SendMessage (handle, OS.RB_GETBANDINFO, index, rbBand); 
     459    OS.SendMessage (handle, OS.RB_GETBANDINFO, index, &rbBand); 
    466460    return items [rbBand.wID]; 
    467461} 
     
    507501    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    508502    int [] indices = new int [count]; 
    509     REBARBANDINFO rbBand = new REBARBANDINFO ()
     503    REBARBANDINFO rbBand
    510504    rbBand.cbSize = REBARBANDINFO.sizeof; 
    511505    rbBand.fMask = OS.RBBIM_ID; 
    512506    for (int i=0; i<count; i++) { 
    513         OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); 
     507        OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); 
    514508        CoolItem item = items [rbBand.wID]; 
    515509        int index = 0; 
     
    544538    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    545539    CoolItem [] result = new CoolItem [count]; 
    546     REBARBANDINFO rbBand = new REBARBANDINFO ()
     540    REBARBANDINFO rbBand
    547541    rbBand.cbSize = REBARBANDINFO.sizeof; 
    548542    rbBand.fMask = OS.RBBIM_ID; 
    549543    for (int i=0; i<count; i++) { 
    550         OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); 
     544        OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); 
    551545        result [i] = items [rbBand.wID]; 
    552546    } 
     
    570564    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    571565    Point [] sizes = new Point [count]; 
    572     REBARBANDINFO rbBand = new REBARBANDINFO ()
     566    REBARBANDINFO rbBand
    573567    rbBand.cbSize = REBARBANDINFO.sizeof; 
    574568    rbBand.fMask = OS.RBBIM_CHILDSIZE; 
    575569    int separator = (style & DWT.FLAT) is 0 ? SEPARATOR_WIDTH : 0; 
    576     MARGINS margins = new MARGINS ()
     570    MARGINS margins
    577571    for (int i=0; i<count; i++) { 
    578         RECT rect = new RECT ()
    579         OS.SendMessage (handle, OS.RB_GETRECT, i, rect); 
    580         OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); 
     572        RECT rect
     573        OS.SendMessage (handle, OS.RB_GETRECT, i, &rect); 
     574        OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); 
    581575        if (OS.COMCTL32_MAJOR >= 6) { 
    582             OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, margins); 
     576            OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, &margins); 
    583577            rect.left -= margins.cxLeftWidth; 
    584578            rect.right += margins.cxRightWidth; 
     
    597591    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    598592    if (count is 0) return -1; 
    599     REBARBANDINFO rbBand = new REBARBANDINFO ()
     593    REBARBANDINFO rbBand
    600594    rbBand.cbSize = REBARBANDINFO.sizeof; 
    601595    rbBand.fMask = OS.RBBIM_STYLE; 
    602596    for (int i=index + 1; i<count; i++) { 
    603         OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); 
     597        OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); 
    604598        if ((rbBand.fStyle & OS.RBBS_BREAK) !is 0) { 
    605599            return i - 1; 
     
    612606    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    613607    if (index + 1 is count) return true; 
    614     REBARBANDINFO rbBand = new REBARBANDINFO ()
     608    REBARBANDINFO rbBand
    615609    rbBand.cbSize = REBARBANDINFO.sizeof; 
    616610    rbBand.fMask = OS.RBBIM_STYLE; 
    617     OS.SendMessage (handle, OS.RB_GETBANDINFO, index + 1, rbBand); 
     611    OS.SendMessage (handle, OS.RB_GETBANDINFO, index + 1, &rbBand); 
    618612    return (rbBand.fStyle & OS.RBBS_BREAK) !is 0; 
    619613} 
     
    696690    int count = OS.SendMessage(handle, OS.RB_GETBANDCOUNT, 0, 0); 
    697691    if (0 <= index && index < count) { 
    698         REBARBANDINFO rbBand = new REBARBANDINFO()
     692        REBARBANDINFO rbBand
    699693        rbBand.cbSize = REBARBANDINFO.sizeof; 
    700694        rbBand.fMask = OS.RBBIM_IDEALSIZE; 
    701         OS.SendMessage (handle, OS.RB_GETBANDINFO, index, rbBand); 
    702         RECT rect = new RECT ()
    703         OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, rect); 
     695        OS.SendMessage (handle, OS.RB_GETBANDINFO, index, &rbBand); 
     696        RECT rect
     697        OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, &rect); 
    704698        rbBand.cx = rbBand.cxIdeal + rect.left; 
    705699        if ((style & DWT.FLAT) is 0) rbBand.cx += rect.right; 
    706700        rbBand.fMask = OS.RBBIM_SIZE; 
    707         OS.SendMessage (handle, OS.RB_SETBANDINFO, index, rbBand); 
     701        OS.SendMessage (handle, OS.RB_SETBANDINFO, index, &rbBand); 
    708702    } 
    709703} 
    710704 
    711705void resizeToMaximumWidth (int index) { 
    712     REBARBANDINFO rbBand = new REBARBANDINFO()
     706    REBARBANDINFO rbBand
    713707    rbBand.cbSize = REBARBANDINFO.sizeof; 
    714708    rbBand.fMask = OS.RBBIM_SIZE; 
    715709    rbBand.cx = MAX_WIDTH; 
    716     OS.SendMessage (handle, OS.RB_SETBANDINFO, index, rbBand); 
     710    OS.SendMessage (handle, OS.RB_SETBANDINFO, index, &rbBand); 
    717711} 
    718712 
     
    755749    } else { 
    756750        int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; 
    757         OS.RedrawWindow (handle, null, 0, flags); 
     751        OS.RedrawWindow (handle, null, null, flags); 
    758752    } 
    759753} 
     
    767761void setItemColors (int foreColor, int backColor) { 
    768762    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    769     REBARBANDINFO rbBand = new REBARBANDINFO ()
     763    REBARBANDINFO rbBand
    770764    rbBand.cbSize = REBARBANDINFO.sizeof; 
    771765    rbBand.fMask = OS.RBBIM_COLORS; 
     
    773767    rbBand.clrBack = backColor; 
    774768    for (int i=0; i<count; i++) { 
    775         OS.SendMessage (handle, OS.RB_SETBANDINFO, i, rbBand); 
     769        OS.SendMessage (handle, OS.RB_SETBANDINFO, i, &rbBand); 
    776770    } 
    777771} 
     
    850844    } 
    851845 
    852     REBARBANDINFO rbBand = new REBARBANDINFO ()
    853     rbBand.cbSize = REBARBANDINFO.sizeof; 
     846    //REBARBANDINFO rbBand
     847    //rbBand.cbSize = REBARBANDINFO.sizeof; 
    854848    for (int i=0; i<itemOrder.length; i++) { 
    855849        int id = originalItems [itemOrder [i]].id; 
     
    899893    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    900894    if (sizes.length !is count) error (DWT.ERROR_INVALID_ARGUMENT); 
    901     REBARBANDINFO rbBand = new REBARBANDINFO ()
     895    REBARBANDINFO rbBand
    902896    rbBand.cbSize = REBARBANDINFO.sizeof; 
    903897    rbBand.fMask = OS.RBBIM_ID; 
    904898    for (int i=0; i<count; i++) { 
    905         OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); 
     899        OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); 
    906900        items [rbBand.wID].setSize (sizes [i].x, sizes [i].y); 
    907901    } 
     
    925919    this.locked = locked; 
    926920    int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); 
    927     REBARBANDINFO rbBand = new REBARBANDINFO ()
     921    REBARBANDINFO rbBand
    928922    rbBand.cbSize = REBARBANDINFO.sizeof; 
    929923    rbBand.fMask = OS.RBBIM_STYLE; 
    930924    for (int i=0; i<count; i++) { 
    931         OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand); 
     925        OS.SendMessage (handle, OS.RB_GETBANDINFO, i, &rbBand); 
    932926        if (locked) { 
    933927            rbBand.fStyle |= OS.RBBS_NOGRIPPER; 
     
    935929            rbBand.fStyle &= ~OS.RBBS_NOGRIPPER; 
    936930        } 
    937         OS.SendMessage (handle, OS.RB_SETBANDINFO, i, rbBand); 
     931        OS.SendMessage (handle, OS.RB_SETBANDINFO, i, &rbBand); 
    938932    } 
    939933} 
     
    991985} 
    992986 
    993 TCHAR windowClass () { 
    994     return ReBarClass
     987char[] windowClass () { 
     988    return TCHARzToStr( ReBarClass )
    995989} 
    996990 
    997991int windowProc () { 
    998     return ReBarProc; 
     992    return cast(int) ReBarProc; 
    999993} 
    1000994 
     
    10191013    */ 
    10201014    LRESULT result = super.WM_COMMAND (wParam, lParam); 
    1021     if (result !is null) return result; 
     1015    if (result !is LRESULT.NULL) return result; 
    10221016    return LRESULT.ZERO; 
    10231017} 
     
    10391033    */ 
    10401034    if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { 
    1041         drawBackground (wParam); 
    1042         return null
     1035        drawBackground ( cast(HDC) wParam); 
     1036        return LRESULT.NULL
    10431037    } 
    10441038    return result; 
     
    10651059    */ 
    10661060    LRESULT result = super.WM_NOTIFY (wParam, lParam); 
    1067     if (result !is null) return result; 
     1061    if (result !is LRESULT.NULL) return result; 
    10681062    return LRESULT.ZERO; 
    10691063} 
     
    10711065LRESULT WM_SETREDRAW (int wParam, int lParam) { 
    10721066    LRESULT result = super.WM_SETREDRAW (wParam, lParam); 
    1073     if (result !is null) return result; 
     1067    if (result !is LRESULT.NULL) return result; 
    10741068    /* 
    10751069    * Feature in Windows.  When redraw is turned off, the rebar 
     
    10951089    int code = callWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam); 
    10961090    OS.DefWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam); 
    1097     if (!rect.equals (getBounds ())) { 
     1091    if ( rect != getBounds ()) { 
    10981092        parent.redraw (rect.x, rect.y, rect.width, rect.height, true); 
    10991093    } 
    1100     return new LRESULT (code); 
     1094    return cast( LRESULT )(code); 
    11011095} 
    11021096 
     
    11051099        int code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam); 
    11061100        if (code is 0) return LRESULT.ZERO; 
    1107         return new LRESULT (code); 
     1101        return cast( LRESULT )(code); 
    11081102    } 
    11091103    //TEMPORARY CODE 
     
    11161110} 
    11171111 
    1118 LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) { 
     1112LRESULT wmNotifyChild (NMHDR* hdr, int wParam, int lParam) { 
    11191113    switch (hdr.code) { 
    11201114        case OS.RBN_BEGINDRAG: { 
    11211115            int pos = OS.GetMessagePos (); 
    1122             POINT pt = new POINT ()
    1123             pt.x = (short) (pos & 0xFFFF); 
    1124             pt.y = (short) (pos >> 16); 
    1125             OS.ScreenToClient (handle, pt); 
     1116            POINT pt
     1117            pt.x = cast(short) (pos & 0xFFFF); 
     1118            pt.y = cast(short) (pos >> 16); 
     1119            OS.ScreenToClient (handle, &pt); 
    11261120            int button = display.lastButton !is 0 ? display.lastButton : 1; 
    11271121            if (!sendDragEvent (button, pt.x, pt.y)) return LRESULT.ONE; 
     
    11381132            * recalculated. 
    11391133            */ 
    1140             NMREBARCHILDSIZE lprbcs  = new NMREBARCHILDSIZE ()
    1141             OS.MoveMemory (lprbcs, lParam, NMREBARCHILDSIZE.sizeof); 
     1134            NMREBARCHILDSIZE* lprbcs = cast(NMREBARCHILDSIZE*)lParam
     1135            //OS.MoveMemory (lprbcs, lParam, NMREBARCHILDSIZE.sizeof); 
    11421136            if (lprbcs.uBand !is -1) { 
    11431137                CoolItem item = items [lprbcs.wID]; 
    11441138                Control control = item.control; 
    11451139                if (control !is null) { 
    1146                     int width = lprbcs.rcChild_right - lprbcs.rcChild_left; 
    1147                     int height = lprbcs.rcChild_bottom - lprbcs.rcChild_top; 
    1148                     control.setBounds (lprbcs.rcChild_left, lprbcs.rcChild_top, width, height); 
     1140                    int width = lprbcs.rcChild.right - lprbcs.rcChild.left; 
     1141                    int height = lprbcs.rcChild.bottom - lprbcs.rcChild.top; 
     1142                    control.setBounds (lprbcs.rcChild.left, lprbcs.rcChild.top, width, height); 
    11491143                } 
    11501144            } 
     
    11651159        } 
    11661160        case OS.RBN_CHEVRONPUSHED: { 
    1167             NMREBARCHEVRON lpnm = new NMREBARCHEVRON ()
    1168             OS.MoveMemory (lpnm, lParam, NMREBARCHEVRON.sizeof); 
     1161            NMREBARCHEVRON* lpnm = cast(NMREBARCHEVRON*)lParam
     1162            //OS.MoveMemory (lpnm, lParam, NMREBARCHEVRON.sizeof); 
    11691163            CoolItem item = items [lpnm.wID]; 
    11701164            if (item !is null) { 
     
    11721166                event.detail = DWT.ARROW; 
    11731167                if ((style & DWT.VERTICAL) !is 0) { 
    1174                     event.x = lpnm.right; 
    1175                     event.y = lpnm.top; 
     1168                    event.x = lpnm.rc.right; 
     1169                    event.y = lpnm.rc.top; 
    11761170                } else { 
    1177                     event.x = lpnm.left; 
    1178                     event.y = lpnm.bottom; 
     1171                    event.x = lpnm.rc.left; 
     1172                    event.y = lpnm.rc.bottom; 
    11791173                } 
    11801174                item.postEvent (DWT.Selection, event); 
     
    11911185            if (OS.COMCTL32_MAJOR < 6) break; 
    11921186            if (findBackgroundControl () !is null || (style & DWT.FLAT) !is 0) { 
    1193                 NMCUSTOMDRAW nmcd = new NMCUSTOMDRAW ()
    1194                 OS.MoveMemory (nmcd, lParam, NMCUSTOMDRAW.sizeof); 
     1187                NMCUSTOMDRAW* nmcd = cast(NMCUSTOMDRAW*)lParam
     1188                //OS.MoveMemory (nmcd, lParam, NMCUSTOMDRAW.sizeof); 
    11951189                switch (nmcd.dwDrawStage) { 
    11961190                    case OS.CDDS_PREERASE: 
    1197                         return new LRESULT (OS.CDRF_SKIPDEFAULT | OS.CDRF_NOTIFYPOSTERASE); 
     1191                        return cast(LRESULT) (OS.CDRF_SKIPDEFAULT | OS.CDRF_NOTIFYPOSTERASE); 
    11981192                    case OS.CDDS_POSTERASE: 
    11991193                        drawBackground (nmcd.hdc); 
     
    12071201} 
    12081202} 
    1209 ++/ 
  • dwt/widgets/CoolItem.d

    r31 r45  
    1616import dwt.widgets.Widget; 
    1717 
    18 class CoolItem : Item { 
     18import dwt.events.SelectionListener; 
     19import dwt.graphics.Point; 
     20import dwt.graphics.Rectangle; 
     21import dwt.widgets.Control; 
     22import dwt.widgets.CoolBar; 
     23import dwt.widgets.Item; 
     24class  CoolItem : Item { 
    1925    public this (Widget parent, int style) { 
    2026        super (parent, style); 
    2127    } 
     28    Rectangle getClientArea(); 
     29    override void checkSubclass(); 
     30    Point computeSize(int, int); 
     31    override void destroyWidget(); 
     32    override void releaseHandle(); 
     33    void setControl(Control); 
     34    bool getWrap(); 
     35    void setWrap(bool); 
     36    CoolBar getParent(); 
     37    Point getSize(); 
     38    void setSize(int, int); 
     39    void setSize(Point); 
     40    Rectangle getBounds(); 
     41    Point getMinimumSize(); 
     42    Point getPreferredSize(); 
     43    void setMinimumSize(int, int); 
     44    void setMinimumSize(Point); 
     45    void setPreferredSize(int, int); 
     46    void setPreferredSize(Point); 
     47    Control getControl(); 
     48    void addSelectionListener(SelectionListener); 
     49    void removeSelectionListener(SelectionListener); 
     50    CoolBar parent; 
     51    Control control; 
     52    int id; 
     53    bool ideal; 
     54    bool minimum; 
    2255} 
    2356/++ 
  • dwt/widgets/ExpandItem.d

    r31 r45  
    1616import dwt.widgets.Widget; 
    1717 
    18 class ExpandItem : Item { 
     18import dwt.graphics.GC; 
     19import dwt.graphics.Image; 
     20import dwt.internal.win32.OS; 
     21import dwt.widgets.Control; 
     22import dwt.widgets.ExpandBar; 
     23import dwt.widgets.Item; 
     24class  ExpandItem : Item { 
    1925    public this (Widget parent, int style) { 
    2026        super (parent, style); 
    2127    } 
    22 
     28    void redraw(bool); 
     29    override void releaseWidget(); 
     30    override void destroyWidget(); 
     31    override void releaseHandle(); 
     32    bool getExpanded(); 
     33    void setControl(Control); 
     34    void drawItem(GC, int, RECT, bool); 
     35    bool isHover(int, int); 
     36    void setExpanded(bool); 
     37    ExpandBar getParent(); 
     38    void setBounds(int, int, int, int, bool, bool); 
     39    int getHeight(); 
     40    override void setText(char[]); 
     41    Control getControl(); 
     42    void setHeight(int); 
     43    override void setImage(Image); 
     44    int getPreferredWidth(int, int); 
     45    int getHeaderHeight(); 
     46    ExpandBar parent; 
     47    Control control; 
     48    bool expanded; 
     49    bool hover; 
     50    int x; 
     51    int y; 
     52    int width; 
     53    int height; 
     54    int imageHeight; 
     55    int imageWidth; 
     56    static int TEXT_INSET; 
     57    static int BORDER; 
     58    static int CHEVRON_SIZE; 
     59
     60 
    2361/++ 
    2462import dwt.DWT;