NewPagodi / wxAccordion

An Accordion Control for wxWidgets
Other
28 stars 6 forks source link

Building on macOS #1

Open TopGun-DICD opened 5 years ago

TopGun-DICD commented 5 years ago

Hello, Building code with wxAccordion on Linux (CentOS 7 x64) and macOS (I am using macOS Mojave) with XCode (ver. 10.2.1) I have found next bugs in wxAccordion widget.

  1. Class wxAccordionStyle uses wxAccordion variable declaration (wxAccordion.h : 102) which was not declared previously. Adding pre-declaration of class wxAccordion before wxAccordionStyle will fix this issue. Should be (from line 71 in wxAccordion.h):

    class wxAccordion;
    class WXDLLIMPEXP_ACCORDION wxAccordionStyle
    {
    friend class wxAccordion;
    ...
  2. The use of wxSystemSettings (wxAccordion.cpp : 581 and below) needs header for wxSystemSettings to be included. In my case the next modification will fix this issue (from line 22 in wxAccordion.cpp):

    #include <wx/dcbuffer.h>
    #include <wx/settings.h>
  3. For some reason calling method computeCaptionInfo() from wxAccordion::Init() will fail. I don't know why, it looks like many things work incorrectly under macOS and Linux (not like under Windows) For example, program breaks on ::computeCaptionInfo(), line 1098:

    int collapseButtonHeight = m_collapseButton.GetHeight();

    As I understand it happens because under Linux and macOS it is not impossible to compute height of a button if it is wxNullBitmap (m_collapsableButton was set to wxNullBitmapButton in ::Init on line 571 in ::Init()) When I tried to fix this behavior with code like

int collapseButtonHeight = m_collapseButton.IsNull ? 0 : m_collapseButton.GetHeight();

pragram breaks on line 1123:

wxRect r=GetRect();

Commenting line 613 with computeCaptionInfo from ::Init() will fix this issue. Of course it should not be commented but wrapped in #ifdef(__WIN32) ... #else ... #endif (or something like this) directives for better compatibility.

Thanks for such a great component!