Changeset 72

Show
Ignore:
Timestamp:
07/16/08 05:52:00 (5 months ago)
Author:
kaarna
Message:

Window works like a PlainWindow?, yet it is just a Widget.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pihlaja/src/shiraz/canvas/IRootWindow.d

    r63 r72  
    4242 
    4343    //For to be able to create MenuWindows... 
    44     void add( Rectangle a_widget ); 
    45     void remove( Rectangle a_widget ); 
     44    void addToCanvas( Rectangle a_widget ); 
     45    void removeFromCanvas( Rectangle a_widget ); 
     46    //void add( Rectangle a_widget ); 
     47    //void remove( Rectangle a_widget ); 
    4648} 
    4749 
  • trunk/pihlaja/src/shiraz/ui/SubWindow.d

    r71 r72  
    16621662            { 
    16631663                Trace.formatln("Adding menuWindow into rootWindow for the first time."); 
    1664                 rootWindow.add( menuWindow ); 
     1664                rootWindow.addToCanvas( menuWindow ); 
    16651665            } 
    16661666            menuWindow.show(); 
  • trunk/pihlaja/src/shiraz/ui/Window.d

    r71 r72  
    2828import Shz = shiraz.ui.InputState; 
    2929import shiraz.ui.EventType; 
    30 import Shzr = shiraz.ui.Widget; 
     30import Shrz = shiraz.ui.Widget; 
    3131import shiraz.ui.SubWindow; 
    3232import shiraz.canvas.ICanvasItem; 
     
    652652} 
    653653 
    654 class Window : public PlainWindow, public IRootWindow 
     654class Window : public Shrz.Widget, public IRootWindow 
    655655{ 
    656656    //char[] name = ""; 
     
    686686        Trace.formatln("Before Window.super()."); 
    687687         
     688        super(); 
     689        name = set_name; 
     690        arrangeType = ArrangeType.LAYER; 
     691         
    688692        //super(set_name, WindowHeaderType.NORMAL, WindowHeaderType.NORMAL, true, false );//isfrontside=true, use_fbo_clipping=false 
    689         super(set_name, WindowHeaderType.NONE, WindowHeaderType.NONE, true, false );//isfrontside=true, use_fbo_clipping=false 
     693        //super(set_name, WindowHeaderType.NONE, WindowHeaderType.NONE, true, false );//isfrontside=true, use_fbo_clipping=false 
     694        plainWindow = new PlainWindow(set_name, WindowHeaderType.NONE, WindowHeaderType.NONE, true, false );//isfrontside=true, use_fbo_clipping=false 
     695        addToCanvas(plainWindow); 
    690696         
    691697        Trace.formatln("After Window.super()."); 
    692698    } 
     699     
     700    PlainWindow plainWindow; 
    693701     
    694702    /* 
     
    748756     
    749757    //These are overridden from Widget. 
     758     
    750759    //FALSE: Currently these return pixel-coordinates. 
    751760    //Maybe that's not what is good. Maybe we should 
     
    756765    public float w( float set ) 
    757766    { 
    758         Trace.formatln("Can't yet set Window width in height coordinates."); 
     767        Trace.formatln("Window.w() Can't yet set Window width in height coordinates."); 
    759768        throw new Exception("Can't yet set Window width in height coordinates."); 
    760769        return _w = set; 
    761770    } 
     771    public float wN( float set ) 
     772    { 
     773        Trace.formatln("Window.wN() Can't yet set Window width in height coordinates."); 
     774        throw new Exception("Can't yet set Window width in height coordinates."); 
     775        return _w = set; 
     776    } 
    762777    protected float _w = 1.33333f; 
    763778     
     
    765780    public float h( float set ) 
    766781    { 
    767         Trace.formatln("Can't yet set Window height in height coordinates."); 
     782        Trace.formatln("Window.h() Can't yet set Window height in height coordinates."); 
    768783        throw new Exception("Can't yet set Window height in height coordinates."); 
    769784        return _h = set; 
    770785    } 
     786    public float hN( float set ) 
     787    { 
     788        Trace.formatln("Window.hN() Can't yet set Window height in height coordinates."); 
     789        throw new Exception("Can't yet set Window height in height coordinates."); 
     790        return _h = set; 
     791    } 
    771792    protected float _h = 1.0f; 
    772793     
     
    775796    { 
    776797        _wP = set; 
    777         //_w = p2hco_rel_x(set); 
    778         super.w( p2hco_rel_x(set) ); 
     798        //Trace.formatln("wP: set: {}", cast(double)set ); 
     799        _w = p2hco_rel_x(set); 
     800        _ix1 = -(_w * 0.5f); 
     801        _ix2 = _w * 0.5f; 
     802        //super.w( p2hco_rel_x(set) ); 
     803        //Trace.formatln("wP: p2hco_rel_x(set): {}", cast(double)p2hco_rel_x(set) ); 
     804        //Trace.formatln("wP: _w: {}", cast(double)_w ); 
     805        //Trace.formatln("wP: screenHeightP: {}", cast(double)screenHeightP ); 
     806        arrange(); 
     807        invalidate(); 
    779808        return _wP; 
    780809    } 
     
    785814    { 
    786815        _hP = set; 
    787         //_h = p2hco_rel_y(set); 
    788         super.h( p2hco_rel_y(set) ); 
     816        _h = p2hco_rel_y(set); 
     817        _iy1 = -(_h * 0.5f); 
     818        _iy2 = _h * 0.5f; 
     819        //super.h( p2hco_rel_y(set) ); 
     820        arrange(); 
     821        invalidate(); 
    789822        return _hP; 
    790823    } 
     
    926959            //Trace.format("{} ", *ptr); 
    927960             
    928             foreach( Shzr.Widget wid; itemList ) 
     961            foreach( Shrz.Widget wid; itemList ) 
    929962            { 
    930963                if( wid.pickingID == *ptr ) 
     
    9741007        */   
    9751008            //The faster manual version: 
    976             /*foreach( Shzr.Widget wid; itemList ) 
     1009            /*foreach( Shrz.Widget wid; itemList ) 
    9771010            { 
    9781011                if( wid.mouseEvent( input ) ) 
     
    9831016             
    9841017            //First check which ones were hit. 
    985             scope LinkSeq!(Shzr.Widget) hitlist = enclosureList(input); 
     1018            scope LinkSeq!(Shrz.Widget) hitlist = enclosureList(input); 
    9861019            //Best zOrder widget will be in .tail. 
    9871020            hitlist.tail.mouseEvent( input ); 
     
    10861119     
    10871120     
    1088     //void add( Shzr.Widget a_widget ) 
     1121    //void add( Shrz.Widget a_widget ) 
    10891122    void add( Rectangle a_widget ) 
     1123    { 
     1124        a_widget.rootWindow = this; 
     1125        plainWindow.add( a_widget ); 
     1126        arrange(); 
     1127        invalidate(); 
     1128    } 
     1129     
     1130    void remove( Rectangle a_widget ) 
     1131    { 
     1132        //a_widget.rootWindow = this; 
     1133        plainWindow.remove( a_widget ); 
     1134        arrange(); 
     1135        invalidate(); 
     1136    } 
     1137     
     1138    void append( Rectangle a_widget ) 
     1139    { 
     1140        a_widget.rootWindow = this; 
     1141        plainWindow.append( a_widget ); 
     1142        arrange(); 
     1143        invalidate(); 
     1144    } 
     1145     
     1146    void prepend( Rectangle a_widget ) 
     1147    { 
     1148        a_widget.rootWindow = this; 
     1149        plainWindow.prepend( a_widget ); 
     1150        arrange(); 
     1151        invalidate(); 
     1152    } 
     1153     
     1154    void addToCanvas( Rectangle a_widget ) 
    10901155    { 
    10911156        a_widget.rootWindow = this; 
     
    10931158    } 
    10941159     
    1095     void remove( Rectangle a_widget ) 
     1160    void removeFromCanvas( Rectangle a_widget ) 
    10961161    { 
    10971162        //a_widget.rootWindow = this; 
     
    11011166    //protected  
    11021167     
     1168    /* 
    11031169    void arrange() 
    11041170    { 
    1105         checkZOrder(); 
     1171        super.arrange(); 
     1172        //checkZOrder(); 
     1173     
     1174        //Trace.formatln("win w: {} h: {}", cast(double)w, cast(double)h ); 
    11061175     
    11071176        //Trace.formatln("This size: {}", toString() ); 
     
    11161185        //} 
    11171186    } 
     1187    */ 
    11181188     
    11191189     
     
    13261396        //and to let the objects lie in the 0.0 z-plane. 
    13271397         
    1328         //foreach(Shzr.Widget wid; itemList) 
     1398        //foreach(Shrz.Widget wid; itemList) 
    13291399        foreach(Rectangle wid; itemList) 
    13301400        {