Applied Ryan's native wxListBox and wxCheckListBox patch
in slightly modified form.. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37769 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
#define wxCHECKLBOX_STRING _T("[ ] ")
|
||||
#endif
|
||||
|
||||
//Use the native GTK2.0+ checklist?? You should say YYEEESS unless
|
||||
//there are like some major bugs or something :)
|
||||
#define wxUSE_NATIVEGTKCHECKLIST 1
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxCheckListBox
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -53,6 +57,10 @@ public:
|
||||
|
||||
int GetItemHeight() const;
|
||||
|
||||
#if wxUSE_NATIVEGTKCHECKLIST
|
||||
void DoCreateCheckList();
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
||||
};
|
||||
|
@@ -10,10 +10,6 @@
|
||||
#ifndef __GTKLISTBOXH__
|
||||
#define __GTKLISTBOXH__
|
||||
|
||||
#include "wx/list.h"
|
||||
|
||||
class WXDLLIMPEXP_BASE wxSortedArrayString;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListBox
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -84,27 +80,29 @@ public:
|
||||
|
||||
// implementation from now on
|
||||
|
||||
void GtkAddItem( const wxString &item, int pos=-1 );
|
||||
int GtkGetIndex( GtkWidget *item ) const;
|
||||
GtkWidget *GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
GdkWindow* GetGtkBinWindow();
|
||||
void OnInternalIdle();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
GtkList *m_list;
|
||||
wxList m_clientList;
|
||||
struct _GtkTreeView *m_treeview;
|
||||
struct _GtkListStore *m_liststore;
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
bool m_hasCheckBoxes;
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
|
||||
int m_prevSelection;
|
||||
bool m_blockEvent;
|
||||
bool m_spacePressed;
|
||||
|
||||
virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
|
||||
struct _GtkTreeEntry* GtkGetEntry(int pos) const;
|
||||
void GtkInsertItems(const wxArrayString& items,
|
||||
void** clientData, int pos);
|
||||
void GtkSetSelection(int n, const bool select, const bool blockEvent);
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
@@ -119,18 +117,7 @@ protected:
|
||||
virtual wxClientData* DoGetItemClientObject(int n) const;
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
// return the string label for the given item
|
||||
wxString GetRealLabel(struct _GList *item) const;
|
||||
|
||||
// Widgets that use the style->base colour for the BG colour should
|
||||
// override this and return true.
|
||||
virtual bool UseGTKStyleBase() const { return true; }
|
||||
|
||||
private:
|
||||
// this array is only used for controls with wxCB_SORT style, so only
|
||||
// allocate it if it's needed (hence using pointer)
|
||||
wxSortedArrayString *m_strings;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxListBox)
|
||||
};
|
||||
|
||||
|
76
include/wx/gtk/treeentry_gtk.h
Normal file
76
include/wx/gtk/treeentry_gtk.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* ///////////////////////////////////////////////////////////////////////////
|
||||
// Name: treeentry_gtk.h
|
||||
// Purpose: GtkTreeEntry - a string/userdata combo for use with treeview
|
||||
// Author: Ryan Norton
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 2006 Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////// */
|
||||
|
||||
#ifndef __GTK_TREE_ENTRY_H__
|
||||
#define __GTK_TREE_ENTRY_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <gtk/gtk.h> /* for gpointer and gchar* etc. */
|
||||
|
||||
#include "wx/dlimpexp.h"
|
||||
|
||||
#define GTK_TYPE_TREE_ENTRY (gtk_tree_entry_get_type())
|
||||
#define GTK_TREE_ENTRY(obj) (GTK_CHECK_CAST (obj, gtk_tree_entry_get_type (), GtkTreeEntry))
|
||||
#define GTK_TREE_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, gtk_tree_entry_get_type (), GtkTreeEntryClass))
|
||||
#define GTK_IS_TREE_ENTRY(obj) (GTK_CHECK_TYPE (obj, gtk_tree_entry_get_type ()))
|
||||
|
||||
typedef struct _GtkTreeEntry GtkTreeEntry;
|
||||
typedef struct _GtkTreeEntryClass GtkTreeEntryClass;
|
||||
|
||||
typedef void (*GtkTreeEntryDestroy) (GtkTreeEntry* entry, gpointer context);
|
||||
|
||||
struct _GtkTreeEntry
|
||||
{
|
||||
GObject parent; /* object instance */
|
||||
gchar* label; /* label - always copied by this object except on get */
|
||||
gchar* collate_key; /* collate key used for string comparisons/sorting */
|
||||
gpointer userdata; /* untouched userdata */
|
||||
GtkTreeEntryDestroy destroy_func; /* called upon destruction - use for freeing userdata etc. */
|
||||
gpointer destroy_func_data; /* context passed to destroy_func */
|
||||
};
|
||||
|
||||
struct _GtkTreeEntryClass
|
||||
{
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
WXDLLIMPEXP_CORE
|
||||
GtkTreeEntry* gtk_tree_entry_new (void);
|
||||
|
||||
WXDLLIMPEXP_CORE
|
||||
GtkType gtk_tree_entry_get_type (void);
|
||||
|
||||
WXDLLIMPEXP_CORE
|
||||
gchar* gtk_tree_entry_get_collate_key (GtkTreeEntry* entry);
|
||||
|
||||
WXDLLIMPEXP_CORE
|
||||
gchar* gtk_tree_entry_get_label (GtkTreeEntry* entry);
|
||||
|
||||
WXDLLIMPEXP_CORE
|
||||
gpointer gtk_tree_entry_get_userdata (GtkTreeEntry* entry);
|
||||
|
||||
WXDLLIMPEXP_CORE
|
||||
void gtk_tree_entry_set_label (GtkTreeEntry* entry, const gchar* label);
|
||||
|
||||
WXDLLIMPEXP_CORE
|
||||
void gtk_tree_entry_set_userdata (GtkTreeEntry* entry, gpointer userdata);
|
||||
|
||||
WXDLLIMPEXP_CORE
|
||||
void gtk_tree_entry_set_destroy_func (GtkTreeEntry* entry,
|
||||
GtkTreeEntryDestroy destroy_func,
|
||||
gpointer destroy_func_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __GTK_TREE_ENTRY_H__ */
|
Reference in New Issue
Block a user