Changeset 12

Show
Ignore:
Timestamp:
11/19/07 10:41:47 (10 months ago)
Author:
Chris Miller
Message:

Small updates.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/win32/dfl/base.d

    r7 r12  
    689689enum ColorDepth: ubyte 
    690690{ 
    691     DEPTH_4BIT = 1, /// 
    692     DEPTH_8BIT , /// ditto 
    693     DEPTH_16BIT, /// ditto 
    694     DEPTH_24BIT, /// ditto 
    695     DEPTH_32BIT, /// ditto 
     691    DEPTH_4BIT = 0x04, /// 
     692    DEPTH_8BIT = 0x08, /// ditto 
     693    DEPTH_16BIT = 0x10, /// ditto 
     694    DEPTH_24BIT = 0x18, /// ditto 
     695    DEPTH_32BIT = 0x20, /// ditto 
    696696} 
    697697 
  • trunk/win32/dfl/control.d

    r11 r12  
    162162     
    163163    WANT_TAB_KEY = 0x01000000, 
     164    WANT_ALL_KEYS = 0x02000000, 
    164165} 
    165166 
     
    45384539                    scope MouseEventArgs mea = new MouseEventArgs(MouseButtons.LEFT, 1, cast(short)LOWORD(msg.lParam), cast(short)HIWORD(msg.lParam), 0); 
    45394540                    onMouseDown(mea); 
     4541                     
     4542                    if(ctrlStyle & ControlStyles.SELECTABLE) 
     4543                        SetFocus(hwnd); 
    45404544                } 
    45414545                break; 
     
    50465050                    } 
    50475051                     
     5052                    /+ 
     5053                    if(msg.lParam) 
     5054                    { 
     5055                        Message m; 
     5056                        m._winMsg = *cast(MSG*)msg.lParam; 
     5057                        if(processKeyEventArgs(m)) 
     5058                            return; 
     5059                    } 
     5060                    +/ 
     5061                     
    50485062                    defWndProc(msg); 
     5063                     
     5064                    if(ctrlStyle & ControlStyles.WANT_ALL_KEYS) 
     5065                        msg.result |= DLGC_WANTALLKEYS; 
     5066                     
    50495067                    // Only want chars if ALT isn't down, because it would break mnemonics. 
    50505068                    if(!(GetAsyncKeyState(VK_MENU) & 0x8000)) 
    50515069                        msg.result |= DLGC_WANTCHARS; 
     5070                     
    50525071                    return; 
    50535072                } 
    5054                  
    50555073                break; 
    50565074             
     
    51385156            debug 
    51395157            { 
    5140                 // If overriding onHandleCreated(), be sure to call super.onHandleCreated()! 
    5141                 assert(_handlecreated); 
     5158                assert(_handlecreated, "If overriding onHandleCreated(), be sure to call super.onHandleCreated()!"); 
    51425159            } 
    51435160            handleCreated(this, ea); 
     
    63946411     
    63956412    /// 
    6396     protected bool processKeyEventArgs(inout Message msg) // package 
     6413    protected bool processKeyEventArgs(inout Message msg) 
    63976414    { 
    63986415        switch(msg.msg) 
     
    64556472        } 
    64566473         
     6474        /+ 
    64576475        if(Application._compat & DflCompat.CONTROL_KEYEVENT_096) 
    64586476            goto def_action; 
     
    64776495         
    64786496        return false; 
     6497        +/ 
     6498        defWndProc(msg); 
     6499        //return true; 
     6500        return !msg.result; 
    64796501    } 
    64806502     
  • trunk/win32/dfl/form.d

    r11 r12  
    170170         
    171171        _shortcuts[shortcut] = pressed; 
     172    } 
     173     
     174    /// ditto 
     175    // Delegate parameter contravariance. 
     176    final void addShortcut(Keys shortcut, void delegate(Object sender, EventArgs ea) pressed) 
     177    { 
     178        return addShortcut(shortcut, cast(void delegate(Object sender, FormShortcutEventArgs ea))pressed); 
    172179    } 
    173180     
     
    884891     
    885892     
     893    /// 
     894    protected MdiClient createMdiClient() 
     895    { 
     896        version(NO_MDI) 
     897        { 
     898            assert(0, "MDI disabled"); 
     899            return null; 
     900        } 
     901        else 
     902        { 
     903            return new MdiClient(); 
     904        } 
     905    } 
     906     
     907     
    886908    version(NO_MDI) {} else 
    887909    { 
     
    895917                    // Remove MDI client. 
    896918                    mdiClient.dispose(); 
    897                     mdiClient = null; 
     919                    //mdiClient = null; 
     920                    _mdiClient = null; 
    898921                } 
    899922            } 
     
    903926                { 
    904927                    // Create MDI client. 
    905                     mdiClient = new MdiClient; 
     928                    //mdiClient = new MdiClient; 
     929                    //_mdiClient = new MdiClient; 
     930                    //mdiClient = createMdiClient(); 
     931                    _mdiClient = createMdiClient(); 
    906932                    mdiClient.parent = this; 
    907933                } 
     
    912938        final bool isMdiContainer() // getter 
    913939        { 
    914             return !(mdiClient is null); 
     940            version(NO_MDI) 
     941            { 
     942                return false; 
     943            } 
     944            else 
     945            { 
     946                return !(mdiClient is null); 
     947            } 
    915948        } 
    916949         
     
    919952        final Form[] mdiChildren() // getter 
    920953        { 
    921             /+ 
    922             if(!mdiClient) 
     954            version(NO_MDI) 
     955            { 
    923956                return null; 
    924             +/ 
    925              
    926             return _mdiChildren; 
     957            } 
     958            else 
     959            { 
     960                /+ 
     961                if(!mdiClient) 
     962                    return null; 
     963                +/ 
     964                 
     965                return _mdiChildren; 
     966            } 
    927967        } 
    928968         
     
    931971         
    932972         
    933         /// 
    934         final void mdiParent(Form frm) // setter 
    935         in 
    936         { 
    937             if(frm) 
    938             { 
    939                 assert(frm.isMdiContainer); 
    940                 assert(!(frm.mdiClient is null)); 
    941             } 
    942         } 
    943         /+out 
    944         { 
    945             if(frm) 
    946             { 
    947                 bool found = false; 
    948                 foreach(Form elem; frm._mdiChildren) 
    949                 { 
    950                     if(elem is this
     973        version(NO_MDI) {} else 
     974        { 
     975           /// 
     976           final void mdiParent(Form frm) // setter 
     977            in 
     978            { 
     979                if(frm) 
     980                { 
     981                   assert(frm.isMdiContainer); 
     982                   assert(!(frm.mdiClient is null)); 
     983               } 
     984           } 
     985            /+out 
     986            { 
     987                if(frm) 
     988                { 
     989                   bool found = false; 
     990                    foreach(Form elem; frm._mdiChildren
    951991                    { 
    952                         found = true; 
    953                         break; 
     992                        if(elem is this) 
     993                        { 
     994                            found = true; 
     995                            break; 
     996                        } 
    954997                    } 
    955                 } 
    956                 assert(found); 
    957             } 
    958         }+/ 
    959         body 
    960         { 
    961             if(wmdiparent is frm) 
    962                 return; 
    963              
    964             _removeFromOldOwner(); 
    965             wowner = null; 
    966             wmdiparent = null; // Safety in case of exception. 
    967              
    968             if(frm) 
    969             { 
    970                 if(isHandleCreated) 
    971                 { 
    972                     frm.createControl(); // ? 
    973                     frm.mdiClient.createControl(); // Should already be done from frm.createControl(). 
    974                 } 
     998                    assert(found); 
     999                } 
     1000            }+/ 
     1001            body 
     1002            { 
     1003                if(wmdiparent is frm) 
     1004                    return; 
    9751005                 
    976                 // Copy so that old mdiChildren arrays won't get overwritten. 
    977                 Form[] _thisa = new Form[1]; // DMD 0.123: this can't be a static array or the append screws up. 
    978                 _thisa[0] = this; 
    979                 frm._mdiChildren = frm._mdiChildren ~ _thisa; 
     1006                _removeFromOldOwner(); 
     1007                wowner = null; 
     1008                wmdiparent = null; // Safety in case of exception. 
    9801009                 
    981                 _style((_style() | WS_CHILD) & ~WS_POPUP); 
    982                 _exStyle(_exStyle() | WS_EX_MDICHILD); 
    983                  
    984                 wparent = frm.mdiClient; 
    985                 wmdiparent = frm; 
    986                 if(isHandleCreated) 
    987                     SetParent(hwnd, frm.mdiClient.hwnd); 
    988             } 
    989             else 
    990             { 
    991                 _exStyle(_exStyle() & ~WS_EX_MDICHILD); 
    992                 _style((_style() | WS_POPUP) & ~WS_CHILD); 
    993                  
    994                 if(isHandleCreated) 
    995                     SetParent(hwnd, HWND.init); 
    996                 wparent = null; 
    997                  
    998                 //wmdiparent = null; 
     1010                if(frm) 
     1011                { 
     1012                    if(isHandleCreated) 
     1013                    { 
     1014                        frm.createControl(); // ? 
     1015                        frm.mdiClient.createControl(); // Should already be done from frm.createControl(). 
     1016                    } 
     1017                     
     1018                    // Copy so that old mdiChildren arrays won't get overwritten. 
     1019                    Form[] _thisa = new Form[1]; // DMD 0.123: this can't be a static array or the append screws up. 
     1020                    _thisa[0] = this; 
     1021                    frm._mdiChildren = frm._mdiChildren ~ _thisa; 
     1022                     
     1023                    _style((_style() | WS_CHILD) & ~WS_POPUP); 
     1024                    _exStyle(_exStyle() | WS_EX_MDICHILD); 
     1025                     
     1026                    wparent = frm.mdiClient; 
     1027                    wmdiparent = frm; 
     1028                    if(isHandleCreated) 
     1029                        SetParent(hwnd, frm.mdiClient.hwnd); 
     1030                } 
     1031                else 
     1032                { 
     1033                    _exStyle(_exStyle() & ~WS_EX_MDICHILD); 
     1034                    _style((_style() | WS_POPUP) & ~WS_CHILD); 
     1035                     
     1036                    if(isHandleCreated) 
     1037                        SetParent(hwnd, HWND.init); 
     1038                    wparent = null; 
     1039                     
     1040                    //wmdiparent = null; 
     1041                } 
    9991042            } 
    10001043        } 
     
    10031046        final Form mdiParent() // getter 
    10041047        { 
    1005             //if(isMdiChild) 
    1006                 return wmdiparent; 
     1048            version(NO_MDI) 
     1049            { 
     1050            } 
     1051            else 
     1052            { 
     1053                //if(isMdiChild) 
     1054                    return wmdiparent; 
     1055            } 
    10071056            return null; 
    10081057        } 
     
    25932642     
    25942643     
     2644    version(NO_MDI) {} else 
     2645    { 
     2646        protected final MdiClient mdiClient() // getter 
     2647        { return _mdiClient; } 
     2648    } 
     2649     
     2650     
    25952651    private: 
    25962652    IButtonControl acceptBtn, cancelBtn; 
     
    26192675    version(NO_MDI) {} else 
    26202676    { 
    2621         MdiClient mdiClient = null; // null == not MDI container. 
     2677        MdiClient _mdiClient = null; // null == not MDI container. 
    26222678    } 
    26232679     
     
    28272883version(NO_MDI) {} else 
    28282884{ 
    2829     // //
     2885    //
    28302886    class MdiClient: ControlSuperClass 
    28312887    { 
     
    28392895             
    28402896            dock = DockStyle.FILL; 
     2897        } 
     2898         
     2899         
     2900        /// 
     2901        void borderStyle(BorderStyle bs) // setter 
     2902        { 
     2903            switch(bs) 
     2904            { 
     2905                case BorderStyle.FIXED_3D: 
     2906                    _style(_style() & ~WS_BORDER); 
     2907                    _exStyle(_exStyle() | WS_EX_CLIENTEDGE); 
     2908                    break; 
     2909                     
     2910                case BorderStyle.FIXED_SINGLE: 
     2911                    _exStyle(_exStyle() & ~WS_EX_CLIENTEDGE); 
     2912                    _style(_style() | WS_BORDER); 
     2913                    break; 
     2914                     
     2915                case BorderStyle.NONE: 
     2916                    _style(_style() & ~WS_BORDER); 
     2917                    _exStyle(_exStyle() & ~WS_EX_CLIENTEDGE); 
     2918                    break; 
     2919            } 
     2920 
     2921            if(isHandleCreated) 
     2922            { 
     2923                redrawEntire(); 
     2924            } 
     2925        } 
     2926 
     2927        /// ditto 
     2928        BorderStyle borderStyle() // getter 
     2929        { 
     2930            if(_exStyle() & WS_EX_CLIENTEDGE) 
     2931                return BorderStyle.FIXED_3D; 
     2932            else if(_style() & WS_BORDER) 
     2933                return BorderStyle.FIXED_SINGLE; 
     2934            return BorderStyle.NONE; 
     2935        } 
     2936         
     2937         
     2938        /// 
     2939        final void hScroll(bool byes) // setter 
     2940        { 
     2941            LONG wl = _style(); 
     2942            if(byes) 
     2943                wl |= WS_HSCROLL; 
     2944            else 
     2945                wl &= ~WS_HSCROLL; 
     2946            _style(wl); 
     2947             
     2948            if(isHandleCreated) 
     2949                redrawEntire(); 
     2950        } 
     2951 
     2952 
     2953        /// ditto 
     2954        final bool hScroll() // getter 
     2955        { 
     2956            return (_style() & WS_HSCROLL) != 0; 
     2957        } 
     2958 
     2959 
     2960        /// 
     2961        final void vScroll(bool byes) // setter 
     2962        { 
     2963            LONG wl = _style(); 
     2964            if(byes) 
     2965                wl |= WS_VSCROLL; 
     2966            else 
     2967                wl &= ~WS_VSCROLL; 
     2968            _style(wl); 
     2969             
     2970            if(isHandleCreated) 
     2971                redrawEntire(); 
    28412972        } 
    28422973         
  • trunk/win32/dfl/imagelist.d

    r7 r12  
    6161     
    6262    /// 
     63    final void imageSize(Size sz) // setter 
     64    { 
     65        assert(!isHandleCreated); 
     66         
     67        _w = sz.width; 
     68        _h = sz.height; 
     69    } 
     70     
     71    /// ditto 
     72    final Size imageSize() // getter 
     73    { 
     74        return Size(_w, _h); 
     75    } 
     76     
     77     
     78    /// 
    6379    final ImageCollection images() // getter 
    6480    { 
     
    8197     
    8298    /// 
     99    final void draw(Graphics g, Point pt, int index) 
     100    { 
     101        return draw(g, pt.x, pt.y, index); 
     102    } 
     103     
     104    /// ditto 
     105    final void draw(Graphics g, int x, int y, int index) 
     106    { 
     107        ImageList_Draw(handle, index, g.handle, x, y, ILD_NORMAL); 
     108    } 
     109     
     110    /+ 
     111    /// ditto 
     112    // stretch 
     113    final void draw(Graphics g, int x, int y, int width, int height, int index) 
     114    { 
     115    } 
     116    +/ 
     117     
     118     
     119    /// 
    83120    final bool isHandleCreated() // getter 
    84121    { 
     
    86123    } 
    87124     
    88     deprecated isHandleCreated handleCreated; 
     125    deprecated alias isHandleCreated handleCreated; 
    89126     
    90127     
    91128    final HIMAGELIST handle() // getter 
    92129    { 
    93         if(isHandleCreated) 
     130        if(!isHandleCreated) 
    94131            _createimagelist(); 
    95132        return _hil; 
     
    123160         
    124161        UINT flags = 0; 
     162        /+ 
    125163        switch(_depth) 
    126164        { 
    127             case DEPTH_4BIT: flags = ILC_COLOR4; break; 
     165            case ColorDepth.DEPTH_4BIT: flags = ILC_COLOR4; break; 
    128166            default: case DEPTH_8BIT: flags = ILC_COLOR8; break; 
    129             case DEPTH_16BIT: flags = ILC_COLOR16; break; 
    130             case DEPTH_24BIT: flags = ILC_COLOR24; break; 
    131             case DEPTH_32BIT: flags = ILC_COLOR32; break; 
     167            case ColorDepth.DEPTH_16BIT: flags = ILC_COLOR16; break; 
     168            case ColorDepth.DEPTH_24BIT: flags = ILC_COLOR24; break; 
     169            case ColorDepth.DEPTH_32BIT: flags = ILC_COLOR32; break; 
    132170        } 
     171        +/ 
     172        flags |= _depth; 
    133173        flags |= ILC_MASK; // ? 
    134174         
    135         _hil = ImageList_Create(_w, _h, flags, _cimages._images.length); 
     175        _hil = ImageList_Create(_w, _h, flags, _cimages._images.length, 65535); // ? 
    136176    } 
    137177} 
  • trunk/win32/dfl/internal/winapi.d

    r7 r12  
    16291629     
    16301630     
     1631    typedef HANDLE HIMAGELIST; 
     1632     
     1633     
     1634    enum: UINT 
     1635    { 
     1636        ILD_NORMAL = 0, 
     1637    } 
     1638     
     1639     
     1640    enum: UINT 
     1641    { 
     1642        //ILC_COLOR = , 
     1643        ILC_COLOR4 = 0x0004, 
     1644        ILC_COLOR8 = 0x0008, 
     1645        ILC_COLOR16 = 0x0010, 
     1646        ILC_COLOR24 = 0x0018, 
     1647        ILC_COLOR32 = 0x0020, 
     1648         
     1649        ILC_MASK = 0x0001, 
     1650    } 
     1651     
     1652     
    16311653    // Rich edit. 
    1632     typedef DWORD function(/+ DWORD_PTR +/ DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb) EDITSTREAMCALLBACK; 
     1654    alias DWORD function(/+ DWORD_PTR +/ DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb) EDITSTREAMCALLBACK; 
    16331655     
    16341656     
     
    27512773    DWORD GetThemeAppProperties(); 
    27522774    BOOL IsAppThemed(); 
     2775    HIMAGELIST ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow); 
     2776    BOOL ImageList_Destroy(HIMAGELIST himl);     
     2777    BOOL ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle); 
     2778    BOOL ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle); 
    27532779 
    27542780//} // Temporary. 
  • trunk/win32/dfl/listview.d

    r7 r12  
    16341634        } 
    16351635         
    1636         /+ 
    16371636        if(created) 
    1638             invalidate(false); 
    1639         +/ 
     1637            redrawEntire(); 
    16401638    } 
    16411639     
     
    20042002        switch(m.msg) 
    20052003        { 
     2004            /+ 
    20062005            case WM_PAINT: 
    20072006                // This seems to be the only way to display columns correctly. 
    20082007                prevWndProc(m); 
    20092008                return; 
     2009            +/ 
    20102010             
    20112011            case LVM_ARRANGE: 
     
    20952095        //SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, wlvexstyle, wlvexstyle); 
    20962096        prevwproc(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, wlvexstyle); // wparam=0 sets all. 
    2097         //redrawEntire(); // Need to recalc the frame ? 
    20982097         
    20992098        Color color; 
     
    21142113        cols.doListHeaders(); 
    21152114        litems.doListItems(); 
     2115         
     2116        recalcEntire(); // Fix frame. 
    21162117    } 
    21172118