Posts

Showing posts from March, 2014

How to implement mouse drag using wxWidgets

I have an application without borders so I cannot move the application. This application has a wxPanel so the only way I can click and drag is thru the wxPanel. How to implement mouse drag? class myFrame : public wxFrame { public: myFrame(const wxString& title, wxWindow *parent=NULL); wxWindow* parent; private: wxDECLARE_EVENT_TABLE(); } class myPanel : public wxPanel { public: myPanel (wxWindow* parent)     { this->parent = parent; dragging=false; x=0,y=0;               Create(parent, wxID_ANY,wxDefaultPosition, *new wxSize(100,100));     } void onMouseDown(wxMouseEvent& evt) { CaptureMouse(); x = evt.GetX(); y = evt.GetY(); dragging=true; } void onMouseUp(wxMouseEvent& evt) { ReleaseMouse(); dragging=false; } void onMove(wxMouseEvent& evt) { if(dragging) { wxPoint mouseOnScreen = wxGetMousePosition(); int newx = mouseOnScreen.x - x;

How to put an image to wxPanel using wxWidgets

Image
1. I created the class xOsdHeaderPanel 2. Must call the function wxInitAllImageHandlers(); 3. Create a wxBitmap object and call SetBackgroundBitmap(..) class xOsdHeaderPanel : public wxCustomBackgroundWindow<wxPanel> { public: xOsdHeaderPanel(wxWindow* parent)     { wxInitAllImageHandlers(); const wxSize xxsize(733,80);         Create(parent, wxID_ANY,wxDefaultPosition,xxsize); wxBitmap bitmap(*new wxImage(wxT("./Header.png"),wxBITMAP_TYPE_PNG)); SetBackgroundBitmap(bitmap); new wxButton(this,wxID_ANY,wxT("Sample Button"));     } }; Result:

How to build Boost in Windows and Linux

============ WIN7 ============ Prerequisites -------------- -  Visual Studio 2008 Professional with SP3 Build Steps -------------- 1. Unzipped boost_1_55_0.zip 2. Execute \boost_1_55_0\bootstrap.bat 3. Use the following command to generate files of release    bjam toolset=msvc-9.0 variant=release threading=multi link=shared define=_BIND_TO_CURRENT_VCLIBS_VERSION 4. The binaries can be found in \boost_1_55_0\bin.v2 ============= SLEPOS11SP3 ============= Prerequisites -------------- - GCC 4.3.4 - Linux 3.0.93 Build Steps ------------- 1. Unzipped boost_1_55_0.zip 2. Execute ./bootstrap.sh --with-libraries=all --with-icu --prefix=/usr/local/boost 3. Execute ./b2 variant=release toolset=gcc link=shared threading=multi runtime-link=shared install 4. The files can be found in \usr\local\boost That's it!

How to build Xerces-c in Windows and Linux

================= MS Windows (Win7) ================= Prerequisite: - Visual Studio 2008 SP3 - xerces-c-3.1.1.zip Build Steps: 1. Unzipped xerces-c-3.1.1.zip 2. Open the solution in VS 2008 \xerces\xerces-c-3.1.1\projects\Win32\VC9\xerces-all\xerces-all.sln 3. Build the projects in "Release" mode 4. The binaries can be found in \xerces\xerces-c-3.1.1\Build\Win32\VC9\Release =========== Linux (Suse) =========== prerequisites -------------- - GCC 4.3.4 - Linux 3.0.93 xerces -------- 1. Unzipped xerces-c-3.1.1.zip in \usr\local 2. Create another folder (any folder name but in this example it's "xerces") 3. Choose current directory "xerces" and call "../xerces-c3.1.1/configure 4. Choose current directory "xerces" and call "make build" 5. Choose current directory "xerces" and call "make install" 6. The libraries can be found in \usr\local\lib 7. The b