Changeset 64

Show
Ignore:
Timestamp:
06/21/08 21:07:37 (4 months ago)
Author:
kaarna
Message:

Menu work. RTree cleanup. Hide. No crashes. Anims need work.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pihlaja/src/pihlaja/PihlajaMain.d

    r63 r64  
    10821082        //be on the screen at the same time. Possibly both. 
    10831083 
     1084        /* 
    10841085        for(uint i = 0; i < 10; i++) 
    10851086        { 
    10861087            crazyTest(); 
    10871088        } 
     1089        */ 
    10881090     
    10891091        Widget checkerBoard = new Widget(); 
  • trunk/pihlaja/src/shiraz/Shiraz.d

    r63 r64  
    289289                break; 
    290290                case "Shiraz.Button": 
     291                    Trace.formatln("Creating Button texture."); 
    291292                    texture = new Image( Image.GRADIENT_2 ); 
    292293                    texture.name = "Shiraz.Button"; 
     
    329330        { 
    330331            if( img.name == set_name ) 
     332            { 
     333                Trace.formatln("Reusing texture called {}.", set_name ); 
    331334                return img; 
     335            } 
    332336        } 
    333337        return null; 
  • trunk/pihlaja/src/shiraz/canvas/ICanvasItem.d

    r48 r64  
    301301    void remove( Animator set_anim ); 
    302302     
     303    void hide(); 
     304    void show(); 
     305    bool isHidden(); 
     306 
    303307    //LinkSeq!(ICanvasItem) enclosureList( double tx, double ty, double tw, double th, inout LinkSeq!(ICanvasItem) hit_items = null ); 
    304308} 
  • trunk/pihlaja/src/shiraz/canvas/PlainRectangle.d

    r62 r64  
    10951095    { 
    10961096        debug(clipping) Trace.formatln("PlainRectangle.render() START. name: {}", fullName() ); 
     1097     
     1098        if( isHidden == true ) 
     1099            return; 
    10971100     
    10981101        beginRender(draw); 
     
    16051608    float a( float set ) { return _colour_data[3] = set; } 
    16061609     
     1610    /* 
     1611    float r( float set ) { _colour_data[0] = set; invalidate(); return _colour_data[0]; } 
     1612    float g( float set ) { _colour_data[1] = set; invalidate(); return _colour_data[1]; } 
     1613    float b( float set ) { _colour_data[2] = set; invalidate(); return _colour_data[2]; } 
     1614    float a( float set ) { _colour_data[3] = set; invalidate(); return _colour_data[3]; } 
     1615    */ 
     1616     
    16071617    void colour( float sr, float sg, float sb, float sa ) 
    16081618    { 
     
    19821992    }*/ 
    19831993     
    1984      
     1994    //API: 
     1995    public void hide() { isHidden = true; } 
     1996    public void show() { isHidden = false; } 
     1997    //Internal: 
     1998    public bool isHidden() { return m_isHidden; } 
     1999    protected bool isHidden(bool set) { return m_isHidden = set; } 
     2000    protected bool m_isHidden = false; 
    19852001     
    19862002     
  • trunk/pihlaja/src/shiraz/canvas/Rectangle.d

    r63 r64  
    18801880            //Trace.formatln("Animations pending."); 
    18811881            invalidate(); 
    1882         } 
    1883      
     1882         
     1883         
     1884            //Trace.formatln("Trying to get head()."); 
     1885            Animator anim = animator.head(); 
     1886             
     1887            //Trace.formatln("Got anim head."); 
     1888            if( anim !is null && anim.animate() == false ) 
     1889            { 
     1890                //Trace.formatln("removing anim."); 
     1891                anim.removeFromOwner(); 
     1892            } 
     1893             
     1894        } 
     1895         
     1896        //Trace.formatln("ok anims."); 
     1897     
     1898         
     1899        //This is the version where we have multiple animations 
     1900        //running simultaneously. 
     1901        //For the time being we'll use the version where 
     1902        //only one animation can run at a time. Because it 
     1903        //is simpler. 
     1904         
     1905        /* 
    18841906        LinkSeq!(Animator) to_remove = new LinkSeq!(Animator); 
    18851907         
     
    18941916            anim.removeFromOwner(); 
    18951917        } 
    1896      
     1918       */ 
    18971919        foreach(Rectangle wid; itemList) 
    18981920        { 
     
    19061928    { 
    19071929        //Trace.formatln("Added animation."); 
    1908         animator.append( set_anim ); 
    1909         invalidate();//redraw when a new animation is added 
    1910         //to get it started and runnign. 
     1930         
     1931        //Temporary limit of 5 animations: 
     1932        if( animator.length < 5 ) 
     1933        { 
     1934            animator.append( set_anim ); 
     1935            invalidate();//redraw when a new animation is added 
     1936        //to get it started and running. 
     1937        } 
    19111938    } 
    19121939     
     
    20672094    } 
    20682095     
     2096    //Colour Memory. Prelight colour uses this to store the actual colour. 
     2097    float rMem() { return _colour_mem_data[0]; } 
     2098    float gMem() { return _colour_mem_data[1]; } 
     2099    float bMem() { return _colour_mem_data[2]; } 
     2100    float aMem() { return _colour_mem_data[3]; } 
     2101     
     2102    float rMem( float set ) { return _colour_mem_data[0] = set; } 
     2103    float gMem( float set ) { return _colour_mem_data[1] = set; } 
     2104    float bMem( float set ) { return _colour_mem_data[2] = set; } 
     2105    float aMem( float set ) { return _colour_mem_data[3] = set; } 
     2106     
     2107    void colourMem( float sr, float sg, float sb, float sa ) 
     2108    { 
     2109        rMem = sr; gMem = sg; bMem = sb; aMem = sa; 
     2110    } 
     2111 
     2112    void colourMem( float[] set ) 
     2113    { 
     2114        if( set.length >= 4 ) 
     2115        { 
     2116            rMem = set[0]; gMem = set[1]; bMem = set[2]; aMem = set[3]; 
     2117        } 
     2118    } 
     2119     
     2120    protected float[4] _colour_mem_data; 
     2121     
    20692122    /** 
    20702123        If prelight is true, the widget will be drawn 
     
    20752128    { 
    20762129        m_isPrelight = true; 
     2130         
     2131        colourMem( r, g, b, a ); 
     2132         
     2133        if( r > 0.8f )//If whitish...make darker. 
     2134        { 
     2135            colourAnim( 0.7f*r, 0.7f*g, 0.7f*b, a ); 
     2136        } 
     2137        else //otherwise make lighter. 
     2138        { 
     2139            colourAnim( 1.3f*r, 1.3f*g, 1.3f*b, a ); 
     2140        } 
     2141         
    20772142        invalidate(); 
    20782143        return m_isPrelight; 
     
    20812146    { 
    20822147        m_isPrelight = false; 
     2148         
     2149        colourAnim( rMem, gMem, bMem, aMem ); 
     2150         
    20832151        invalidate(); 
    20842152        return m_isPrelight; 
     
    26682736        Trace.formatln("Trying to remove stuff."); 
    26692737     
     2738        if( a_widget.parent !is this ) 
     2739        { 
     2740            Trace.formatln("The Rectangle that we tried to remove isn't in this Container."); 
     2741            return; 
     2742        } 
     2743     
     2744        Trace.formatln("Removing from itemList."); 
     2745        itemList.remove( a_widget ); 
     2746        Trace.formatln("Removing from RTree."); 
     2747        itemTree.remove( a_widget ); 
     2748         
     2749        Trace.formatln("Removing done. Cleaning up."); 
     2750         
    26702751        a_widget.parent = null; 
    26712752        a_widget.rootWindow = null; 
    2672      
    2673         itemList.remove( a_widget ); 
    2674         itemTree.remove( a_widget ); 
     2753         
     2754        Trace.formatln("Removing - arrange."); 
    26752755        arrange(); 
    26762756         
     2757        Trace.formatln("Removing - invalidate."); 
    26772758        invalidate(); 
    26782759    } 
     
    26992780    protected Anchor m_anchor = Anchor.TOP_LEFT; 
    27002781     
     2782    /* 
    27012783    //This is the public API of hiding and showing. 
    27022784    //NOT TRUE AT THE MOMENT: 
     
    27122794    protected bool isHidden(bool set) { return m_isHidden = set; } 
    27132795    protected bool m_isHidden = false; 
     2796    */ 
    27142797     
    27152798    public void packOptions( PackOptions set_x, PackOptions set_y ) 
     
    35293612    protected void applyColour() 
    35303613    { 
     3614        /* 
    35313615        if( m_isPrelight == false ) 
    35323616        { 
     3617        */ 
    35333618            glColor4f( r, g, b, a ); 
     3619        /* 
    35343620        } 
    35353621        else if( r > 0.8f )//If whitish...make darker. 
     
    35413627            glColor4f( 1.3f*r, 1.3f*g, 1.3f*b, a ); 
    35423628        } 
     3629        */ 
    35433630    } 
    35443631     
     
    37183805    protected float m_maxHeight = 0.0f; 
    37193806     
     3807    //Colour animations: 
     3808     
     3809    void rAnim( float to_set, void delegate() set_when_finished = null ) 
     3810    { 
     3811        Animator to_anim = new Animator(this, &r, &r, null, null, null, null, set_when_finished ); 
     3812        to_anim.animateTo( to_set, 0.0f, 0.0f ); 
     3813    } 
     3814     
     3815    void gAnim( float to_set, void delegate() set_when_finished = null ) 
     3816    { 
     3817        Animator to_anim = new Animator(this, &g, &g, null, null, null, null, set_when_finished ); 
     3818        to_anim.animateTo( to_set, 0.0f, 0.0f ); 
     3819    } 
     3820     
     3821    void bAnim( float to_set, void delegate() set_when_finished = null ) 
     3822    { 
     3823        Animator to_anim = new Animator(this, &b, &b, null, null, null, null, set_when_finished ); 
     3824        to_anim.animateTo( to_set, 0.0f, 0.0f ); 
     3825    } 
     3826     
     3827    void aAnim( float to_set, void delegate() set_when_finished = null ) 
     3828    { 
     3829        Animator to_anim = new Animator(this, &a, &a, null, null, null, null, set_when_finished ); 
     3830        to_anim.animateTo( to_set, 0.0f, 0.0f ); 
     3831    } 
     3832     
     3833    void colourAnim( float to_r, float to_g, float to_b, float to_a = 1.0f, void delegate() set_when_finished = null ) 
     3834    { 
     3835        Animator to_anim = new Animator(this, &r, &r, &g, &g, &b, &b, set_when_finished ); 
     3836        to_anim.animateTo( to_r, to_g, to_b ); 
     3837         
     3838        Animator to_anim_alpha = new Animator(this, &a, &a, null, null, null, null, set_when_finished ); 
     3839        to_anim_alpha.animateTo( to_a, 0.0f, 0.0f ); 
     3840    } 
    37203841     
    37213842    //Redefined for adjustTree: 
     
    37473868    } 
    37483869     
     3870    void moveToAnim( float to_x, float to_y, float to_z = 0.0f, void delegate() set_when_finished = null ) 
     3871    { 
     3872        Animator to_anim = new Animator(this, &xPos, &xPos, &yPos, &yPos, &zPos, &zPos, set_when_finished ); 
     3873        to_anim.animateTo( to_x, to_y, to_z ); 
     3874    } 
     3875     
     3876    void sizeAnim( float to_w, float to_h, void delegate() set_when_finished = null ) 
     3877    { 
     3878        Animator to_anim = new Animator(this, &w, &w, &h, &h, null, null, set_when_finished ); 
     3879        to_anim.animateTo( to_w, to_h, 0.0f ); 
     3880    } 
     3881     
    37493882    public float x1(){ return super.x1; } 
    37503883    public float x1( float set ) 
  • trunk/pihlaja/src/shiraz/canvas/rtree/RTree.d

    r63 r64  
    27942794        { 
    27952795            debug(RTree) Trace.formatln("inner foreach."); 
    2796             if(it !is null
     2796            if(it !is null && it.isHidden == false
    27972797            { 
    27982798                debug(RTree) Trace.formatln("testing for enclosure then."); 
     
    34563456    Trace.formatln("Tried to remove: {}\n\n", edit1.toString() ); 
    34573457 
    3458     uint num_of_elements = 10; 
    3459  
    3460     Trace.formatln( "\n\n\nAdding {} elements.\n\n\n", num_of_elements ); 
    3461  
    3462     LinkSeq!(Rectangle) rects = new LinkSeq!(Rectangle); 
    3463     for( uint i = 0; i < num_of_elements; i++ ) 
    3464     { 
    3465         Trace.formatln( "Adding element {}.", i ); 
     3458    for( uint d = 0; d < 1; d++ ) 
     3459    { 
     3460 
     3461        uint num_of_elements = 2; 
    34663462     
    3467         Rectangle re = new Rectangle(); 
    3468         re.setXYXY( i*10.0f, 0.0f, (i*10.0) + 10.0f, 18.0f ); 
    3469         rects.append(re); 
    3470         itemTree.append(re); 
    3471     } 
     3463        Trace.formatln( "\n\n\nAdding {} elements.\n\n\n", num_of_elements ); 
    34723464     
    3473     Trace.formatln( "Moving and adjusting tree for {} elements.", num_of_elements ); 
    3474     foreach( Rectangle r; rects ) 
    3475     { 
    3476         r.xPos = r.xPos + 8.0f; 
    3477         r.yPos = r.yPos + 5.0f; 
    3478         r.adjustTree(); 
    3479     } 
    3480      
    3481     Trace.formatln( "Removing every other of {} elements.", num_of_elements ); 
    3482     for( uint i = 0; i < num_of_elements; ) 
    3483     { 
    3484         Trace.formatln( "Trying to remove element {}.", i ); 
    3485         itemTree.remove( rects[i] ); 
    3486         i = i + 2; 
    3487     } 
    3488      
     3465        LinkSeq!(Rectangle) rects = new LinkSeq!(Rectangle); 
     3466        for( uint i = 0; i < num_of_elements; i++ ) 
     3467        { 
     3468            Trace.formatln( "Adding element {}.", i ); 
     3469         
     3470            Rectangle re = new Rectangle(); 
     3471            re.setXYXY( i*10.0f, 0.0f, (i*10.0) + 10.0f, 18.0f ); 
     3472            rects.append(re); 
     3473            itemTree.append(re); 
     3474        } 
     3475         
     3476        Trace.formatln( "Moving and adjusting tree for {} elements.", num_of_elements ); 
     3477        foreach( Rectangle r; rects ) 
     3478        { 
     3479            r.xPos = r.xPos + 8.0f; 
     3480            r.yPos = r.yPos + 5.0f; 
     3481            r.adjustTree(); 
     3482        } 
     3483         
     3484        Trace.formatln( "Removing every other of {} elements.", num_of_elements ); 
     3485        for( uint i = 0; i < num_of_elements; ) 
     3486        { 
     3487            Trace.formatln( "Trying to remove element {}.", i ); 
     3488            itemTree.remove( rects[i] ); 
     3489            i = i + 2; 
     3490        } 
     3491    }    
    34893492     
    34903493    Trace.formatln( "\nTesting enclosureList()." ); 
  • trunk/pihlaja/src/shiraz/ui/Animator.d

    r63 r64  
    5151    float delegate(float) setZ; 
    5252     
     53    void delegate() whenFinished; 
     54     
    5355    float toX; 
    5456    float toY; 
     
    7476    //this( float delegate() set_get, float delegate(float) set_set ) 
    7577     
    76     this( ICanvasItem set_item, float delegate(float) set_x, float delegate(float) set_y, float delegate(float) set_z
     78    this( ICanvasItem set_item, float delegate(float) set_x, float delegate(float) set_y, float delegate(float) set_z, void delegate() set_when_finished = null
    7779    { 
    7880        animatorType = AnimatorType.ABSOLUTE_PATH; 
     
    8789        setY = set_y; 
    8890        setZ = set_z; 
    89     } 
    90  
    91     this( ICanvasItem set_item, float delegate(float) set_x, float delegate() get_x, float delegate(float) set_y, float delegate() get_y, float delegate(float) set_z, float delegate() get_z ) 
     91         
     92        whenFinished = set_when_finished; 
     93    } 
     94 
     95    this( ICanvasItem set_item, float delegate(float) set_x, float delegate() get_x, float delegate(float) set_y, float delegate() get_y, float delegate(float) set_z, float delegate() get_z, void delegate() set_when_finished = null ) 
    9296    { 
    9397        animatorType = AnimatorType.ABSOLUTE_TO; 
     
    107111        setZ = set_z; 
    108112        getZ = get_z; 
     113         
     114        whenFinished = set_when_finished; 
    109115         
    110116        if( setX is null || getX is null ) 
     
    247253            if( position >= 1.0 ) 
    248254            { 
     255                if( whenFinished !is null ) 
     256                    whenFinished(); 
     257             
    249258                if( owner !is null ) 
    250259                { 
     
    265274            { 
    266275                float now_x = toX - getX(); 
    267                 Trace.formatln("now_x: {}", cast(double)now_x); 
    268                 Trace.formatln("to_x: {}", cast(double)toX); 
    269                 Trace.formatln("getX: {}", cast(double)getX()); 
     276                debug(Animator) 
     277                { 
     278                    Trace.formatln("now_x: {}", cast(double)now_x); 
     279                    Trace.formatln("to_x: {}", cast(double)toX); 
     280                    Trace.formatln("getX: {}", cast(double)getX()); 
     281                } 
    270282                 
    271283                if( now_x < 0.001f && now_x > -0.001f ) 
    272284                { 
    273                     Trace.formatln("xDone."); 
     285                    debug(Animator) Trace.formatln("xDone."); 
    274286                    xDone = true; 
    275287                    setX( toX ); 
     
    284296            { 
    285297                float now_y = toY - getY(); 
    286                 Trace.formatln("now_y: {}", cast(double)now_y); 
     298                debug(Animator) Trace.formatln("now_y: {}", cast(double)now_y); 
    287299                if( now_y < 0.001f && now_y > -0.001f ) 
    288300                { 
    289                     Trace.formatln("yDone."); 
     301                    debug(Animator) Trace.formatln("yDone."); 
    290302                    yDone = true; 
    291303                    setY( toY ); 
     
    313325            if( xDone == true && yDone == true && zDone == true ) 
    314326            { 
    315                 Trace.formatln("All Done."); 
     327                debug(Animator) Trace.formatln("All Done."); 
     328                 
     329                if( whenFinished !is null ) 
     330                    whenFinished(); 
    316331                 
    317332                /*if( owner !is null ) 
  • trunk/pihlaja/src/shiraz/ui/SubWindow.d

    r63 r64  
    817817            //Trace.formatln("controlWidget.panret name: {}", controlWidget.parent.name ); 
    818818            //controlWidget.parent.remove(controlWidget); 
    819             controlWidget.removeFromParent(); 
     819             
     820            //controlWidget. 
     821            //super. 
     822            aAnim( 0.0f, &controlWidget.removeFromParent ); 
     823             
     824            //controlWidget.removeFromParent(); 
    820825        } 
    821826    } 
     
    849854            Trace.formatln("Adding maximize animations."); 
    850855             
     856            //The simplified API: 
     857            controlWidget.moveToAnim(0.0f, 0.0f, 0.0f); 
     858            controlWidget.sizeAnim( controlWidget.parent.w, controlWidget.parent.h ); 
     859             
     860            //The more detailed API: 
     861            /* 
    851862            Animator to_anim = new Animator(controlWidget, &controlWidget.xPos, &controlWidget.xPos, &controlWidget.yPos, &controlWidget.yPos, null, null ); 
    852863            to_anim.animateTo( 0.0f, 0.0f, 0.0f ); 
     
    854865            Animator wh_anim = new Animator(controlWidget, &controlWidget.w, &controlWidget.w, &controlWidget.h, &controlWidget.h, null, null ); 
    855866            wh_anim.animateTo( controlWidget.parent.w, controlWidget.parent.h, 0.0f ); 
     867            */ 
    856868             
    857869            /* 
     
    11651177            draw.pushTexture( framebufferObject ); 
    11661178                 
    1167                 //glColor4f(r, g, b, a); 
    1168                 glColor4f(1.0f, 1.0f, 1.0f, 1.0f); 
     1179                glColor4f(r, g, b, a); 
     1180                //glColor4f(1.0f, 1.0f, 1.0f, 1.0f); 
    11691181                //applyColour(); 
    11701182             
     
    11961208                //TODO 
    11971209                //glColor4f(r*0.5f, g*0.5f, b*0.5f, a); 
    1198                 glColor4f(0.0f, 0.0f, 0.0f, 1.0f); 
     1210                glColor4f(0.0f, 0.0f, 0.0f, a*0.5f); 
    11991211                draw.stroke( shape ); 
    12001212            } 
     
    14611473    */ 
    14621474     
     1475    /* 
    14631476    //Colour is overridden to control container widget. 
    14641477    float r() { return ((container is null) ? _colour_data[0] : container.r); } 
     
    14671480    float a() { return ((container is null) ? _colour_data[3] : container.a); } 
    14681481     
    1469      
    1470      
    14711482    float r( float set ) { return ((container is null) ? (_colour_data[0] = set) : (container.r = set)); } 
    14721483    float g( float set ) { return ((container is null) ? (_colour_data[1] = set) : (container.g = set)); } 
    14731484    float b( float set ) { return ((container is null) ? (_colour_data[2] = set) : (container.b = set)); } 
    14741485    float a( float set ) { return ((container is null) ? (_colour_data[3] = set) : (container.a = set)); } 
    1475      
     1486    */ 
     1487     
     1488    //br stands for "background red". So these are background colours, 
     1489    //or container background colours. 
     1490    float br() { return ((container is null) ? _colour_data[0] : container.r); } 
     1491    float bg() { return ((container is null) ? _colour_data[1] : container.g); } 
     1492    float bb() { return ((container is null) ? _colour_data[2] : container.b); } 
     1493    float ba() { return ((container is null) ? _colour_data[3] : container.a); } 
     1494     
     1495    float br( float set ) { return ((container is null) ? (_colour_data[0] = set) : (container.r = set)); } 
     1496    float bg( float set ) { return ((container is null) ? (_colour_data[1] = set) : (container.g = set)); } 
     1497    float bb( float set ) { return ((container is null) ? (_colour_data[2] = set) : (container.b = set)); } 
     1498    float ba( float set ) { return ((container is null) ? (_colour_data[3] = set) : (container.a = set)); } 
     1499     
     1500    void backgroundColour( float set_r, float set_g, float set_b, float set_a ) 
     1501    { 
     1502        if( container !is null ) 
     1503            container.colour( set_r, set_g, set_b, set_a ); 
     1504        else colour( set_r, set_g, set_b, set_a ); 
     1505    } 
    14761506     
    14771507    //class Header? 
     
    15091539    this() 
    15101540    { 
     1541        Trace.formatln("Menu.this() START."); 
     1542        scope(exit) Trace.formatln("Menu.this() END."); 
     1543     
    15111544        super(); 
    15121545        name = "Menu"; 
     
    15151548    } 
    15161549     
    1517     /* 
    15181550    void add(MenuItem add_item) 
    15191551    { 
     1552        add_item.createMenuWindow(); 
    15201553        super.add(add_item); 
    1521         MenuWindow menuwin = new MenuWindow(); 
    1522         menuwin.defaultSize( 0.3f, 0.4f ); 
    1523         menuWindows.append(menuwin); 
    1524     } 
    1525     */ 
     1554    } 
    15261555     
    15271556    //LinkSeq!(MenuWindow) menuWindows; 
     
    15311560{ 
    15321561public: 
    1533     this(char[] set_name, ) 
     1562    this(char[] set_name ) 
     1563    { 
     1564        Trace.formatln("MenuItem.this() START."); 
     1565        scope(exit) Trace.formatln("MenuItem.this() END."); 
     1566     
     1567        super(set_name); 
     1568         
     1569        isOutline = false; 
     1570         
     1571        padding = 0.0f; 
     1572         
     1573        texture = null; 
     1574         
     1575    } 
     1576     
     1577    //internal: 
     1578    public void createMenuWindow() 
    15341579    { 
    15351580        menuWindow = new MenuWindow(); 
    15361581        menuWindow.defaultSize( 0.25f, 0.35f ); 
    1537      
    1538         super(set_name); 
    1539          
    1540         padding = 0.0f; 
    1541          
    1542         //signalActivate.attach(&showMenuWindow); 
     1582         
     1583            //signalActivate.attach(&showMenuWindow); 
    15431584        signalMouseButtonPress.attach(&showMenuWindow); 
    15441585        signalMouseButtonRelease.attach(&hideMenuWindow); 
    15451586    } 
    15461587     
     1588     
    15471589    /* 
    15481590    void renderChildren(Draw draw) 
     
    15671609    { 
    15681610        input.isHandled = true; 
    1569      
     1611        
    15701612        if( menuWindow !is null ) 
    15711613        { 
    1572             rootWindow.add( menuWindow ); 
     1614            menuWindow.a = 0.0f; 
     1615            if( menuWindow.parent is null ) 
     1616            { 
     1617                Trace.formatln("Adding menuWindow into rootWindow for the first time."); 
     1618                rootWindow.add( menuWindow ); 
     1619            } 
     1620            menuWindow.show(); 
     1621            menuWindow.sendToTop(); 
     1622            menuWindow.aAnim(1.0f); 
    15731623        } 
    15741624    } 
     
    15801630        if( menuWindow !is null ) 
    15811631        { 
    1582             rootWindow.remove( menuWindow ); 
     1632            //menuWindow.aAnim(0.0f, &menuWindow.removeFromParent ); 
     1633            menuWindow.aAnim(0.0f, &menuWindow.hide ); 
    15831634        }    
    15841635    } 
     
    15921643    this() 
    15931644    { 
     1645        Trace.formatln("MenuWindow.this() START."); 
     1646        scope(exit) Trace.formatln("MenuWindow.this() END."); 
     1647     
    15941648        super("MenuWindow", WindowHeaderType.NONE, WindowHeaderType.NONE ); 
    15951649         
    1596         //auto emptyButton31 = new MenuItem("Menuitem 1"); 
     1650         
     1651        auto emptyButton31 = new MenuItem("Menuitem 1"); 
    15971652        //emptyButton31.signalActivate.attach(&clickHandler3); 
    1598         //add( emptyButton31 ); 
     1653        add( emptyButton31 ); 
     1654         
     1655        auto emptyButton32 = new MenuItem("Menuitem 2"); 
     1656        //emptyButton31.signalActivate.attach(&clickHandler3); 
     1657        add( emptyButton32 ); 
     1658         
     1659        auto emptyButton33 = new MenuItem("Menuitem 3"); 
     1660        //emptyButton31.signalActivate.attach(&clickHandler3); 
     1661        add( emptyButton33 ); 
     1662         
     1663         
    15991664    } 
    16001665 
  • trunk/pihlaja/src/shiraz/ui/Window.d

    r63 r64  
    12331233        foreach(Rectangle wid; itemList) 
    12341234        { 
    1235             wid.idle(); 
     1235            if( wid !is null ) 
     1236                wid.idle(); 
    12361237        } 
    12371238     
     
    12581259        foreach(Rectangle wid; itemList) 
    12591260        { 
    1260             wid.render(draw); 
     1261            if( wid !is null ) 
     1262                wid.render(draw); 
    12611263        } 
    12621264