wxWidgets and Windows API in the same project? [C++, Cross Platform]

Started by
1 comment, last by ajm113 13 years, 4 months ago
Hello all I have source at the moment is running pure Windows API. I plan on cross platform my software on my MacBook which has Xcode Installed and yes, I do know there is no option called Convert Visual Studio to Xcode menu button anywhere. My source code is very flexible for me and I want to use wxWidgets for Mac.

Anyways I pretty much setup my code like this:
bool MyProgram::InitApp(char* title, ...){#ifdef WINDOWS  hWnd = CreateWindow(...);#else//If windows isn't defined use WX Functions instead.#endif    return true;}


Is it possible to use wxWidgets with out having to inheritance between the wxWidgets to my own class? I don't want to use more lines of codes if I can simply use the "#ifdef" to separate my Win32 and wxWidgets calls.

OR is it better to create a new project from scratch just in Xcode and simply use inheritance between my class and WX?

Thanks for reading or posting!
Check out my open source code projects/libraries! My Homepage You may learn something.
Advertisement
Wouldn't this mean duplicating a big portion of your code? why not going with wxWidgets under Windows as well?
Well I thought while I port to wxWidgets I can still work under windows API with out having to duplicate code and still being able to multi task with other things with out having 2 projects open at the sometime, but if it's not possible it's no big deal, I have one question to add. Is it possible to add event handler for the drop down menu with out having to create new functions?

Goal code look alike:
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)       //...        //Use menu event function	EVT_MENU(TestGLCanvas::HandleMenu)END_EVENT_TABLE()TestGLCanvas::HandleMenu(wxMenuEvent& WXUNUSED(event)){  switch(event.getId())  {   case SOMETHING:    printf("The something button was clicked!");   break;  }}
Check out my open source code projects/libraries! My Homepage You may learn something.

This topic is closed to new replies.

Advertisement