Author Topic: wxFlatNotebook 2.2  (Read 16945 times)

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 127
Re: wxFlatNotebook 2.2
« Reply #30 on: July 31, 2007, 08:26:53 pm »
Since wxFlatNotebook 2.2 requires wxWidgets 2.8, have we dropped support for using 2.6 to build C::B?
I wish to verify before updating some patches.

It looks like that wxFlatNotebook can be compiled on wxGTK 2.6 when you change the Contains(wxPoint) method of wxRect back to Inside(wxPoint) - 6 occurences in wxFlatNotebook.cpp
Code::Blocks package maintainer for Fedora and EPEL

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 127
Re: wxFlatNotebook 2.2
« Reply #31 on: July 31, 2007, 08:28:36 pm »
In wxWidgets 2.8 the wxRect class got an additional member-function: wxRect::Contains. wxFNB 2.2 uses this function and therefore does not build with wxWidgets 2.6 anymore.

Contains() from wx2.8 == Inside() from wx2.6, there is an compatibility #define in the code of wx2.8 (gdicmn.h)
Code::Blocks package maintainer for Fedora and EPEL

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5234
Re: wxFlatNotebook 2.2
« Reply #32 on: July 31, 2007, 08:44:18 pm »
In wxWidgets 2.8 the wxRect class got an additional member-function: wxRect::Contains. wxFNB 2.2 uses this function and therefore does not build with wxWidgets 2.6 anymore.

Contains() from wx2.8 == Inside() from wx2.6, there is an compatibility #define in the code of wx2.8 (gdicmn.h)
meaning it should build on wx26 ?

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 127
Re: wxFlatNotebook 2.2
« Reply #33 on: July 31, 2007, 08:45:49 pm »
In wxWidgets 2.8 the wxRect class got an additional member-function: wxRect::Contains. wxFNB 2.2 uses this function and therefore does not build with wxWidgets 2.6 anymore.

Contains() from wx2.8 == Inside() from wx2.6, there is an compatibility #define in the code of wx2.8 (gdicmn.h)
meaning it should build on wx26 ?

Sure, I have just built it.
Code::Blocks package maintainer for Fedora and EPEL

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5234
Re: wxFlatNotebook 2.2
« Reply #34 on: July 31, 2007, 08:52:31 pm »
so although we do not support wx26x (officially anymore : more or less) : it still works ;-)

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 127
Re: wxFlatNotebook 2.2
« Reply #35 on: July 31, 2007, 09:03:29 pm »
The patch is here
Code: [Select]
Index: wxFlatNotebook.cpp
===================================================================
--- wxFlatNotebook.cpp (revision 4338)
+++ wxFlatNotebook.cpp (working copy)
@@ -1122,7 +1122,11 @@
  }
 
  rect = wxRect(btnXPos, 8, 16, 16);
+#if wxCHECK_VERSION(2, 8, 0)
  if(rect.Contains(pt))
+#else
+ if(rect.Inside(pt))
+#endif
  {
  return (style & wxFNB_NO_X_BUTTON) ? wxFNB_NOWHERE : wxFNB_X;
  }
@@ -1131,18 +1135,30 @@
  if( style & wxFNB_DROPDOWN_TABS_LIST )
  {
  rect = wxRect(render->GetDropArrowButtonPos( this ), 8, 16, 16);
+#if wxCHECK_VERSION(2, 8, 0)
  if( rect.Contains(pt) )
+#else
+ if( rect.Inside(pt) )
+#endif
  return wxFNB_DROP_DOWN_ARROW;
  }
 
+#if wxCHECK_VERSION(2, 8, 0)
  if(rect.Contains(pt))
+#else
+ if(rect.Inside(pt))
+#endif
  {
  return (style & wxFNB_NO_NAV_BUTTONS) ? wxFNB_NOWHERE : wxFNB_RIGHT_ARROW;
  }
 
 
  rect = wxRect(btnLeftPos, 8, 16, 16);
+#if wxCHECK_VERSION(2, 8, 0)
  if(rect.Contains(pt))
+#else
+ if(rect.Inside(pt))
+#endif
  {
  return (style & wxFNB_NO_NAV_BUTTONS) ? wxFNB_NOWHERE : wxFNB_LEFT_ARROW;
  }
@@ -1159,7 +1175,11 @@
  if(style & wxFNB_X_ON_TAB && (int)cur == GetSelection())
  {
  // 'x' button exists on a tab
+#if wxCHECK_VERSION(2, 8, 0)
  if(m_pagesInfoVec[cur].GetXRect().Contains(pt))
+#else
+ if(m_pagesInfoVec[cur].GetXRect().Inside(pt))
+#endif
  {
  pageInfo = pgInfo;
  tabIdx = (int)cur;
@@ -1187,7 +1207,11 @@
 
  wxRect tabRect = wxRect(pgInfo.GetPosition().x, pgInfo.GetPosition().y,
  pgInfo.GetSize().x, pgInfo.GetSize().y);
+#if wxCHECK_VERSION(2, 8, 0)
  if(tabRect.Contains(pt))
+#else
+ if(tabRect.Inside(pt))
+#endif
  {
  // We have a match
  pageInfo = pgInfo;
Code::Blocks package maintainer for Fedora and EPEL

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5234
Re: wxFlatNotebook 2.2
« Reply #36 on: July 31, 2007, 09:09:46 pm »
so it does not build without manual patch. I prefer to not to apply this patch, so our sources are the same as eranif's. Unless he would do a similar thing, but my opinion : wx26 is old ....

Offline SharkCZ

  • Almost regular
  • **
  • Posts: 127
Re: wxFlatNotebook 2.2
« Reply #37 on: July 31, 2007, 09:14:26 pm »
so it does not build without manual patch. I prefer to not to apply this patch, so our sources are the same as eranif's. Unless he would do a similar thing, but my opinion : wx26 is old ....

I agree, it was published only for "archive" purposes. And I will use it locally for official FC-6 builds during then next few months until the Fedora 8 is published.
Code::Blocks package maintainer for Fedora and EPEL

Offline eranif

  • Regular
  • ***
  • Posts: 254
Re: wxFlatNotebook 2.2
« Reply #38 on: July 31, 2007, 10:00:55 pm »
I fixed this portability issue with 2.6.x in SVN
wxFlatNotebook.cpp:
Code: [Select]
static bool InsideRect(const wxRect &rect, const wxPoint &pt)
{
#if wxCHECK_VERSION(2, 8, 0)
return rect.Contains(pt);
#else
return rect.Inside(pt);
#endif
}

and replaced all calls for wxRect::Contains to it.
I dont have 2.6 - but I think it should compile now (can anyone confirm this?)

Eran

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5234
Re: wxFlatNotebook 2.2
« Reply #39 on: July 31, 2007, 10:26:18 pm »
I will upgrade our sources tomorrow accordingly