Changeset 38:4d6511d2441f

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

Canvas

Files:

Legend:

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

    r37 r38  
    42814281alias WINAPI.GetSysColor GetSysColor; 
    42824282alias WINAPI.GetSysColorBrush GetSysColorBrush; 
     4283alias WINAPI.GetSystemDefaultUILanguage GetSystemDefaultUILanguage; 
    42834284alias WINAPI.GetSystemMenu GetSystemMenu; 
    42844285alias WINAPI.GetSystemMetrics GetSystemMetrics; 
     
    43944395alias WINAPI.MultiByteToWideChar MultiByteToWideChar; 
    43954396alias WINAPI.NotifyWinEvent NotifyWinEvent; 
     4397alias STDWIN.OffsetRect OffsetRect; 
    43964398alias WINAPI.OffsetRgn OffsetRgn; 
    43974399//alias WINAPI.OleInitialize OleInitialize; 
     
    44134415alias WINAPI.PrintDlgA PrintDlgA; 
    44144416alias WINAPI.PrintDlgW PrintDlgW; 
     4417alias WINAPI.PRIMARYLANGID PRIMARYLANGID; 
    44154418alias WINAPI.PtInRect PtInRect; 
    44164419alias WINAPI.PtInRegion PtInRegion; 
  • dwt/internal/win32/WINAPI.d

    r37 r38  
    132132    HPAINTBUFFER hBufferedPaint, 
    133133    BOOL fUpdateTarget 
     134); 
     135LANGID GetSystemDefaultUILanguage(); 
     136WORD PRIMARYLANGID( 
     137  WORD lgid 
    134138); 
    135139} 
  • dwt/widgets/Canvas.d

    r31 r38  
    1515import dwt.widgets.Composite; 
    1616 
    17 class Canvas : Composite { 
    18 
    19  
    20 /++ 
     17 
    2118import dwt.DWT; 
    2219import dwt.DWTException; 
     
    2421import dwt.graphics.GC; 
    2522import dwt.graphics.Rectangle; 
    26 import dwt.internal.win32.COMPOSITIONFORM; 
    27 import dwt.internal.win32.LRESULT; 
    2823import dwt.internal.win32.OS; 
    29 import dwt.internal.win32.POINT; 
    30 import dwt.internal.win32.RECT; 
     24import dwt.widgets.Caret; 
     25import dwt.widgets.Control; 
     26import dwt.widgets.Display; 
     27 
     28import dwt.dwthelper.utils; 
    3129 
    3230/** 
     
    5048 */ 
    5149 
    52 public class Canvas extends Composite { 
     50public class Canvas : Composite { 
     51 
     52    alias Composite.drawBackground drawBackground; 
     53 
    5354    Caret caret; 
    5455 
     
    5657 * Prevents uninitialized instances from being created outside the package. 
    5758 */ 
    58 Canvas () { 
     59this () { 
    5960} 
    6061 
     
    8687 * @see Widget#getStyle 
    8788 */ 
    88 public Canvas (Composite parent, int style) { 
     89public this (Composite parent, int style) { 
    8990    super (parent, style); 
    9091} 
     
    9394    checkWidget (); 
    9495    if (OS.IsWindowVisible (handle)) { 
    95         RECT rect = new RECT ()
    96         OS.SetRect (rect, x, y, x + width, y + height); 
    97         int hDC = OS.GetDCEx (handle, 0, OS.DCX_CACHE | OS.DCX_CLIPCHILDREN | OS.DCX_CLIPSIBLINGS); 
    98         drawBackground (hDC, rect); 
     96        RECT rect
     97        OS.SetRect (&rect, x, y, x + width, y + height); 
     98        auto hDC = OS.GetDCEx (handle, null, OS.DCX_CACHE | OS.DCX_CLIPCHILDREN | OS.DCX_CLIPSIBLINGS); 
     99        drawBackground (hDC, &rect); 
    99100        OS.ReleaseDC (handle, hDC); 
    100101    } 
     
    157158    if (gc is null) error (DWT.ERROR_NULL_ARGUMENT); 
    158159    if (gc.isDisposed ()) error (DWT.ERROR_INVALID_ARGUMENT); 
    159     RECT rect = new RECT ()
    160     OS.SetRect (rect, x, y, x + width, y + height); 
    161     int hDC = gc.handle; 
     160    RECT rect
     161    OS.SetRect (&rect, x, y, x + width, y + height); 
     162    auto hDC = gc.handle; 
    162163    int pixel = background is -1 ? gc.getBackground ().handle : -1; 
    163     drawBackground (hDC, rect, pixel); 
     164    drawBackground (hDC, &rect, pixel); 
    164165} 
    165166 
     
    191192    bool isFocus = caret !is null && caret.isFocusCaret (); 
    192193    if (isFocus) caret.killFocus (); 
    193     RECT sourceRect = new RECT ()
    194     OS.SetRect (sourceRect, x, y, x + width, y + height); 
    195     RECT clientRect = new RECT ()
    196     OS.GetClientRect (handle, clientRect); 
    197     if (OS.IntersectRect (clientRect, sourceRect, clientRect)) { 
     194    RECT sourceRect
     195    OS.SetRect (&sourceRect, x, y, x + width, y + height); 
     196    RECT clientRect
     197    OS.GetClientRect (handle, &clientRect); 
     198    if (OS.IntersectRect (&clientRect, &sourceRect, &clientRect)) { 
    198199        if (OS.IsWinCE) { 
    199200            OS.UpdateWindow (handle); 
    200201        } else { 
    201202            int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN; 
    202             OS.RedrawWindow (handle, null, 0, flags); 
     203            OS.RedrawWindow (handle, null, null, flags); 
    203204        } 
    204205    } 
     
    206207    if (findImageControl () !is null) { 
    207208        if (OS.IsWinCE) { 
    208             OS.InvalidateRect (handle, sourceRect, true); 
     209            OS.InvalidateRect (handle, &sourceRect, true); 
    209210        } else { 
    210211            int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 
    211212            if (all) flags |= OS.RDW_ALLCHILDREN; 
    212             OS.RedrawWindow (handle, sourceRect, 0, flags); 
    213         } 
    214         OS.OffsetRect (sourceRect, deltaX, deltaY); 
     213            OS.RedrawWindow (handle, &sourceRect, null, flags); 
     214        } 
     215        OS.OffsetRect (&sourceRect, deltaX, deltaY); 
    215216        if (OS.IsWinCE) { 
    216             OS.InvalidateRect (handle, sourceRect, true); 
     217            OS.InvalidateRect (handle, &sourceRect, true); 
    217218        } else { 
    218219            int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 
    219220            if (all) flags |= OS.RDW_ALLCHILDREN; 
    220             OS.RedrawWindow (handle, sourceRect, 0, flags); 
     221            OS.RedrawWindow (handle, &sourceRect, null, flags); 
    221222        } 
    222223    } else { 
     
    237238        */ 
    238239//      if (all) flags |= OS.SW_SCROLLCHILDREN; 
    239         OS.ScrollWindowEx (handle, deltaX, deltaY, sourceRect, null, 0, null, flags); 
     240        OS.ScrollWindowEx (handle, deltaX, deltaY, &sourceRect, null, null, null, flags); 
    240241    } 
    241242    if (all) { 
     
    293294} 
    294295 
    295 int windowProc (int hwnd, int msg, int wParam, int lParam) { 
     296override int windowProc (HWND hwnd, int msg, int wParam, int lParam) { 
    296297    if (msg is Display.SWT_RESTORECARET) { 
    297298        if ((state & CANVAS) !is 0) { 
     
    322323            if (primaryLang is OS.LANG_KOREAN) { 
    323324                if (caret !is null && caret.isFocusCaret ()) { 
    324                     POINT ptCurrentPos = new POINT ()
    325                     if (OS.GetCaretPos (ptCurrentPos)) { 
    326                         COMPOSITIONFORM lpCompForm = new COMPOSITIONFORM ()
     325                    POINT ptCurrentPos
     326                    if (OS.GetCaretPos (&ptCurrentPos)) { 
     327                        COMPOSITIONFORM lpCompForm
    327328                        lpCompForm.dwStyle = OS.CFS_POINT; 
    328                         lpCompForm.x = ptCurrentPos.x; 
    329                         lpCompForm.y = ptCurrentPos.y; 
    330                         int hIMC = OS.ImmGetContext (handle); 
    331                         OS.ImmSetCompositionWindow (hIMC, lpCompForm); 
     329                        lpCompForm.ptCurrentPos.x = ptCurrentPos.x; 
     330                        lpCompForm.ptCurrentPos.y = ptCurrentPos.y; 
     331                        auto hIMC = OS.ImmGetContext (handle); 
     332                        OS.ImmSetCompositionWindow (hIMC, &lpCompForm); 
    332333                        OS.ImmReleaseContext (handle, hIMC); 
    333334                    } 
     
    368369LRESULT WM_WINDOWPOSCHANGED (int wParam, int lParam) { 
    369370    LRESULT result  = super.WM_WINDOWPOSCHANGED (wParam, lParam); 
    370     if (result !is null) return result; 
     371    if (result !is LRESULT.NULL) return result; 
    371372    /* 
    372373    * Bug in Windows.  When a window with style WS_EX_LAYOUTRTL 
     
    383384LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) { 
    384385    LRESULT result  = super.WM_WINDOWPOSCHANGING (wParam, lParam); 
    385     if (result !is null) return result; 
     386    if (result !is LRESULT.NULL) return result; 
    386387    /* 
    387388    * Bug in Windows.  When a window with style WS_EX_LAYOUTRTL 
     
    397398 
    398399} 
    399 ++/ 
  • dwt/widgets/Caret.d

    r31 r38  
    1414 
    1515import dwt.widgets.Widget; 
     16import dwt.graphics.Font; 
    1617 
    1718class Caret : Widget { 
    1819    this( Widget, int ); 
     20bool isFocusCaret () ; 
     21void killFocus () ; 
     22void setFocus () ; 
     23public void setFont (Font font) ; 
     24void setIMEFont () ; 
     25void resizeIME () ; 
    1926} 
    2027/++ 
  • dwt/widgets/Scrollable.d

    r36 r38  
    3939 
    4040public abstract class Scrollable : Control { 
     41 
     42    alias Control.windowProc windowProc; 
     43 
    4144    ScrollBar horizontalBar, verticalBar; 
    4245