wxAnimation and wxANIM_TYPE_ANY [wxMSW 2.8.0]

Volker Bartheld dr_versaeg at freenet.de
Thu Nov 23 03:48:02 PST 2006


Hi!

I was playing a litte with wxAnimation and wxAnimationCtrl in wxWidgets
2.8.0. Does it have a reason why the enum value wxANIM_TYPE_ANY (see
%WXDIR%include\wx\animdecod.h) is encapsulated in

#if wxUSE_STREAMS
#endif

? I think, wxAnimation could be well used without wxUSE_STREAMS being
defined. At least

    wxAnimation TheAnimation;
    if(TheAnimation.LoadFile(fileName, (wxAnimationType)3 /*wxANIM_TYPE_ANY*/)) // was the animation loaded correctly from the file?
    {
      m_animationCtrl=new wxAnimationCtrl(this, wxID_ANY, TheAnimation);        // create the control
      m_animationCtrl->Play();                                                  // and play it
    }

worked fine for me.

Another little question: Since wxAnimationCtrl was formely called
wxGIFAnimationCtrl and also exposes a different interface, I find myself
in need to use some defines to branch between wxW-versions. In this
case,

#   if (wxVERSION_NUMBER>=2800)
    wxAnimation TheAnimation;
    if(TheAnimation.LoadFile(fileName, (wxAnimationType)3 /*wxANIM_TYPE_ANY*/)) // was the animation loaded correctly from the file?
    {
      m_animationCtrl=new wxAnimationCtrl(m_imageArea, wxID_ANY, TheAnimation); // create the control
      m_animationCtrl->Play();                                                  // and play it
    } // if(TheAnimation.LoadFile(fileName, (wxAnimationType)3 /*wxANIM_TYPE_ANY*/))
#   else // #if (wxVERSION_NUMBER>=2800)
      m_animationCtrl=new wxGIFAnimationCtrl(m_imageArea, wxID_ANY, fileName);  //  create wxGIFAnimationCtrl from file
      if(m_animationCtrl::IsValid()) m_animationCtrl->Play();                   // and play if valid
#   endif // #if (wxVERSION_NUMBER>=2800)

seemed the way to go. However, at the definition of wxVERSION_NUMBER in
%WXDIR%\include\wx\version.h, I read the following comment:

/*  some more defines, not really sure if they're [still] useful */

So - is there a better way to do this branch?


Thanks a lot and greets from Munich,

Volker
__
Mail replies to/an V B A R T H E L D at G M X dot D E






More information about the wx-users mailing list