wxFlatNotebook

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia » Mon Jan 02, 2006 4:27 pm

http://www.priyank.in/downloads/wxFlatNotebook.zip

eranif, this file supports drag and drop of the tabs, means that the tab pages can be moved. Though not a clean implementation but it works. :D

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Mon Jan 02, 2006 5:02 pm

priyank_bolia, please create doxygen comments for your methods. This will help to update the documentation. I already created the documentation for all previously added source and finished adding the support of ImageList.

Code: Select all

/// This method does smth....
/**
\param param_name1 - this parameter is used for...
...
Some other descriptions
*/
void MethodName(int param_name1, ...);

priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia » Mon Jan 02, 2006 5:13 pm

T-Rex wrote:priyank_bolia, please create doxygen comments for your methods. This will help to update the documentation. I already created the documentation for all previously added source and finished adding the support of ImageList.

Code: Select all

/// This method does smth....
/**
\param param_name1 - this parameter is used for...
...
Some other descriptions
*/
void MethodName(int param_name1, ...);
its not possible me to upload the files again, so eranif please modify the wxFlatNotebook.h file functions to:

Code: Select all

	/**
	 * \brief Drop event handler, to be passed as function pointer to CTextDropTarget class.
	 * \param x X coordinate where the drop take place
	 * \param y Y coordinate where the drop take place
	 * \param data Dropped text
	 * \return Boolean values indicating the drop was successful or not
	 */
	bool OnTextDropTarget(wxCoord x, wxCoord y, const wxString& data);

	/**
	 * \brief Moves the tab page from one location to another
	 * \param nMove The index of the tab page to be moved.
	 * \param nMoveTo The index for the tab page, where it has to be moved
	 */
	void MoveTabPage(int nMove, int nMoveTo);


priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia » Mon Jan 02, 2006 5:21 pm

Code: Select all

///////////////////////////////////////////////////////////////////////////////
// Name:		TextDropTarget.h
// Purpose:     declaration and implementation of text drop notification sender.
// Author:      Priyank Bolia <[email protected]>
// URL:			http://www.priyank.in
// Created:     02/01/2006
// Copyright:   All contributors.
// Licence:     wxWindows license <http://www.wxwidgets.org/licence3.txt>
///////////////////////////////////////////////////////////////////////////////

#ifndef TEXTDROP_TARGET_H
#define TEXTDROP_TARGET_H

#ifdef wxUSE_DRAG_AND_DROP 

#include <wx/wx.h>
#include <wx/dnd.h>
#include <iostream>

using namespace std;

template <class T>
class CTextDropTarget : public wxTextDropTarget
{

private:
	typedef bool (T::*pt2Func)(wxCoord, wxCoord, const wxString&);
	T* m_pParent;					/// Pointer to the parent window.
	pt2Func m_pt2CallbackFunc;		/// function pointer to the parent window function to be  called for drop notification.

public:
	/**
	 * Constructor
	 * \param pParent Pointer to the parent window
	 * \param pt2CallbackFunc Function pointer to the parent window function to be called for drop notification.
	 * \return 
	 */
	CTextDropTarget(T* pParent, pt2Func pt2CallbackFunc);

	/**
	 * Default destructor
	 * \param void 
	 * \return 
	 */
	virtual ~CTextDropTarget(void);

	/**
	 * Drop event handler, this will call the parent window function to notify it.
	 * \param x X coordinate where the drop take place
	 * \param y Y coordinate where the drop take place
	 * \param data Dropped text
	 * \return Boolean values indicating the drop was successful or not
	 */
	virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
};

template <class T>
CTextDropTarget<T>::CTextDropTarget(T* pParent, pt2Func pt2CallbackFunc)
: m_pParent(pParent)
, m_pt2CallbackFunc(pt2CallbackFunc)
{
}

template <class T>
CTextDropTarget<T>::~CTextDropTarget(void)
{
}

template <class T>
bool CTextDropTarget<T>::OnDropText(wxCoord x, wxCoord y, const wxString& data)
{
	return (m_pParent->*m_pt2CallbackFunc)(x, y, data); 
}

#endif
	// wxUSE_DRAG_AND_DROP
#endif
	// TEXTDROP_TARGET_H

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Mon Jan 02, 2006 5:28 pm

nested typedefs... not sure that they will work correctly with BCBuilder.
Hey, people! Can anybody test this component under BCBuilder after our changes will be merged?

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif » Mon Jan 02, 2006 5:36 pm

Hi,

T-Rex, priyank_bolia,
I will start merging the files and update the sources including the documentations in the coming hours.

Regards,
Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

Ceniza
In need of some credit
In need of some credit
Posts: 7
Joined: Sat Dec 31, 2005 7:25 am
Location: Colombia (South America)

Post by Ceniza » Mon Jan 02, 2006 9:08 pm

Middle click to close has a weird behaviour: even if the tab closed wasn't the selected one, it will change selection.

mandrav is already testing integration with Code::Blocks, but he just found a bug http://forums.codeblocks.org/index.php? ... 6#msg13876

I just hope it don't become a mess discussing about the same library in two different forums.

Infinity
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Jan 02, 2006 11:10 pm

Post by Infinity » Mon Jan 02, 2006 11:17 pm

This is probably the first time that wxPython has anticipated wxWidgets in some new control ;-)

http://xoomer.virgilio.it/infinity77/en ... tebookctrl

http://sigmacore.net/andrea/?page_id=2 ==> NotebookCtrl

Some screenshots :-)

Very nice work!

Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif » Tue Jan 03, 2006 12:24 am

Hi,

I did some work in integrating T-Rex support for the image list - however i did found the changes still buggy (not T-Rex fault but wx)

However, I did get some requests to add more functionalities so I am attaching a partial work (but tested, by me)

With the following changes:

The following style are applicable for the notebook:

wxFNB_DEFAULT_STYLE
wxFNB_VC71
wxFNB_FANCY_TABS
wxFNB_BORDER
wxFNB_NO_X_BUTTON
wxFNB_NO_NAV_BUTTONS
wxFNB_MOUSE_MIDDLE_CLOSES_TABS

As you can see, user can now choose to display / not the X button, navigation arrows, or disable the middle mouse close click.

In addition, a thin border is drawn around the windows in the botebook by using the wxFNB_BORDER style

The sources, are updated you can download them.

Using the above new styles I was able to create nice dialog:
Image

Regards,
Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif » Tue Jan 03, 2006 8:08 am

Hi,

I have updated the source codes with a bug fix - Thanks T-Rex
Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif » Tue Jan 03, 2006 9:40 pm

Hi,

I have done some improvements + bug fixes

The sources are updated + I am attaching here 3 images of the notebook.
The demo is updated as well.

I think I am ready to complete this task! (one little bug that will be fixed and I think thats it)

Reminder:
The sources can be downloaded from:
http://www.eistware.com/wx/wxFlatNotebook.zip

Screenshots for the bottom style :
Image
Image
Image

Regards,
Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Tue Jan 03, 2006 10:26 pm

What about ImageList? As I said in PM everything should work fine, it seems that your problem appeards because you are using PNG images with lower bitrate...

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif » Tue Jan 03, 2006 10:33 pm

I dont agree - since from the screenshots, you can see that the images are working fine - i didnt modifed them.

Using the same images with standard notebook works fine, so the problem is in the code and not in the images

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Tue Jan 03, 2006 11:17 pm

In any case I'm searching for the solution :)
And one more thing...

/// Query the current book style
/**
\param None
*/

long GetBookStyle();

Please, delete bolded lines because error occures when generating the documentation....

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Wed Jan 04, 2006 12:48 am

Well, I tested everything once more and assumed that indeed bitmaps lose their alpha-channel when added to imagelist. So vector is the best solution (And in any case it is the fastest solution...) wxImageList works much more slower, I noticed that it works slow during profiling of my wxToolBox, but using of wxImageList is more convenient IMO.
So, we'll stop the choice on vector for now :)

Post Reply