Changeset 24

Show
Ignore:
Timestamp:
05/31/04 03:22:58 (5 years ago)
Author:
brad
Message:

More Forward Reference Work - I'm now on caret.d, got stuck on setting/comparing a struct to null.
Used Yuriy's simplified FRef source code to make /branches/0.1 a bit better.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.1/src/dwt/graphics/device.d

    r17 r24  
    2828+/ 
    2929 
     30private import dwt.graphics.IDrawable; 
     31 
     32/** 
     33 * This class is the abstract superclass of all device objects, 
     34 * such as the Display device and the Printer device. Devices 
     35 * can have a graphics context (GC) created for them, and they 
     36 * can be drawn on by sending messages to the associated GC. 
     37 */ 
     38 
     39/+ TODO:  this was an abstract class, but I was having difficulties 
     40    with no implementations allowed  +/ 
     41 
     42public class Device : IDrawable { 
     43 
     44 
    3045private 
    3146{ 
     
    3348 
    3449    import dwt.graphics.color; 
    35     import dwt.graphics.drawable; 
    3650    import dwt.graphics.devicedata; 
    3751    import dwt.graphics.font; 
    3852    import dwt.graphics.fontdata; 
     53    import dwt.graphics.gcdata; 
    3954    import dwt.graphics.rectangle; 
    4055    import dwt.graphics.point; 
     
    4964} 
    5065 
    51 /** 
    52  * This class is the abstract superclass of all device objects, 
    53  * such as the Display device and the Printer device. Devices 
    54  * can have a graphics context (GC) created for them, and they 
    55  * can be drawn on by sending messages to the associated GC. 
    56  */ 
    57  
    58 /+ TODO:  this was an abstract class, but I was having difficulties 
    59     with no implementations allowed  +/ 
    60  
    61 public class Device : Drawable { 
    62  
    63     private import dwt.graphics.gcdata; 
    6466 
    6567 
  • branches/0.1/src/dwt/graphics/gc.d

    r18 r24  
    3434    import dwt.graphics.color; 
    3535    import dwt.graphics.device; 
    36     import dwt.graphics.drawable; 
     36    import dwt.graphics.IDrawable; 
    3737    import dwt.graphics.font; 
    3838    import dwt.graphics.fontmetrics; 
     
    8989    public int handle; 
    9090 
    91     Drawable drawable; 
     91    IDrawable drawable; 
    9292    GCData data; 
    9393 
     
    120120 * </ul> 
    121121 */ 
    122 public this(Drawable drawable) { 
     122public this(IDrawable drawable) { 
    123123    this(drawable, DWT.NONE); 
    124124} 
     
    150150 * @since 2.1.2 
    151151 */ 
    152 public this(Drawable drawable, int style) { 
     152public this(IDrawable drawable, int style) { 
    153153    if (drawable == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    154154    GCData data = new GCData (); 
     
    21202120} 
    21212121 
    2122 void init(Drawable drawable, GCData data, int hDC) { 
     2122void init(IDrawable drawable, GCData data, int hDC) { 
    21232123    int foreground = data.foreground; 
    21242124    if (foreground != -1 && OS.GetTextColor(hDC) != foreground) { 
     
    25732573 * </p> 
    25742574 * 
    2575  * @param drawable the Drawable for the receiver. 
     2575 * @param drawable the IDrawable for the receiver. 
    25762576 * @param data the data for the receiver. 
    25772577 * 
    25782578 * @return a new <code>GC</code> 
    25792579 */ 
    2580 public static GC win32_new(Drawable drawable, GCData data) { 
     2580public static GC win32_new(IDrawable drawable, GCData data) { 
    25812581    GC gc = new GC(); 
    25822582    int hDC = drawable.internal_new_GC(data); 
  • branches/0.1/src/dwt/graphics/image.d

    r18 r24  
    3232    import dwt.dwt; 
    3333    import dwt.graphics.device; 
    34     import dwt.graphics.drawable; 
     34    import dwt.graphics.IDrawable; 
    3535    import dwt.graphics.gc; 
    3636    import dwt.graphics.gcdata; 
     
    9595 */ 
    9696 
    97 public final class Image : Drawable { 
     97public final class Image : IDrawable { 
    9898 
    9999    /** 
  • branches/0.1/src/dwt/internal/win32/os.d

    r23 r24  
    23542354    bool ImmSetCompositionFontW (int hIMC, LOGFONTW* lplf); 
    23552355    bool ImmSetCompositionFontA (int hIMC, LOGFONTA* lplf); 
    2356     //bool ImmSetCompositionWindow (int hIMC, COMPOSITIONFORM lpCompForm); 
     2356    bool ImmSetCompositionWindow (int hIMC, COMPOSITIONFORM lpCompForm); 
    23572357    bool ImmSetConversionStatus (int hIMC, int fdwConversion, int dwSentence); 
    23582358    bool ImmSetOpenStatus (int hIMC, bool fOpen); 
  • branches/0.1/src/dwt/internal/win32/types.d

    r23 r24  
    133133} 
    134134 
    135 struct TRIVERTEX { 
    136     int x; 
    137     int y; 
    138     ushort Red; 
    139     ushort Green; 
    140     ushort Blue; 
    141     ushort Alpha; 
     135struct COMPOSITIONFORM { 
     136    public int dwStyle;        
     137//  POINT ptCurrentPos; 
     138    public int x, y; 
     139//  RECT rcArea;   
     140    public int left, top, right, bottom; 
    142141} 
    143142 
     
    760759} 
    761760 
     761struct TRIVERTEX { 
     762    int x; 
     763    int y; 
     764    ushort Red; 
     765    ushort Green; 
     766    ushort Blue; 
     767    ushort Alpha; 
     768} 
     769 
    762770struct WINDOWPOS { 
    763771    int hwnd;                      
  • branches/0.1/src/dwt/widgets/button.d

    r17 r24  
    2222module dwt.widgets.button; 
    2323 
    24 /+  
    25 import org.eclipse.swt.internal.win32.*; 
    26 import org.eclipse.swt.*; 
    27 import org.eclipse.swt.graphics.*; 
    28 import org.eclipse.swt.events.*; 
    29 +/ 
    30  
    31  
     24private import dwt.widgets.composite; 
    3225private import dwt.widgets.control; 
    3326 
     
    6962    private import dwt.util.util; 
    7063 
    71     private import dwt.widgets.composite; 
    7264 
    7365    Image image; 
  • branches/0.1/src/dwt/widgets/canvas.d

    r17 r24  
    2222module dwt.widgets.canvas; 
    2323 
    24 /+ 
    25 import org.eclipse.DWT.internal.win32.*; 
    26 import org.eclipse.DWT.*; 
    27 import org.eclipse.DWT.graphics.*; 
    28 +/ 
    29  
    30 private import dwt.graphics.rectangle; 
    31  
    32 private import dwt.internal.win32.os; 
    33 private import dwt.internal.win32.types; 
    34  
    3524private import dwt.widgets.composite; 
    36 private import dwt.widgets.caret; 
    37 private import dwt.widgets.control; 
    3825 
    3926/** 
     
    6047public class Canvas : Composite { 
    6148 
     49private import dwt.graphics.rectangle; 
     50 
     51private import dwt.internal.win32.os; 
     52private import dwt.internal.win32.types; 
     53 
     54private import dwt.widgets.caret; 
     55private import dwt.widgets.control; 
     56 
    6257    Caret caret; 
    6358     
     
    10095public this (Composite parent, int style) { 
    10196    super (parent, style); 
     97} 
     98 
     99int windowProc (int hwnd, int msg, int wParam, int lParam) { 
     100/+  
     101    // I added this because of a call in decorations.d (1487) that didn't match.  The windowProc is up a few classes from this one. 
     102    // 2004.5.30  BSA 
     103    // this switch statement was left over from the decorations.d call to windowProc(int,int,int,int) 
     104    switch (msg) { 
     105        case OS.WM_APP: 
     106        case OS.WM_APP+1: 
     107            if (hAccel == -1) createAccelerators (); 
     108            return msg == OS.WM_APP ? nAccel : hAccel; 
     109    } 
     110+/ 
     111    return super.windowProc (hwnd, msg, wParam, lParam); 
    102112} 
    103113 
  • branches/0.1/src/dwt/widgets/caret.d

    r17 r24  
    2222module dwt.widgets.caret; 
    2323 
    24 /+ 
    25 import org.eclipse.swt.internal.win32.*; 
    26 import org.eclipse.swt.*; 
    27 import org.eclipse.swt.graphics.*; 
    28 +/ 
    29  
    30 private import dwt.graphics.font; 
    31 private import dwt.graphics.image; 
    32 private import dwt.graphics.point; 
    33 private import dwt.graphics.rectangle; 
    34  
    35 private import dwt.internal.win32.types; 
    36  
    37 private import dwt.widgets.canvas; 
    3824private import dwt.widgets.widget; 
    39  
    40  
    4125 
    4226/** 
     
    5741public class Caret : Widget { 
    5842 
     43    private import dwt.graphics.font; 
     44    private import dwt.graphics.image; 
     45    private import dwt.graphics.point; 
     46    private import dwt.graphics.rectangle; 
     47     
     48    private import dwt.internal.win32.types; 
     49     
     50    private import dwt.widgets.canvas; 
     51     
    5952    Canvas parent; 
    6053    int x, y, width, height; 
    61     bit moved, resized; 
    62 //  bit isVisible;   // TODO: conflicting method below 
     54    bool moved, resized; 
     55    bool _isVisible;    
    6356    Image image; 
    6457    Font font; 
     
    10396 
    10497void createWidget () { 
    105     isVisible = true; 
     98    _isVisible = true; 
    10699    if (parent.getCaret () == null) { 
    107100        parent.setCaret (this); 
     
    239232 * </ul> 
    240233 */ 
    241 public bit getVisible () { 
    242     checkWidget(); 
    243     return isVisible; 
    244 } 
    245  
    246 bit hasFocus () { 
     234public bool getVisible () { 
     235    checkWidget(); 
     236    return _isVisible; 
     237} 
     238 
     239bool hasFocus () { 
    247240    return parent.handle == OS.GetFocus (); 
    248241} 
    249242 
    250 bit isFocusCaret () { 
     243bool isFocusCaret () { 
    251244    return parent.caret == this && hasFocus (); 
    252245} 
     
    266259 * @see #getVisible 
    267260 */ 
    268 public bit isVisible () { 
    269     checkWidget(); 
    270     return isVisible && parent.isVisible () && hasFocus (); 
     261public bool isVisible () { 
     262    checkWidget(); 
     263    return _isVisible && parent.isVisible () && hasFocus (); 
    271264} 
    272265 
     
    280273    if (!OS.SetCaretPos (x, y)) return; 
    281274    if (OS.IsDBLocale) { 
    282         POINT ptCurrentPos = new POINT ()
    283         if (!OS.GetCaretPos (ptCurrentPos)) return; 
    284         COMPOSITIONFORM lpCompForm = new COMPOSITIONFORM ()
     275        POINT ptCurrentPos
     276        if (!OS.GetCaretPos (&ptCurrentPos)) return; 
     277        COMPOSITIONFORM lpCompForm
    285278        lpCompForm.dwStyle = OS.CFS_POINT; 
    286279        lpCompForm.x = ptCurrentPos.x; 
     
    303296    image = null; 
    304297    font = null; 
    305     oldFont = null; 
     298    // TODO: oldFont = null; 
    306299} 
    307300 
     
    356349public void setBounds (int x, int y, int width, int height) { 
    357350    checkWidget(); 
    358     bit samePosition = this.x == x && this.y == y; 
    359     bit sameExtent = this.width == width && this.height == height; 
     351    bool samePosition = this.x == x && this.y == y; 
     352    bool sameExtent = this.width == width && this.height == height; 
    360353    if (samePosition && sameExtent) return; 
    361354    this.x = x;  this.y = y; 
     
    363356    if (sameExtent) { 
    364357        moved = true; 
    365         if (isVisible && hasFocus ()) move (); 
     358        if (_isVisible && hasFocus ()) move (); 
    366359    } else { 
    367360        resized = true; 
    368         if (isVisible && hasFocus ()) resize (); 
     361        if (_isVisible && hasFocus ()) resize (); 
    369362    } 
    370363} 
     
    399392        setIMEFont (hFont); 
    400393    } 
    401     if (isVisible) OS.ShowCaret (hwnd); 
     394    if (_isVisible) OS.ShowCaret (hwnd); 
    402395} 
    403396 
     
    423416    } 
    424417    this.font = font; 
    425     if (isVisible && hasFocus ()) { 
     418    if (_isVisible && hasFocus ()) { 
    426419        int hFont = 0; 
    427420        if (font != null) hFont = font.handle; 
     
    453446    } 
    454447    this.image = image; 
    455     if (isVisible && hasFocus ()) resize (); 
     448    if (_isVisible && hasFocus ()) resize (); 
    456449} 
    457450 
     
    485478    this.x = x;  this.y = y; 
    486479    moved = true; 
    487     if (isVisible && hasFocus ()) move (); 
     480    if (_isVisible && hasFocus ()) move (); 
    488481} 
    489482 
     
    522515    this.width = width;  this.height = height; 
    523516    resized = true; 
    524     if (isVisible && hasFocus ()) resize (); 
     517    if (_isVisible && hasFocus ()) resize (); 
    525518} 
    526519 
     
    561554 * </ul> 
    562555 */ 
    563 public void setVisible (bit visible) { 
    564     checkWidget(); 
    565     if (visible == isVisible) return; 
    566     isVisible = visible; 
     556public void setVisible (bool visible) { 
     557    checkWidget(); 
     558    if (visible == _isVisible) return; 
     559    _isVisible = visible; 
    567560    int hwnd = parent.handle; 
    568561    if (OS.GetFocus () != hwnd) return; 
    569     if (!isVisible) { 
     562    if (!_isVisible) { 
    570563        OS.HideCaret (hwnd); 
    571564    } else { 
  • branches/0.1/src/dwt/widgets/composite.d

    r17 r24  
    2222module dwt.widgets.composite; 
    2323 
    24 /+ 
    25 import org.eclipse.swt.internal.*; 
    26 import org.eclipse.swt.internal.win32.*; 
    27 import org.eclipse.swt.*; 
    28 import org.eclipse.swt.graphics.*; 
    29 +/ 
    3024 
    3125private import dwt.widgets.scrollable; 
     26 
    3227 
    3328/** 
     
    118113    super (parent, style); 
    119114} 
     115 
     116int windowProc (int hwnd, int msg, int wParam, int lParam) { 
     117/+  
     118    // I added this because of a call in decorations.d (1487) that didn't match.  The windowProc is up a few classes from this one. 
     119    // 2004.5.30  BSA 
     120    // this switch statement was left over from the decorations.d call to windowProc(int,int,int,int) 
     121    switch (msg) { 
     122        case OS.WM_APP: 
     123        case OS.WM_APP+1: 
     124            if (hAccel == -1) createAccelerators (); 
     125            return msg == OS.WM_APP ? nAccel : hAccel; 
     126    } 
     127+/ 
     128    return super.windowProc (hwnd, msg, wParam, lParam); 
     129} 
     130 
    120131 
    121132Control[] _getChildren() { 
  • branches/0.1/src/dwt/widgets/control.d

    r23 r24  
    1919 
    2020 
    21  
    2221module dwt.widgets.control; 
    2322 
    24 /+ 
    25 import org.eclipse.swt.internal.win32.*; 
    26 import org.eclipse.swt.graphics.*; 
    27 import org.eclipse.swt.*;  
    28 import org.eclipse.swt.events.*; 
    29 import org.eclipse.swt.accessibility.*; 
    30 +/ 
    31  
     23private import dwt.widgets.widget; 
    3224private import dwt.graphics.IDrawable; 
    33 private import dwt.widgets.widget; 
    3425 
    3526 
     
    6354    private import dwt.graphics.color; 
    6455    private import dwt.graphics.cursor; 
    65     private import dwt.graphics.drawable; 
    6656    private import dwt.graphics.font; 
    6757    private import dwt.graphics.point; 
     
    7363    private import dwt.util.util; 
    7464     
     65    private import dwt.widgets.composite; 
    7566    private import dwt.widgets.decorations; 
    7667    private import dwt.widgets.menu; 
  • branches/0.1/src/dwt/widgets/decorations.d

    r23 r24  
    2222module dwt.widgets.decorations; 
    2323 
    24 /+ 
    25 import org.eclipse.swt.internal.win32.*; 
    26 import org.eclipse.swt.*; 
    27 import org.eclipse.swt.graphics.*; 
    28 +/ 
    29  
    30     private import dwt.widgets.canvas; 
     24private import dwt.widgets.canvas; 
    3125 
    3226/** 
     
    117111    private import dwt.util.util; 
    118112 
     113    private import dwt.widgets.button; 
     114    private import dwt.widgets.composite; 
     115    private import dwt.widgets.control; 
    119116    private import dwt.widgets.menu; 
    120117    private import dwt.widgets.menuitem; 
    121     private import dwt.widgets.control; 
    122     private import dwt.widgets.button; 
    123118    private import dwt.widgets.shell; 
    124         private import dwt.widgets.composite; 
    125  
    126     OS os; 
     119 
     120    //OS os; 
    127121    Image image, smallImage, largeImage; 
    128     Image [] images = new Image [0]
     122    Image [] images
    129123    Menu menuBar; 
    130124    Menu [] menus; 
     
    289283 
    290284int callWindowProc (int msg, int wParam, int lParam) { 
    291     return os.DefMDIChildProc (handle, msg, wParam, lParam); 
     285    return OS.DefMDIChildProc (handle, msg, wParam, lParam); 
    292286} 
    293287 
     
    306300    RECT* rect; 
    307301    OS.SetRect (rect, x, y, x + width, y + height); 
    308     int bits = os.GetWindowLong (handle, OS.GWL_STYLE); 
     302    int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); 
    309303    bool hasMenu = cast(bool)(OS.IsWinCE ? false : OS.GetMenu (handle) != 0); 
    310     OS.AdjustWindowRectEx (rect, bits, hasMenu, os.GetWindowLong (handle, OS.GWL_EXSTYLE)); 
     304    OS.AdjustWindowRectEx (rect, bits, hasMenu, OS.GetWindowLong (handle, OS.GWL_EXSTYLE)); 
    311305 
    312306    /* Get the size of the scroll bars */ 
     
    318312        RECT* testRect; 
    319313        OS.SetRect (testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top); 
    320         os.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); 
     314        OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); 
    321315        while ((testRect.bottom - testRect.top) < height) { 
    322316            rect.top -= OS.GetSystemMetrics (OS.SM_CYMENU) - OS.GetSystemMetrics (OS.SM_CYBORDER); 
    323317            OS.SetRect(testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top); 
    324             os.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); 
     318            OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); 
    325319        } 
    326320    } 
     
    332326    int maxAccel = 0; 
    333327    if (menuBar == null || items == null) { 
    334         if (!os.IsPPC) return; 
     328        if (!OS.IsPPC) return; 
    335329        maxAccel = 1; 
    336330    } else { 
    337         maxAccel = os.IsPPC ? items.length + 1 : items.length; 
     331        maxAccel = OS.IsPPC ? items.length + 1 : items.length; 
    338332    } 
    339333    int size = ACCEL.sizeof; 
     
    14931487    return super.windowProc (hwnd, msg, wParam, lParam); 
    14941488} 
     1489 
     1490/+ TODO: delegates?  
    14951491 
    14961492LRESULT WM_ACTIVATE (int wParam, int lParam) { 
     
    16851681} 
    16861682 
    1687 
     1683+/ 
     1684 
     1685
  • branches/0.1/src/dwt/widgets/display.d

    r17 r24  
    2121 
    2222module dwt.widgets.display; 
    23  
    24 /+ 
    25 import org.eclipse.swt.internal.*; 
    26 import org.eclipse.swt.internal.win32.*; 
    27 import org.eclipse.swt.*; 
    28 import org.eclipse.swt.graphics.*; 
    29 +/ 
    3023 
    3124    private import dwt.graphics.device; 
     
    23772370} 
    23782371 
     2372/+ TODO: delegates? 
     2373 
    23792374bit runDeferredEvents () { 
    23802375    /* 
     
    24292424    return result; 
    24302425} 
     2426 
     2427+/ 
    24312428 
    24322429bit runTimer (int id) { 
  • branches/0.1/src/dwt/widgets/scrollable.d

    r17 r24  
    2121 
    2222module dwt.widgets.scrollable; 
    23  
    24 /+ 
    25 import org.eclipse.swt.internal.win32.*; 
    26 import org.eclipse.swt.*; 
    27 import org.eclipse.swt.graphics.*; 
    28 +/ 
    2923 
    3024private import dwt.widgets.control; 
     
    10599    return OS.DefWindowProc (handle, msg, wParam, lParam); 
    106100} 
     101 
     102int windowProc (int hwnd, int msg, int wParam, int lParam) { 
     103/+  
     104    // I added this because of a call in decorations.d (1487) that didn't match.  The windowProc is up a few classes from this one. 
     105    // 2004.5.30  BSA 
     106    // this switch statement was left over from the decorations.d call to windowProc(int,int,int,int) 
     107    switch (msg) { 
     108        case OS.WM_APP: 
     109        case OS.WM_APP+1: 
     110            if (hAccel == -1) createAccelerators (); 
     111            return msg == OS.WM_APP ? nAccel : hAccel; 
     112    } 
     113+/ 
     114    return super.windowProc (hwnd, msg, wParam, lParam); 
     115} 
     116 
    107117 
    108118/** 
  • branches/0.1/src/dwt/widgets/widget.d

    r17 r24  
    2121 
    2222module dwt.widgets.widget; 
    23  
    24 /+ 
    25 import org.eclipse.swt.internal.*; 
    26 import org.eclipse.swt.internal.win32.*; 
    27 import org.eclipse.swt.*; 
    28 import org.eclipse.swt.events.*; 
    29 +/ 
    30  
    31 //import dwt.internal.win32.dllversioninfo; 
    3223 
    3324