Second try at doing Set/GetClient right
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ed7174bafe
commit
f5e27805de
@ -296,6 +296,8 @@ public:
|
||||
wxEVT_COMMAND_COMBOBOX_SELECTED
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxClientData;
|
||||
|
||||
class WXDLLEXPORT wxCommandEvent: public wxEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxCommandEvent)
|
||||
@ -308,10 +310,14 @@ class WXDLLEXPORT wxCommandEvent: public wxEvent
|
||||
*
|
||||
*/
|
||||
|
||||
// Set/Get listbox/choice client data
|
||||
// Set/Get client data from controls
|
||||
inline void SetClientData(void* clientData) { m_clientData = clientData; }
|
||||
inline void *GetClientData() const { return m_clientData; }
|
||||
|
||||
// Set/Get client object from controls
|
||||
inline void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
|
||||
inline void *GetClientObject() const { return m_clientObject; }
|
||||
|
||||
// Get listbox selection if single-choice
|
||||
inline int GetSelection() const { return m_commandInt; }
|
||||
|
||||
@ -334,8 +340,9 @@ class WXDLLEXPORT wxCommandEvent: public wxEvent
|
||||
public:
|
||||
char* m_commandString; // String event argument
|
||||
int m_commandInt;
|
||||
long m_extraLong; // Additional information (e.g. select/deselect)
|
||||
long m_extraLong; // Additional information (e.g. select/deselect)
|
||||
void* m_clientData; // Arbitrary client data
|
||||
wxClientData* m_clientObject; // Arbitrary client object
|
||||
};
|
||||
|
||||
// Scroll event class
|
||||
@ -979,7 +986,7 @@ public:
|
||||
// the child which has the focus currently (may be NULL - use
|
||||
// wxWindow::FindFocus then)
|
||||
wxWindow* GetCurrentFocus() const { return (wxWindow *)m_clientData; }
|
||||
void SetCurrentFocus(wxWindow *win) { m_clientData = (char *)win; }
|
||||
void SetCurrentFocus(wxWindow *win) { m_clientData = (void *)win; }
|
||||
};
|
||||
|
||||
/* TODO
|
||||
@ -1042,9 +1049,6 @@ class WXDLLEXPORT wxEvtHandler: public wxObject
|
||||
|
||||
virtual bool OnClose(void);
|
||||
|
||||
inline char *GetClientData(void) const { return m_clientData; }
|
||||
inline void SetClientData(char *clientData) { m_clientData = clientData; }
|
||||
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
|
||||
|
||||
@ -1063,7 +1067,6 @@ protected:
|
||||
protected:
|
||||
wxEvtHandler* m_nextHandler;
|
||||
wxEvtHandler* m_previousHandler;
|
||||
char* m_clientData; // Any user client data
|
||||
bool m_enabled; // Is event handler enabled?
|
||||
wxList* m_dynamicEvents;
|
||||
|
||||
|
@ -86,7 +86,8 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
|
||||
void AppendCommon( const wxString &item );
|
||||
void ApplyWidgetStyle();
|
||||
|
@ -106,6 +106,7 @@ public:
|
||||
|
||||
bool m_alreadySent;
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
|
||||
void AppendCommon( const wxString &item );
|
||||
GtkWidget* GetConnectWidget();
|
||||
|
@ -101,7 +101,8 @@ public:
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
GtkList *m_list;
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
};
|
||||
|
||||
#endif // __GTKLISTBOXH__
|
||||
|
@ -72,22 +72,6 @@ public:
|
||||
virtual ~wxClientData() { }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxVoidClientData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxVoidClientData : public wxClientData
|
||||
{
|
||||
public:
|
||||
wxVoidClientData() { m_data = NULL; }
|
||||
wxVoidClientData( void *data ) { m_data = data; }
|
||||
void SetData( void* data ) { m_data = data; }
|
||||
void *GetData() const { return m_data; }
|
||||
|
||||
private:
|
||||
void *m_data;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxStringClientData
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -195,7 +179,6 @@ public:
|
||||
|
||||
virtual void SetClientData( void *data );
|
||||
virtual void *GetClientData();
|
||||
|
||||
|
||||
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
|
||||
virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; }
|
||||
@ -334,7 +317,8 @@ public:
|
||||
bool m_isEnabled;
|
||||
wxString m_windowName;
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
wxClientData *m_clientData;
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
|
||||
GtkWidget *m_widget;
|
||||
GtkWidget *m_wxwindow;
|
||||
|
@ -86,7 +86,8 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
|
||||
void AppendCommon( const wxString &item );
|
||||
void ApplyWidgetStyle();
|
||||
|
@ -106,6 +106,7 @@ public:
|
||||
|
||||
bool m_alreadySent;
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
|
||||
void AppendCommon( const wxString &item );
|
||||
GtkWidget* GetConnectWidget();
|
||||
|
@ -101,7 +101,8 @@ public:
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
GtkList *m_list;
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientDataList;
|
||||
wxList m_clientObjectList;
|
||||
};
|
||||
|
||||
#endif // __GTKLISTBOXH__
|
||||
|
@ -72,22 +72,6 @@ public:
|
||||
virtual ~wxClientData() { }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxVoidClientData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxVoidClientData : public wxClientData
|
||||
{
|
||||
public:
|
||||
wxVoidClientData() { m_data = NULL; }
|
||||
wxVoidClientData( void *data ) { m_data = data; }
|
||||
void SetData( void* data ) { m_data = data; }
|
||||
void *GetData() const { return m_data; }
|
||||
|
||||
private:
|
||||
void *m_data;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxStringClientData
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -195,7 +179,6 @@ public:
|
||||
|
||||
virtual void SetClientData( void *data );
|
||||
virtual void *GetClientData();
|
||||
|
||||
|
||||
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
|
||||
virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; }
|
||||
@ -334,7 +317,8 @@ public:
|
||||
bool m_isEnabled;
|
||||
wxString m_windowName;
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
wxClientData *m_clientData;
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
|
||||
GtkWidget *m_widget;
|
||||
GtkWidget *m_wxwindow;
|
||||
|
@ -104,6 +104,7 @@ wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId)
|
||||
{
|
||||
m_eventType = commandType;
|
||||
m_clientData = (char *) NULL;
|
||||
m_clientObject = (wxClientData *) NULL;
|
||||
m_extraLong = 0;
|
||||
m_commandInt = 0;
|
||||
m_id = theId;
|
||||
@ -262,7 +263,6 @@ wxKeyEvent::wxKeyEvent(wxEventType type)
|
||||
|
||||
wxEvtHandler::wxEvtHandler(void)
|
||||
{
|
||||
m_clientData = (char *) NULL;
|
||||
m_nextHandler = (wxEvtHandler *) NULL;
|
||||
m_previousHandler = (wxEvtHandler *) NULL;
|
||||
m_enabled = TRUE;
|
||||
|
@ -55,7 +55,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
||||
m_needParent = TRUE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
|
||||
SetValidator( validator );
|
||||
|
||||
m_widget = gtk_option_menu_new();
|
||||
@ -70,7 +70,8 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
|
||||
gtk_menu_append( GTK_MENU(menu), item );
|
||||
|
||||
@ -100,14 +101,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
wxChoice::~wxChoice()
|
||||
{
|
||||
wxNode *node = m_clientDataList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientDataList.Clear();
|
||||
Clear();
|
||||
}
|
||||
|
||||
void wxChoice::AppendCommon( const wxString &item )
|
||||
@ -132,24 +126,24 @@ void wxChoice::AppendCommon( const wxString &item )
|
||||
|
||||
void wxChoice::Append( const wxString &item )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxChoice::Append( const wxString &item, void *clientData )
|
||||
{
|
||||
if (clientData)
|
||||
m_clientDataList.Append( (wxObject*) new wxVoidClientData( clientData ) );
|
||||
else
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxChoice::Append( const wxString &item, wxClientData *clientData )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*) clientData );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
@ -161,13 +155,7 @@ void wxChoice::SetClientData( int n, void* clientData )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
if (clientData)
|
||||
node->SetData( (wxObject*) new wxVoidClientData(clientData) );
|
||||
else
|
||||
node->SetData( (wxObject*) NULL );
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxChoice::GetClientData( int n )
|
||||
@ -177,36 +165,31 @@ void* wxChoice::GetClientData( int n )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return NULL;
|
||||
|
||||
wxVoidClientData *cd = (wxVoidClientData*) node->Data();
|
||||
if (cd)
|
||||
return cd->GetData();
|
||||
else
|
||||
return (void*) NULL;
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxChoice::SetClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
wxClientData* wxChoice::GetClientObject( int n )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return (wxClientData*) NULL;
|
||||
|
||||
return (wxClientData*) node->Data();
|
||||
}
|
||||
|
||||
|
||||
void wxChoice::Clear()
|
||||
{
|
||||
@ -216,13 +199,15 @@ void wxChoice::Clear()
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||
|
||||
wxNode *node = m_clientDataList.First();
|
||||
wxNode *node = m_clientObjectList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientObjectList.Clear();
|
||||
|
||||
m_clientDataList.Clear();
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i] );
|
||||
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientObjectList.Append( (wxObject*)NULL );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
@ -148,24 +149,24 @@ void wxComboBox::AppendCommon( const wxString &item )
|
||||
|
||||
void wxComboBox::Append( const wxString &item )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxComboBox::Append( const wxString &item, void *clientData )
|
||||
{
|
||||
if (clientData)
|
||||
m_clientDataList.Append( (wxObject*) new wxVoidClientData( clientData ) );
|
||||
else
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*)NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxComboBox::Append( const wxString &item, wxClientData *clientData )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) clientData );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
@ -177,13 +178,7 @@ void wxComboBox::SetClientData( int n, void* clientData )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
if (clientData)
|
||||
node->SetData( (wxObject*) new wxVoidClientData(clientData) );
|
||||
else
|
||||
node->SetData( (wxObject*) NULL );
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxComboBox::GetClientData( int n )
|
||||
@ -193,23 +188,19 @@ void* wxComboBox::GetClientData( int n )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return NULL;
|
||||
|
||||
wxVoidClientData *cd = (wxVoidClientData*) node->Data();
|
||||
if (cd)
|
||||
return cd->GetData();
|
||||
else
|
||||
return (void*) NULL;
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxComboBox::SetClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
@ -230,13 +221,15 @@ void wxComboBox::Clear()
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
|
||||
|
||||
wxNode *node = m_clientDataList.First();
|
||||
wxNode *node = m_clientObjectList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientObjectList.Clear();
|
||||
|
||||
m_clientDataList.Clear();
|
||||
}
|
||||
|
||||
@ -258,15 +251,17 @@ void wxComboBox::Delete( int n )
|
||||
gtk_list_remove_items( listbox, list );
|
||||
g_list_free( list );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wrong index" );
|
||||
}
|
||||
else
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
m_clientObjectList.DeleteNode( node );
|
||||
}
|
||||
|
||||
node = m_clientDataList.Nth( n );
|
||||
if (node)
|
||||
{
|
||||
m_clientDataList.DeleteNode( node );
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +101,9 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
GtkWidget *list_item;
|
||||
list_item = gtk_list_item_new_with_label( choices[i] );
|
||||
|
||||
@ -115,8 +118,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
ConnectWidget( list_item );
|
||||
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
}
|
||||
|
||||
@ -138,14 +139,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
wxListBox::~wxListBox()
|
||||
{
|
||||
wxNode *node = m_clientDataList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientDataList.Clear();
|
||||
Clear();
|
||||
}
|
||||
|
||||
void wxListBox::AppendCommon( const wxString &item )
|
||||
@ -174,24 +168,24 @@ void wxListBox::AppendCommon( const wxString &item )
|
||||
|
||||
void wxListBox::Append( const wxString &item )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxListBox::Append( const wxString &item, void *clientData )
|
||||
{
|
||||
if (clientData)
|
||||
m_clientDataList.Append( (wxObject*) new wxVoidClientData( clientData ) );
|
||||
else
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxListBox::Append( const wxString &item, wxClientData *clientData )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*) clientData );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
@ -203,13 +197,7 @@ void wxListBox::SetClientData( int n, void* clientData )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
if (clientData)
|
||||
node->SetData( (wxObject*) new wxVoidClientData(clientData) );
|
||||
else
|
||||
node->SetData( (wxObject*) NULL );
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxListBox::GetClientData( int n )
|
||||
@ -219,18 +207,14 @@ void* wxListBox::GetClientData( int n )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return NULL;
|
||||
|
||||
wxVoidClientData *cd = (wxVoidClientData*) node->Data();
|
||||
if (cd)
|
||||
return cd->GetData();
|
||||
else
|
||||
return (void*) NULL;
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxListBox::SetClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
@ -243,7 +227,7 @@ wxClientData* wxListBox::GetClientObject( int n )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return (wxClientData*) NULL;
|
||||
|
||||
return (wxClientData*) node->Data();
|
||||
@ -255,13 +239,15 @@ void wxListBox::Clear()
|
||||
|
||||
gtk_list_clear_items( m_list, 0, Number() );
|
||||
|
||||
wxNode *node = m_clientDataList.First();
|
||||
wxNode *node = m_clientObjectList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientObjectList.Clear();
|
||||
|
||||
m_clientDataList.Clear();
|
||||
}
|
||||
|
||||
@ -281,15 +267,17 @@ void wxListBox::Delete( int n )
|
||||
gtk_list_remove_items( m_list, list );
|
||||
g_list_free( list );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wrong index" );
|
||||
}
|
||||
else
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
m_clientObjectList.DeleteNode( node );
|
||||
}
|
||||
|
||||
node = m_clientDataList.Nth( n );
|
||||
if (node)
|
||||
{
|
||||
m_clientDataList.DeleteNode( node );
|
||||
}
|
||||
}
|
||||
|
@ -124,28 +124,28 @@ static guint32 gs_timeLastClick = 0;
|
||||
|
||||
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
if (!win->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
win->m_updateRegion.Union( gdk_event->area.x,
|
||||
gdk_event->area.y,
|
||||
gdk_event->area.width,
|
||||
gdk_event->area.height );
|
||||
win->m_updateRegion.Union( gdk_event->area.x,
|
||||
gdk_event->area.y,
|
||||
gdk_event->area.width,
|
||||
gdk_event->area.height );
|
||||
|
||||
if (gdk_event->count > 0) return;
|
||||
if (gdk_event->count > 0) return;
|
||||
|
||||
/*
|
||||
printf( "OnExpose from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
printf( "OnExpose from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
wxPaintEvent event( win->GetId() );
|
||||
event.SetEventObject( win );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
wxPaintEvent event( win->GetId() );
|
||||
event.SetEventObject( win );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
win->m_updateRegion.Clear();
|
||||
win->m_updateRegion.Clear();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -154,16 +154,16 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
||||
|
||||
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
if (!win->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||
|
||||
wxPaintEvent event( win->GetId() );
|
||||
event.SetEventObject( win );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
wxPaintEvent event( win->GetId() );
|
||||
event.SetEventObject( win );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
win->m_updateRegion.Clear();
|
||||
win->m_updateRegion.Clear();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -172,131 +172,131 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle
|
||||
|
||||
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
|
||||
{
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
|
||||
/*
|
||||
printf( "OnKeyPress from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
printf( "OnKeyPress from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
long key_code = 0;
|
||||
switch (gdk_event->keyval)
|
||||
{
|
||||
case GDK_BackSpace: key_code = WXK_BACK; break;
|
||||
case GDK_Tab: key_code = WXK_TAB; break;
|
||||
case GDK_Linefeed: key_code = WXK_RETURN; break;
|
||||
case GDK_Clear: key_code = WXK_CLEAR; break;
|
||||
case GDK_Return: key_code = WXK_RETURN; break;
|
||||
case GDK_Pause: key_code = WXK_PAUSE; break;
|
||||
case GDK_Scroll_Lock: key_code = WXK_SCROLL; break;
|
||||
case GDK_Escape: key_code = WXK_ESCAPE; break;
|
||||
case GDK_Delete: key_code = WXK_DELETE; break;
|
||||
case GDK_Home: key_code = WXK_HOME; break;
|
||||
case GDK_Left: key_code = WXK_LEFT; break;
|
||||
case GDK_Up: key_code = WXK_UP; break;
|
||||
case GDK_Right: key_code = WXK_RIGHT; break;
|
||||
case GDK_Down: key_code = WXK_DOWN; break;
|
||||
case GDK_Prior: key_code = WXK_PRIOR; break;
|
||||
// case GDK_Page_Up: key_code = WXK_PAGEUP; break;
|
||||
case GDK_Next: key_code = WXK_NEXT; break;
|
||||
// case GDK_Page_Down: key_code = WXK_PAGEDOWN; break;
|
||||
case GDK_End: key_code = WXK_END; break;
|
||||
case GDK_Begin: key_code = WXK_HOME; break;
|
||||
case GDK_Select: key_code = WXK_SELECT; break;
|
||||
case GDK_Print: key_code = WXK_PRINT; break;
|
||||
case GDK_Execute: key_code = WXK_EXECUTE; break;
|
||||
case GDK_Insert: key_code = WXK_INSERT; break;
|
||||
case GDK_Num_Lock: key_code = WXK_NUMLOCK; break;
|
||||
case GDK_KP_Tab: key_code = WXK_TAB; break;
|
||||
case GDK_KP_Enter: key_code = WXK_RETURN; break;
|
||||
case GDK_KP_Home: key_code = WXK_HOME; break;
|
||||
case GDK_KP_Left: key_code = WXK_LEFT; break;
|
||||
case GDK_KP_Up: key_code = WXK_UP; break;
|
||||
case GDK_KP_Right: key_code = WXK_RIGHT; break;
|
||||
case GDK_KP_Down: key_code = WXK_DOWN; break;
|
||||
case GDK_KP_Prior: key_code = WXK_PRIOR; break;
|
||||
// case GDK_KP_Page_Up: key_code = WXK_PAGEUP; break;
|
||||
case GDK_KP_Next: key_code = WXK_NEXT; break;
|
||||
// case GDK_KP_Page_Down: key_code = WXK_PAGEDOWN; break;
|
||||
case GDK_KP_End: key_code = WXK_END; break;
|
||||
case GDK_KP_Begin: key_code = WXK_HOME; break;
|
||||
case GDK_KP_Insert: key_code = WXK_INSERT; break;
|
||||
case GDK_KP_Delete: key_code = WXK_DELETE; break;
|
||||
case GDK_KP_Multiply: key_code = WXK_MULTIPLY; break;
|
||||
case GDK_KP_Add: key_code = WXK_ADD; break;
|
||||
case GDK_KP_Separator: key_code = WXK_SEPARATOR; break;
|
||||
case GDK_KP_Subtract: key_code = WXK_SUBTRACT; break;
|
||||
case GDK_KP_Decimal: key_code = WXK_DECIMAL; break;
|
||||
case GDK_KP_Divide: key_code = WXK_DIVIDE; break;
|
||||
case GDK_KP_0: key_code = WXK_NUMPAD0; break;
|
||||
case GDK_KP_1: key_code = WXK_NUMPAD1; break;
|
||||
case GDK_KP_2: key_code = WXK_NUMPAD2; break;
|
||||
case GDK_KP_3: key_code = WXK_NUMPAD3; break;
|
||||
case GDK_KP_4: key_code = WXK_NUMPAD4; break;
|
||||
case GDK_KP_5: key_code = WXK_NUMPAD5; break;
|
||||
case GDK_KP_6: key_code = WXK_NUMPAD6; break;
|
||||
case GDK_KP_7: key_code = WXK_NUMPAD7; break;
|
||||
case GDK_KP_8: key_code = WXK_NUMPAD7; break;
|
||||
case GDK_KP_9: key_code = WXK_NUMPAD9; break;
|
||||
case GDK_F1: key_code = WXK_F1; break;
|
||||
case GDK_F2: key_code = WXK_F2; break;
|
||||
case GDK_F3: key_code = WXK_F3; break;
|
||||
case GDK_F4: key_code = WXK_F4; break;
|
||||
case GDK_F5: key_code = WXK_F5; break;
|
||||
case GDK_F6: key_code = WXK_F6; break;
|
||||
case GDK_F7: key_code = WXK_F7; break;
|
||||
case GDK_F8: key_code = WXK_F8; break;
|
||||
case GDK_F9: key_code = WXK_F9; break;
|
||||
case GDK_F10: key_code = WXK_F10; break;
|
||||
case GDK_F11: key_code = WXK_F11; break;
|
||||
case GDK_F12: key_code = WXK_F12; break;
|
||||
default:
|
||||
long key_code = 0;
|
||||
switch (gdk_event->keyval)
|
||||
{
|
||||
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
|
||||
key_code = gdk_event->keyval;
|
||||
case GDK_BackSpace: key_code = WXK_BACK; break;
|
||||
case GDK_Tab: key_code = WXK_TAB; break;
|
||||
case GDK_Linefeed: key_code = WXK_RETURN; break;
|
||||
case GDK_Clear: key_code = WXK_CLEAR; break;
|
||||
case GDK_Return: key_code = WXK_RETURN; break;
|
||||
case GDK_Pause: key_code = WXK_PAUSE; break;
|
||||
case GDK_Scroll_Lock: key_code = WXK_SCROLL; break;
|
||||
case GDK_Escape: key_code = WXK_ESCAPE; break;
|
||||
case GDK_Delete: key_code = WXK_DELETE; break;
|
||||
case GDK_Home: key_code = WXK_HOME; break;
|
||||
case GDK_Left: key_code = WXK_LEFT; break;
|
||||
case GDK_Up: key_code = WXK_UP; break;
|
||||
case GDK_Right: key_code = WXK_RIGHT; break;
|
||||
case GDK_Down: key_code = WXK_DOWN; break;
|
||||
case GDK_Prior: key_code = WXK_PRIOR; break;
|
||||
// case GDK_Page_Up: key_code = WXK_PAGEUP; break;
|
||||
case GDK_Next: key_code = WXK_NEXT; break;
|
||||
// case GDK_Page_Down: key_code = WXK_PAGEDOWN; break;
|
||||
case GDK_End: key_code = WXK_END; break;
|
||||
case GDK_Begin: key_code = WXK_HOME; break;
|
||||
case GDK_Select: key_code = WXK_SELECT; break;
|
||||
case GDK_Print: key_code = WXK_PRINT; break;
|
||||
case GDK_Execute: key_code = WXK_EXECUTE; break;
|
||||
case GDK_Insert: key_code = WXK_INSERT; break;
|
||||
case GDK_Num_Lock: key_code = WXK_NUMLOCK; break;
|
||||
case GDK_KP_Tab: key_code = WXK_TAB; break;
|
||||
case GDK_KP_Enter: key_code = WXK_RETURN; break;
|
||||
case GDK_KP_Home: key_code = WXK_HOME; break;
|
||||
case GDK_KP_Left: key_code = WXK_LEFT; break;
|
||||
case GDK_KP_Up: key_code = WXK_UP; break;
|
||||
case GDK_KP_Right: key_code = WXK_RIGHT; break;
|
||||
case GDK_KP_Down: key_code = WXK_DOWN; break;
|
||||
case GDK_KP_Prior: key_code = WXK_PRIOR; break;
|
||||
// case GDK_KP_Page_Up: key_code = WXK_PAGEUP; break;
|
||||
case GDK_KP_Next: key_code = WXK_NEXT; break;
|
||||
// case GDK_KP_Page_Down: key_code = WXK_PAGEDOWN; break;
|
||||
case GDK_KP_End: key_code = WXK_END; break;
|
||||
case GDK_KP_Begin: key_code = WXK_HOME; break;
|
||||
case GDK_KP_Insert: key_code = WXK_INSERT; break;
|
||||
case GDK_KP_Delete: key_code = WXK_DELETE; break;
|
||||
case GDK_KP_Multiply: key_code = WXK_MULTIPLY; break;
|
||||
case GDK_KP_Add: key_code = WXK_ADD; break;
|
||||
case GDK_KP_Separator: key_code = WXK_SEPARATOR; break;
|
||||
case GDK_KP_Subtract: key_code = WXK_SUBTRACT; break;
|
||||
case GDK_KP_Decimal: key_code = WXK_DECIMAL; break;
|
||||
case GDK_KP_Divide: key_code = WXK_DIVIDE; break;
|
||||
case GDK_KP_0: key_code = WXK_NUMPAD0; break;
|
||||
case GDK_KP_1: key_code = WXK_NUMPAD1; break;
|
||||
case GDK_KP_2: key_code = WXK_NUMPAD2; break;
|
||||
case GDK_KP_3: key_code = WXK_NUMPAD3; break;
|
||||
case GDK_KP_4: key_code = WXK_NUMPAD4; break;
|
||||
case GDK_KP_5: key_code = WXK_NUMPAD5; break;
|
||||
case GDK_KP_6: key_code = WXK_NUMPAD6; break;
|
||||
case GDK_KP_7: key_code = WXK_NUMPAD7; break;
|
||||
case GDK_KP_8: key_code = WXK_NUMPAD7; break;
|
||||
case GDK_KP_9: key_code = WXK_NUMPAD9; break;
|
||||
case GDK_F1: key_code = WXK_F1; break;
|
||||
case GDK_F2: key_code = WXK_F2; break;
|
||||
case GDK_F3: key_code = WXK_F3; break;
|
||||
case GDK_F4: key_code = WXK_F4; break;
|
||||
case GDK_F5: key_code = WXK_F5; break;
|
||||
case GDK_F6: key_code = WXK_F6; break;
|
||||
case GDK_F7: key_code = WXK_F7; break;
|
||||
case GDK_F8: key_code = WXK_F8; break;
|
||||
case GDK_F9: key_code = WXK_F9; break;
|
||||
case GDK_F10: key_code = WXK_F10; break;
|
||||
case GDK_F11: key_code = WXK_F11; break;
|
||||
case GDK_F12: key_code = WXK_F12; break;
|
||||
default:
|
||||
{
|
||||
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
|
||||
key_code = gdk_event->keyval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!key_code) return FALSE;
|
||||
if (!key_code) return FALSE;
|
||||
|
||||
wxKeyEvent event( wxEVT_CHAR );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_keyCode = key_code;
|
||||
event.m_x = 0;
|
||||
event.m_y = 0;
|
||||
event.SetEventObject( win );
|
||||
wxKeyEvent event( wxEVT_CHAR );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_keyCode = key_code;
|
||||
event.m_x = 0;
|
||||
event.m_y = 0;
|
||||
event.SetEventObject( win );
|
||||
|
||||
bool ret = win->GetEventHandler()->ProcessEvent( event );
|
||||
bool ret = win->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
wxWindow *ancestor = win;
|
||||
while (ancestor)
|
||||
if (!ret)
|
||||
{
|
||||
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
|
||||
if (command != -1)
|
||||
{
|
||||
wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
|
||||
ret = ancestor->GetEventHandler()->ProcessEvent( command_event );
|
||||
break;
|
||||
}
|
||||
ancestor = ancestor->GetParent();
|
||||
wxWindow *ancestor = win;
|
||||
while (ancestor)
|
||||
{
|
||||
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
|
||||
if (command != -1)
|
||||
{
|
||||
wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
|
||||
ret = ancestor->GetEventHandler()->ProcessEvent( command_event );
|
||||
break;
|
||||
}
|
||||
ancestor = ancestor->GetParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret)
|
||||
{
|
||||
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -305,108 +305,108 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
||||
|
||||
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
|
||||
{
|
||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
if (win->m_wxwindow)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
|
||||
if (win->m_wxwindow)
|
||||
{
|
||||
gtk_widget_grab_focus (win->m_wxwindow);
|
||||
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
|
||||
{
|
||||
gtk_widget_grab_focus (win->m_wxwindow);
|
||||
|
||||
/*
|
||||
printf( "GrabFocus from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( "GrabFocus from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
printf( "OnButtonPress from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
wxEventType event_type = wxEVT_LEFT_DOWN;
|
||||
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
printf( "OnButtonPress from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
wxEventType event_type = wxEVT_LEFT_DOWN;
|
||||
|
||||
if (gdk_event->button == 1)
|
||||
{
|
||||
switch (gdk_event->type)
|
||||
if (gdk_event->button == 1)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_LEFT_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_LEFT_DCLICK; break;
|
||||
default: break;
|
||||
switch (gdk_event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_LEFT_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_LEFT_DCLICK; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gdk_event->button == 2)
|
||||
{
|
||||
switch (gdk_event->type)
|
||||
else if (gdk_event->button == 2)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_MIDDLE_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_MIDDLE_DCLICK; break;
|
||||
default: break;
|
||||
switch (gdk_event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_MIDDLE_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_MIDDLE_DCLICK; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gdk_event->button == 3)
|
||||
{
|
||||
switch (gdk_event->type)
|
||||
else if (gdk_event->button == 3)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_RIGHT_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_RIGHT_DCLICK; break;
|
||||
default: break;
|
||||
switch (gdk_event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_RIGHT_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_RIGHT_DCLICK; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxMouseEvent event( event_type );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
|
||||
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
|
||||
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
|
||||
wxMouseEvent event( event_type );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
|
||||
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
|
||||
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
|
||||
|
||||
event.m_x = (long)gdk_event->x;
|
||||
event.m_y = (long)gdk_event->y;
|
||||
event.m_x = (long)gdk_event->x;
|
||||
event.m_y = (long)gdk_event->y;
|
||||
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
while (node)
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
if ((child->m_x <= event.m_x) &&
|
||||
(child->m_y <= event.m_y) &&
|
||||
(child->m_x+child->m_width >= event.m_x) &&
|
||||
(child->m_y+child->m_height >= event.m_y))
|
||||
{
|
||||
win = child;
|
||||
event.m_x -= child->m_x;
|
||||
event.m_y -= child->m_y;
|
||||
break;
|
||||
}
|
||||
node = node->Next();
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
if ((child->m_x <= event.m_x) &&
|
||||
(child->m_y <= event.m_y) &&
|
||||
(child->m_x+child->m_width >= event.m_x) &&
|
||||
(child->m_y+child->m_height >= event.m_y))
|
||||
{
|
||||
win = child;
|
||||
event.m_x -= child->m_x;
|
||||
event.m_y -= child->m_y;
|
||||
break;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.SetEventObject( win );
|
||||
event.SetEventObject( win );
|
||||
|
||||
gs_timeLastClick = gdk_event->time;
|
||||
gs_timeLastClick = gdk_event->time;
|
||||
|
||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
|
||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -415,68 +415,68 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
||||
|
||||
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
|
||||
{
|
||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
printf( "OnButtonRelease from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
printf( "OnButtonRelease from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
wxEventType event_type = wxEVT_NULL;
|
||||
wxEventType event_type = wxEVT_NULL;
|
||||
|
||||
switch (gdk_event->button)
|
||||
{
|
||||
case 1: event_type = wxEVT_LEFT_UP; break;
|
||||
case 2: event_type = wxEVT_MIDDLE_UP; break;
|
||||
case 3: event_type = wxEVT_RIGHT_UP; break;
|
||||
}
|
||||
|
||||
wxMouseEvent event( event_type );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
|
||||
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
|
||||
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
|
||||
event.m_x = (long)gdk_event->x;
|
||||
event.m_y = (long)gdk_event->y;
|
||||
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
while (node)
|
||||
switch (gdk_event->button)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
if ((child->m_x <= event.m_x) &&
|
||||
(child->m_y <= event.m_y) &&
|
||||
(child->m_x+child->m_width >= event.m_x) &&
|
||||
(child->m_y+child->m_height >= event.m_y))
|
||||
{
|
||||
win = child;
|
||||
event.m_x -= child->m_x;
|
||||
event.m_y -= child->m_y;
|
||||
break;
|
||||
}
|
||||
node = node->Next();
|
||||
case 1: event_type = wxEVT_LEFT_UP; break;
|
||||
case 2: event_type = wxEVT_MIDDLE_UP; break;
|
||||
case 3: event_type = wxEVT_RIGHT_UP; break;
|
||||
}
|
||||
}
|
||||
|
||||
event.SetEventObject( win );
|
||||
wxMouseEvent event( event_type );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
|
||||
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
|
||||
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
|
||||
event.m_x = (long)gdk_event->x;
|
||||
event.m_y = (long)gdk_event->y;
|
||||
|
||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_event" );
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
return TRUE;
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
if ((child->m_x <= event.m_x) &&
|
||||
(child->m_y <= event.m_y) &&
|
||||
(child->m_x+child->m_width >= event.m_x) &&
|
||||
(child->m_y+child->m_height >= event.m_y))
|
||||
{
|
||||
win = child;
|
||||
event.m_x -= child->m_x;
|
||||
event.m_y -= child->m_y;
|
||||
break;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
event.SetEventObject( win );
|
||||
|
||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_event" );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -872,14 +872,14 @@ static void gtk_window_drop_callback( GtkWidget *widget, GdkEventDropDataAvailab
|
||||
|
||||
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
|
||||
{
|
||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
||||
GTK_WIDGET(child->m_widget),
|
||||
child->m_x,
|
||||
child->m_y );
|
||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
||||
GTK_WIDGET(child->m_widget),
|
||||
child->m_x,
|
||||
child->m_y );
|
||||
|
||||
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
|
||||
child->m_width,
|
||||
child->m_height );
|
||||
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
|
||||
child->m_width,
|
||||
child->m_height );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -901,6 +901,7 @@ wxWindow::wxWindow()
|
||||
m_wxwindow = (GtkWidget *) NULL;
|
||||
m_parent = (wxWindow *) NULL;
|
||||
m_children.DeleteContents( FALSE );
|
||||
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
m_width = 0;
|
||||
@ -909,35 +910,48 @@ wxWindow::wxWindow()
|
||||
m_minHeight = -1;
|
||||
m_maxWidth = -1;
|
||||
m_maxHeight = -1;
|
||||
|
||||
m_retCode = 0;
|
||||
|
||||
m_eventHandler = this;
|
||||
m_windowValidator = (wxValidator *) NULL;
|
||||
|
||||
m_windowId = -1;
|
||||
|
||||
m_cursor = (wxCursor *) NULL;
|
||||
m_font = *wxSWISS_FONT;
|
||||
m_windowStyle = 0;
|
||||
m_windowName = "noname";
|
||||
|
||||
m_constraints = (wxLayoutConstraints *) NULL;
|
||||
m_constraintsInvolvedIn = (wxList *) NULL;
|
||||
m_windowSizer = (wxSizer *) NULL;
|
||||
m_sizerParent = (wxWindow *) NULL;
|
||||
m_autoLayout = FALSE;
|
||||
|
||||
m_sizeSet = FALSE;
|
||||
m_hasVMT = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
m_hasScrolling = FALSE;
|
||||
m_isScrolling = FALSE;
|
||||
m_hAdjust = (GtkAdjustment *) NULL;
|
||||
m_vAdjust = (GtkAdjustment *) NULL;
|
||||
m_hAdjust = (GtkAdjustment*) NULL;
|
||||
m_vAdjust = (GtkAdjustment*) NULL;
|
||||
m_oldHorizontalPos = 0.0;
|
||||
m_oldVerticalPos = 0.0;
|
||||
|
||||
m_isShown = FALSE;
|
||||
m_isEnabled = TRUE;
|
||||
m_dropTarget = (wxDropTarget *) NULL;
|
||||
|
||||
m_dropTarget = (wxDropTarget*) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
|
||||
m_insertCallback = wxInsertChildInWindow;
|
||||
|
||||
m_clientObject = (wxClientData*) NULL;
|
||||
m_clientData = NULL;
|
||||
}
|
||||
|
||||
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
|
||||
@ -1104,6 +1118,8 @@ wxWindow::~wxWindow()
|
||||
wxTopLevelWindows.DeleteObject(this);
|
||||
|
||||
if (m_windowValidator) delete m_windowValidator;
|
||||
|
||||
if (m_clientObject) delete m_clientObject;
|
||||
}
|
||||
|
||||
void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
@ -1113,8 +1129,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
if (m_needParent && (parent == NULL))
|
||||
wxFatalError( "Need complete parent.", name );
|
||||
|
||||
m_widget = (GtkWidget *) NULL;
|
||||
m_wxwindow = (GtkWidget *) NULL;
|
||||
m_widget = (GtkWidget*) NULL;
|
||||
m_wxwindow = (GtkWidget*) NULL;
|
||||
m_hasVMT = FALSE;
|
||||
m_parent = parent;
|
||||
m_children.DeleteContents( FALSE );
|
||||
@ -1145,34 +1161,46 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
m_minHeight = -1;
|
||||
m_maxWidth = -1;
|
||||
m_maxHeight = -1;
|
||||
|
||||
m_retCode = 0;
|
||||
|
||||
m_eventHandler = this;
|
||||
|
||||
m_windowId = id;
|
||||
|
||||
m_sizeSet = FALSE;
|
||||
|
||||
m_cursor = new wxCursor( wxCURSOR_ARROW );
|
||||
m_font = *wxSWISS_FONT;
|
||||
// m_backgroundColour = wxWHITE;
|
||||
// m_foregroundColour = wxBLACK;
|
||||
m_windowStyle = style;
|
||||
m_windowName = name;
|
||||
|
||||
m_constraints = (wxLayoutConstraints *) NULL;
|
||||
m_constraintsInvolvedIn = (wxList *) NULL;
|
||||
m_windowSizer = (wxSizer *) NULL;
|
||||
m_sizerParent = (wxWindow *) NULL;
|
||||
m_autoLayout = FALSE;
|
||||
|
||||
m_hasScrolling = FALSE;
|
||||
m_isScrolling = FALSE;
|
||||
m_hAdjust = (GtkAdjustment *) NULL;
|
||||
m_vAdjust = (GtkAdjustment *) NULL;
|
||||
m_oldHorizontalPos = 0.0;
|
||||
m_oldVerticalPos = 0.0;
|
||||
|
||||
m_isShown = FALSE;
|
||||
m_isEnabled = TRUE;
|
||||
|
||||
m_dropTarget = (wxDropTarget *) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_windowValidator = (wxValidator *) NULL;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
|
||||
m_clientObject = (wxClientData*)NULL;
|
||||
m_clientData = NULL;
|
||||
}
|
||||
|
||||
void wxWindow::PostCreation()
|
||||
@ -1847,32 +1875,23 @@ void wxWindow::SetValidator( const wxValidator& validator )
|
||||
|
||||
void wxWindow::SetClientObject( wxClientData *data )
|
||||
{
|
||||
if (m_clientData) delete m_clientData;
|
||||
m_clientData = data;
|
||||
if (m_clientObject) delete m_clientObject;
|
||||
m_clientObject = data;
|
||||
}
|
||||
|
||||
wxClientData *wxWindow::GetClientObject()
|
||||
{
|
||||
return m_clientData;
|
||||
return m_clientObject;
|
||||
}
|
||||
|
||||
void wxWindow::SetClientData( void *data )
|
||||
{
|
||||
if (m_clientData) delete m_clientData;
|
||||
|
||||
if (data)
|
||||
m_clientData = new wxVoidClientData( data );
|
||||
else
|
||||
m_clientData = (wxClientData*) NULL;
|
||||
m_clientData = data;
|
||||
}
|
||||
|
||||
void *wxWindow::GetClientData()
|
||||
{
|
||||
if (!m_clientData) return NULL;
|
||||
|
||||
wxVoidClientData *vd = (wxVoidClientData*) m_clientData;
|
||||
|
||||
return vd->GetData();
|
||||
return m_clientData;
|
||||
}
|
||||
|
||||
bool wxWindow::IsBeingDeleted()
|
||||
|
@ -55,7 +55,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
||||
m_needParent = TRUE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
|
||||
SetValidator( validator );
|
||||
|
||||
m_widget = gtk_option_menu_new();
|
||||
@ -70,7 +70,8 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
|
||||
gtk_menu_append( GTK_MENU(menu), item );
|
||||
|
||||
@ -100,14 +101,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
wxChoice::~wxChoice()
|
||||
{
|
||||
wxNode *node = m_clientDataList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientDataList.Clear();
|
||||
Clear();
|
||||
}
|
||||
|
||||
void wxChoice::AppendCommon( const wxString &item )
|
||||
@ -132,24 +126,24 @@ void wxChoice::AppendCommon( const wxString &item )
|
||||
|
||||
void wxChoice::Append( const wxString &item )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxChoice::Append( const wxString &item, void *clientData )
|
||||
{
|
||||
if (clientData)
|
||||
m_clientDataList.Append( (wxObject*) new wxVoidClientData( clientData ) );
|
||||
else
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxChoice::Append( const wxString &item, wxClientData *clientData )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*) clientData );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
@ -161,13 +155,7 @@ void wxChoice::SetClientData( int n, void* clientData )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
if (clientData)
|
||||
node->SetData( (wxObject*) new wxVoidClientData(clientData) );
|
||||
else
|
||||
node->SetData( (wxObject*) NULL );
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxChoice::GetClientData( int n )
|
||||
@ -177,36 +165,31 @@ void* wxChoice::GetClientData( int n )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return NULL;
|
||||
|
||||
wxVoidClientData *cd = (wxVoidClientData*) node->Data();
|
||||
if (cd)
|
||||
return cd->GetData();
|
||||
else
|
||||
return (void*) NULL;
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxChoice::SetClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
wxClientData* wxChoice::GetClientObject( int n )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return (wxClientData*) NULL;
|
||||
|
||||
return (wxClientData*) node->Data();
|
||||
}
|
||||
|
||||
|
||||
void wxChoice::Clear()
|
||||
{
|
||||
@ -216,13 +199,15 @@ void wxChoice::Clear()
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||
|
||||
wxNode *node = m_clientDataList.First();
|
||||
wxNode *node = m_clientObjectList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientObjectList.Clear();
|
||||
|
||||
m_clientDataList.Clear();
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i] );
|
||||
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientObjectList.Append( (wxObject*)NULL );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
@ -148,24 +149,24 @@ void wxComboBox::AppendCommon( const wxString &item )
|
||||
|
||||
void wxComboBox::Append( const wxString &item )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxComboBox::Append( const wxString &item, void *clientData )
|
||||
{
|
||||
if (clientData)
|
||||
m_clientDataList.Append( (wxObject*) new wxVoidClientData( clientData ) );
|
||||
else
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*)NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxComboBox::Append( const wxString &item, wxClientData *clientData )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) clientData );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
@ -177,13 +178,7 @@ void wxComboBox::SetClientData( int n, void* clientData )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
if (clientData)
|
||||
node->SetData( (wxObject*) new wxVoidClientData(clientData) );
|
||||
else
|
||||
node->SetData( (wxObject*) NULL );
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxComboBox::GetClientData( int n )
|
||||
@ -193,23 +188,19 @@ void* wxComboBox::GetClientData( int n )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return NULL;
|
||||
|
||||
wxVoidClientData *cd = (wxVoidClientData*) node->Data();
|
||||
if (cd)
|
||||
return cd->GetData();
|
||||
else
|
||||
return (void*) NULL;
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxComboBox::SetClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
@ -230,13 +221,15 @@ void wxComboBox::Clear()
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
|
||||
|
||||
wxNode *node = m_clientDataList.First();
|
||||
wxNode *node = m_clientObjectList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientObjectList.Clear();
|
||||
|
||||
m_clientDataList.Clear();
|
||||
}
|
||||
|
||||
@ -258,15 +251,17 @@ void wxComboBox::Delete( int n )
|
||||
gtk_list_remove_items( listbox, list );
|
||||
g_list_free( list );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wrong index" );
|
||||
}
|
||||
else
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
m_clientObjectList.DeleteNode( node );
|
||||
}
|
||||
|
||||
node = m_clientDataList.Nth( n );
|
||||
if (node)
|
||||
{
|
||||
m_clientDataList.DeleteNode( node );
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +101,9 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
GtkWidget *list_item;
|
||||
list_item = gtk_list_item_new_with_label( choices[i] );
|
||||
|
||||
@ -115,8 +118,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
ConnectWidget( list_item );
|
||||
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
}
|
||||
|
||||
@ -138,14 +139,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
wxListBox::~wxListBox()
|
||||
{
|
||||
wxNode *node = m_clientDataList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientDataList.Clear();
|
||||
Clear();
|
||||
}
|
||||
|
||||
void wxListBox::AppendCommon( const wxString &item )
|
||||
@ -174,24 +168,24 @@ void wxListBox::AppendCommon( const wxString &item )
|
||||
|
||||
void wxListBox::Append( const wxString &item )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxListBox::Append( const wxString &item, void *clientData )
|
||||
{
|
||||
if (clientData)
|
||||
m_clientDataList.Append( (wxObject*) new wxVoidClientData( clientData ) );
|
||||
else
|
||||
m_clientDataList.Append( (wxObject*)NULL );
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
|
||||
void wxListBox::Append( const wxString &item, wxClientData *clientData )
|
||||
{
|
||||
m_clientDataList.Append( (wxObject*) clientData );
|
||||
m_clientObjectList.Append( (wxObject*) clientData );
|
||||
m_clientDataList.Append( (wxObject*) NULL );
|
||||
|
||||
AppendCommon( item );
|
||||
}
|
||||
@ -203,13 +197,7 @@ void wxListBox::SetClientData( int n, void* clientData )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
if (cd) delete cd;
|
||||
|
||||
if (clientData)
|
||||
node->SetData( (wxObject*) new wxVoidClientData(clientData) );
|
||||
else
|
||||
node->SetData( (wxObject*) NULL );
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxListBox::GetClientData( int n )
|
||||
@ -219,18 +207,14 @@ void* wxListBox::GetClientData( int n )
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node) return NULL;
|
||||
|
||||
wxVoidClientData *cd = (wxVoidClientData*) node->Data();
|
||||
if (cd)
|
||||
return cd->GetData();
|
||||
else
|
||||
return (void*) NULL;
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxListBox::SetClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return;
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
@ -243,7 +227,7 @@ wxClientData* wxListBox::GetClientObject( int n )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (!node) return (wxClientData*) NULL;
|
||||
|
||||
return (wxClientData*) node->Data();
|
||||
@ -255,13 +239,15 @@ void wxListBox::Clear()
|
||||
|
||||
gtk_list_clear_items( m_list, 0, Number() );
|
||||
|
||||
wxNode *node = m_clientDataList.First();
|
||||
wxNode *node = m_clientObjectList.First();
|
||||
while (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
node = node->Next();
|
||||
}
|
||||
m_clientObjectList.Clear();
|
||||
|
||||
m_clientDataList.Clear();
|
||||
}
|
||||
|
||||
@ -281,15 +267,17 @@ void wxListBox::Delete( int n )
|
||||
gtk_list_remove_items( m_list, list );
|
||||
g_list_free( list );
|
||||
|
||||
wxNode *node = m_clientDataList.Nth( n );
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wrong index" );
|
||||
}
|
||||
else
|
||||
wxNode *node = m_clientObjectList.Nth( n );
|
||||
if (node)
|
||||
{
|
||||
wxClientData *cd = (wxClientData*)node->Data();
|
||||
if (cd) delete cd;
|
||||
m_clientObjectList.DeleteNode( node );
|
||||
}
|
||||
|
||||
node = m_clientDataList.Nth( n );
|
||||
if (node)
|
||||
{
|
||||
m_clientDataList.DeleteNode( node );
|
||||
}
|
||||
}
|
||||
|
@ -124,28 +124,28 @@ static guint32 gs_timeLastClick = 0;
|
||||
|
||||
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
if (!win->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
win->m_updateRegion.Union( gdk_event->area.x,
|
||||
gdk_event->area.y,
|
||||
gdk_event->area.width,
|
||||
gdk_event->area.height );
|
||||
win->m_updateRegion.Union( gdk_event->area.x,
|
||||
gdk_event->area.y,
|
||||
gdk_event->area.width,
|
||||
gdk_event->area.height );
|
||||
|
||||
if (gdk_event->count > 0) return;
|
||||
if (gdk_event->count > 0) return;
|
||||
|
||||
/*
|
||||
printf( "OnExpose from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
printf( "OnExpose from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
wxPaintEvent event( win->GetId() );
|
||||
event.SetEventObject( win );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
wxPaintEvent event( win->GetId() );
|
||||
event.SetEventObject( win );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
win->m_updateRegion.Clear();
|
||||
win->m_updateRegion.Clear();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -154,16 +154,16 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
||||
|
||||
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
if (!win->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||
|
||||
wxPaintEvent event( win->GetId() );
|
||||
event.SetEventObject( win );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
wxPaintEvent event( win->GetId() );
|
||||
event.SetEventObject( win );
|
||||
win->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
win->m_updateRegion.Clear();
|
||||
win->m_updateRegion.Clear();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -172,131 +172,131 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle
|
||||
|
||||
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
|
||||
{
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
|
||||
/*
|
||||
printf( "OnKeyPress from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
printf( "OnKeyPress from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
long key_code = 0;
|
||||
switch (gdk_event->keyval)
|
||||
{
|
||||
case GDK_BackSpace: key_code = WXK_BACK; break;
|
||||
case GDK_Tab: key_code = WXK_TAB; break;
|
||||
case GDK_Linefeed: key_code = WXK_RETURN; break;
|
||||
case GDK_Clear: key_code = WXK_CLEAR; break;
|
||||
case GDK_Return: key_code = WXK_RETURN; break;
|
||||
case GDK_Pause: key_code = WXK_PAUSE; break;
|
||||
case GDK_Scroll_Lock: key_code = WXK_SCROLL; break;
|
||||
case GDK_Escape: key_code = WXK_ESCAPE; break;
|
||||
case GDK_Delete: key_code = WXK_DELETE; break;
|
||||
case GDK_Home: key_code = WXK_HOME; break;
|
||||
case GDK_Left: key_code = WXK_LEFT; break;
|
||||
case GDK_Up: key_code = WXK_UP; break;
|
||||
case GDK_Right: key_code = WXK_RIGHT; break;
|
||||
case GDK_Down: key_code = WXK_DOWN; break;
|
||||
case GDK_Prior: key_code = WXK_PRIOR; break;
|
||||
// case GDK_Page_Up: key_code = WXK_PAGEUP; break;
|
||||
case GDK_Next: key_code = WXK_NEXT; break;
|
||||
// case GDK_Page_Down: key_code = WXK_PAGEDOWN; break;
|
||||
case GDK_End: key_code = WXK_END; break;
|
||||
case GDK_Begin: key_code = WXK_HOME; break;
|
||||
case GDK_Select: key_code = WXK_SELECT; break;
|
||||
case GDK_Print: key_code = WXK_PRINT; break;
|
||||
case GDK_Execute: key_code = WXK_EXECUTE; break;
|
||||
case GDK_Insert: key_code = WXK_INSERT; break;
|
||||
case GDK_Num_Lock: key_code = WXK_NUMLOCK; break;
|
||||
case GDK_KP_Tab: key_code = WXK_TAB; break;
|
||||
case GDK_KP_Enter: key_code = WXK_RETURN; break;
|
||||
case GDK_KP_Home: key_code = WXK_HOME; break;
|
||||
case GDK_KP_Left: key_code = WXK_LEFT; break;
|
||||
case GDK_KP_Up: key_code = WXK_UP; break;
|
||||
case GDK_KP_Right: key_code = WXK_RIGHT; break;
|
||||
case GDK_KP_Down: key_code = WXK_DOWN; break;
|
||||
case GDK_KP_Prior: key_code = WXK_PRIOR; break;
|
||||
// case GDK_KP_Page_Up: key_code = WXK_PAGEUP; break;
|
||||
case GDK_KP_Next: key_code = WXK_NEXT; break;
|
||||
// case GDK_KP_Page_Down: key_code = WXK_PAGEDOWN; break;
|
||||
case GDK_KP_End: key_code = WXK_END; break;
|
||||
case GDK_KP_Begin: key_code = WXK_HOME; break;
|
||||
case GDK_KP_Insert: key_code = WXK_INSERT; break;
|
||||
case GDK_KP_Delete: key_code = WXK_DELETE; break;
|
||||
case GDK_KP_Multiply: key_code = WXK_MULTIPLY; break;
|
||||
case GDK_KP_Add: key_code = WXK_ADD; break;
|
||||
case GDK_KP_Separator: key_code = WXK_SEPARATOR; break;
|
||||
case GDK_KP_Subtract: key_code = WXK_SUBTRACT; break;
|
||||
case GDK_KP_Decimal: key_code = WXK_DECIMAL; break;
|
||||
case GDK_KP_Divide: key_code = WXK_DIVIDE; break;
|
||||
case GDK_KP_0: key_code = WXK_NUMPAD0; break;
|
||||
case GDK_KP_1: key_code = WXK_NUMPAD1; break;
|
||||
case GDK_KP_2: key_code = WXK_NUMPAD2; break;
|
||||
case GDK_KP_3: key_code = WXK_NUMPAD3; break;
|
||||
case GDK_KP_4: key_code = WXK_NUMPAD4; break;
|
||||
case GDK_KP_5: key_code = WXK_NUMPAD5; break;
|
||||
case GDK_KP_6: key_code = WXK_NUMPAD6; break;
|
||||
case GDK_KP_7: key_code = WXK_NUMPAD7; break;
|
||||
case GDK_KP_8: key_code = WXK_NUMPAD7; break;
|
||||
case GDK_KP_9: key_code = WXK_NUMPAD9; break;
|
||||
case GDK_F1: key_code = WXK_F1; break;
|
||||
case GDK_F2: key_code = WXK_F2; break;
|
||||
case GDK_F3: key_code = WXK_F3; break;
|
||||
case GDK_F4: key_code = WXK_F4; break;
|
||||
case GDK_F5: key_code = WXK_F5; break;
|
||||
case GDK_F6: key_code = WXK_F6; break;
|
||||
case GDK_F7: key_code = WXK_F7; break;
|
||||
case GDK_F8: key_code = WXK_F8; break;
|
||||
case GDK_F9: key_code = WXK_F9; break;
|
||||
case GDK_F10: key_code = WXK_F10; break;
|
||||
case GDK_F11: key_code = WXK_F11; break;
|
||||
case GDK_F12: key_code = WXK_F12; break;
|
||||
default:
|
||||
long key_code = 0;
|
||||
switch (gdk_event->keyval)
|
||||
{
|
||||
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
|
||||
key_code = gdk_event->keyval;
|
||||
case GDK_BackSpace: key_code = WXK_BACK; break;
|
||||
case GDK_Tab: key_code = WXK_TAB; break;
|
||||
case GDK_Linefeed: key_code = WXK_RETURN; break;
|
||||
case GDK_Clear: key_code = WXK_CLEAR; break;
|
||||
case GDK_Return: key_code = WXK_RETURN; break;
|
||||
case GDK_Pause: key_code = WXK_PAUSE; break;
|
||||
case GDK_Scroll_Lock: key_code = WXK_SCROLL; break;
|
||||
case GDK_Escape: key_code = WXK_ESCAPE; break;
|
||||
case GDK_Delete: key_code = WXK_DELETE; break;
|
||||
case GDK_Home: key_code = WXK_HOME; break;
|
||||
case GDK_Left: key_code = WXK_LEFT; break;
|
||||
case GDK_Up: key_code = WXK_UP; break;
|
||||
case GDK_Right: key_code = WXK_RIGHT; break;
|
||||
case GDK_Down: key_code = WXK_DOWN; break;
|
||||
case GDK_Prior: key_code = WXK_PRIOR; break;
|
||||
// case GDK_Page_Up: key_code = WXK_PAGEUP; break;
|
||||
case GDK_Next: key_code = WXK_NEXT; break;
|
||||
// case GDK_Page_Down: key_code = WXK_PAGEDOWN; break;
|
||||
case GDK_End: key_code = WXK_END; break;
|
||||
case GDK_Begin: key_code = WXK_HOME; break;
|
||||
case GDK_Select: key_code = WXK_SELECT; break;
|
||||
case GDK_Print: key_code = WXK_PRINT; break;
|
||||
case GDK_Execute: key_code = WXK_EXECUTE; break;
|
||||
case GDK_Insert: key_code = WXK_INSERT; break;
|
||||
case GDK_Num_Lock: key_code = WXK_NUMLOCK; break;
|
||||
case GDK_KP_Tab: key_code = WXK_TAB; break;
|
||||
case GDK_KP_Enter: key_code = WXK_RETURN; break;
|
||||
case GDK_KP_Home: key_code = WXK_HOME; break;
|
||||
case GDK_KP_Left: key_code = WXK_LEFT; break;
|
||||
case GDK_KP_Up: key_code = WXK_UP; break;
|
||||
case GDK_KP_Right: key_code = WXK_RIGHT; break;
|
||||
case GDK_KP_Down: key_code = WXK_DOWN; break;
|
||||
case GDK_KP_Prior: key_code = WXK_PRIOR; break;
|
||||
// case GDK_KP_Page_Up: key_code = WXK_PAGEUP; break;
|
||||
case GDK_KP_Next: key_code = WXK_NEXT; break;
|
||||
// case GDK_KP_Page_Down: key_code = WXK_PAGEDOWN; break;
|
||||
case GDK_KP_End: key_code = WXK_END; break;
|
||||
case GDK_KP_Begin: key_code = WXK_HOME; break;
|
||||
case GDK_KP_Insert: key_code = WXK_INSERT; break;
|
||||
case GDK_KP_Delete: key_code = WXK_DELETE; break;
|
||||
case GDK_KP_Multiply: key_code = WXK_MULTIPLY; break;
|
||||
case GDK_KP_Add: key_code = WXK_ADD; break;
|
||||
case GDK_KP_Separator: key_code = WXK_SEPARATOR; break;
|
||||
case GDK_KP_Subtract: key_code = WXK_SUBTRACT; break;
|
||||
case GDK_KP_Decimal: key_code = WXK_DECIMAL; break;
|
||||
case GDK_KP_Divide: key_code = WXK_DIVIDE; break;
|
||||
case GDK_KP_0: key_code = WXK_NUMPAD0; break;
|
||||
case GDK_KP_1: key_code = WXK_NUMPAD1; break;
|
||||
case GDK_KP_2: key_code = WXK_NUMPAD2; break;
|
||||
case GDK_KP_3: key_code = WXK_NUMPAD3; break;
|
||||
case GDK_KP_4: key_code = WXK_NUMPAD4; break;
|
||||
case GDK_KP_5: key_code = WXK_NUMPAD5; break;
|
||||
case GDK_KP_6: key_code = WXK_NUMPAD6; break;
|
||||
case GDK_KP_7: key_code = WXK_NUMPAD7; break;
|
||||
case GDK_KP_8: key_code = WXK_NUMPAD7; break;
|
||||
case GDK_KP_9: key_code = WXK_NUMPAD9; break;
|
||||
case GDK_F1: key_code = WXK_F1; break;
|
||||
case GDK_F2: key_code = WXK_F2; break;
|
||||
case GDK_F3: key_code = WXK_F3; break;
|
||||
case GDK_F4: key_code = WXK_F4; break;
|
||||
case GDK_F5: key_code = WXK_F5; break;
|
||||
case GDK_F6: key_code = WXK_F6; break;
|
||||
case GDK_F7: key_code = WXK_F7; break;
|
||||
case GDK_F8: key_code = WXK_F8; break;
|
||||
case GDK_F9: key_code = WXK_F9; break;
|
||||
case GDK_F10: key_code = WXK_F10; break;
|
||||
case GDK_F11: key_code = WXK_F11; break;
|
||||
case GDK_F12: key_code = WXK_F12; break;
|
||||
default:
|
||||
{
|
||||
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
|
||||
key_code = gdk_event->keyval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!key_code) return FALSE;
|
||||
if (!key_code) return FALSE;
|
||||
|
||||
wxKeyEvent event( wxEVT_CHAR );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_keyCode = key_code;
|
||||
event.m_x = 0;
|
||||
event.m_y = 0;
|
||||
event.SetEventObject( win );
|
||||
wxKeyEvent event( wxEVT_CHAR );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_keyCode = key_code;
|
||||
event.m_x = 0;
|
||||
event.m_y = 0;
|
||||
event.SetEventObject( win );
|
||||
|
||||
bool ret = win->GetEventHandler()->ProcessEvent( event );
|
||||
bool ret = win->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
wxWindow *ancestor = win;
|
||||
while (ancestor)
|
||||
if (!ret)
|
||||
{
|
||||
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
|
||||
if (command != -1)
|
||||
{
|
||||
wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
|
||||
ret = ancestor->GetEventHandler()->ProcessEvent( command_event );
|
||||
break;
|
||||
}
|
||||
ancestor = ancestor->GetParent();
|
||||
wxWindow *ancestor = win;
|
||||
while (ancestor)
|
||||
{
|
||||
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
|
||||
if (command != -1)
|
||||
{
|
||||
wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
|
||||
ret = ancestor->GetEventHandler()->ProcessEvent( command_event );
|
||||
break;
|
||||
}
|
||||
ancestor = ancestor->GetParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret)
|
||||
{
|
||||
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -305,108 +305,108 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
||||
|
||||
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
|
||||
{
|
||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
if (win->m_wxwindow)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
|
||||
if (win->m_wxwindow)
|
||||
{
|
||||
gtk_widget_grab_focus (win->m_wxwindow);
|
||||
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
|
||||
{
|
||||
gtk_widget_grab_focus (win->m_wxwindow);
|
||||
|
||||
/*
|
||||
printf( "GrabFocus from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( "GrabFocus from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
printf( "OnButtonPress from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
wxEventType event_type = wxEVT_LEFT_DOWN;
|
||||
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
printf( "OnButtonPress from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
wxEventType event_type = wxEVT_LEFT_DOWN;
|
||||
|
||||
if (gdk_event->button == 1)
|
||||
{
|
||||
switch (gdk_event->type)
|
||||
if (gdk_event->button == 1)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_LEFT_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_LEFT_DCLICK; break;
|
||||
default: break;
|
||||
switch (gdk_event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_LEFT_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_LEFT_DCLICK; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gdk_event->button == 2)
|
||||
{
|
||||
switch (gdk_event->type)
|
||||
else if (gdk_event->button == 2)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_MIDDLE_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_MIDDLE_DCLICK; break;
|
||||
default: break;
|
||||
switch (gdk_event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_MIDDLE_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_MIDDLE_DCLICK; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gdk_event->button == 3)
|
||||
{
|
||||
switch (gdk_event->type)
|
||||
else if (gdk_event->button == 3)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_RIGHT_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_RIGHT_DCLICK; break;
|
||||
default: break;
|
||||
switch (gdk_event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: event_type = wxEVT_RIGHT_DOWN; break;
|
||||
case GDK_2BUTTON_PRESS: event_type = wxEVT_RIGHT_DCLICK; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxMouseEvent event( event_type );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
|
||||
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
|
||||
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
|
||||
wxMouseEvent event( event_type );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
|
||||
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
|
||||
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
|
||||
|
||||
event.m_x = (long)gdk_event->x;
|
||||
event.m_y = (long)gdk_event->y;
|
||||
event.m_x = (long)gdk_event->x;
|
||||
event.m_y = (long)gdk_event->y;
|
||||
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
while (node)
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
if ((child->m_x <= event.m_x) &&
|
||||
(child->m_y <= event.m_y) &&
|
||||
(child->m_x+child->m_width >= event.m_x) &&
|
||||
(child->m_y+child->m_height >= event.m_y))
|
||||
{
|
||||
win = child;
|
||||
event.m_x -= child->m_x;
|
||||
event.m_y -= child->m_y;
|
||||
break;
|
||||
}
|
||||
node = node->Next();
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
if ((child->m_x <= event.m_x) &&
|
||||
(child->m_y <= event.m_y) &&
|
||||
(child->m_x+child->m_width >= event.m_x) &&
|
||||
(child->m_y+child->m_height >= event.m_y))
|
||||
{
|
||||
win = child;
|
||||
event.m_x -= child->m_x;
|
||||
event.m_y -= child->m_y;
|
||||
break;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.SetEventObject( win );
|
||||
event.SetEventObject( win );
|
||||
|
||||
gs_timeLastClick = gdk_event->time;
|
||||
gs_timeLastClick = gdk_event->time;
|
||||
|
||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
|
||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -415,68 +415,68 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
||||
|
||||
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
|
||||
{
|
||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
printf( "OnButtonRelease from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
printf( "OnButtonRelease from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
wxEventType event_type = wxEVT_NULL;
|
||||
wxEventType event_type = wxEVT_NULL;
|
||||
|
||||
switch (gdk_event->button)
|
||||
{
|
||||
case 1: event_type = wxEVT_LEFT_UP; break;
|
||||
case 2: event_type = wxEVT_MIDDLE_UP; break;
|
||||
case 3: event_type = wxEVT_RIGHT_UP; break;
|
||||
}
|
||||
|
||||
wxMouseEvent event( event_type );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
|
||||
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
|
||||
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
|
||||
event.m_x = (long)gdk_event->x;
|
||||
event.m_y = (long)gdk_event->y;
|
||||
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
while (node)
|
||||
switch (gdk_event->button)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
if ((child->m_x <= event.m_x) &&
|
||||
(child->m_y <= event.m_y) &&
|
||||
(child->m_x+child->m_width >= event.m_x) &&
|
||||
(child->m_y+child->m_height >= event.m_y))
|
||||
{
|
||||
win = child;
|
||||
event.m_x -= child->m_x;
|
||||
event.m_y -= child->m_y;
|
||||
break;
|
||||
}
|
||||
node = node->Next();
|
||||
case 1: event_type = wxEVT_LEFT_UP; break;
|
||||
case 2: event_type = wxEVT_MIDDLE_UP; break;
|
||||
case 3: event_type = wxEVT_RIGHT_UP; break;
|
||||
}
|
||||
}
|
||||
|
||||
event.SetEventObject( win );
|
||||
wxMouseEvent event( event_type );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
|
||||
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
|
||||
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
|
||||
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
|
||||
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
|
||||
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
|
||||
event.m_x = (long)gdk_event->x;
|
||||
event.m_y = (long)gdk_event->y;
|
||||
|
||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_event" );
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
return TRUE;
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
if ((child->m_x <= event.m_x) &&
|
||||
(child->m_y <= event.m_y) &&
|
||||
(child->m_x+child->m_width >= event.m_x) &&
|
||||
(child->m_y+child->m_height >= event.m_y))
|
||||
{
|
||||
win = child;
|
||||
event.m_x -= child->m_x;
|
||||
event.m_y -= child->m_y;
|
||||
break;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
event.SetEventObject( win );
|
||||
|
||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_event" );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -872,14 +872,14 @@ static void gtk_window_drop_callback( GtkWidget *widget, GdkEventDropDataAvailab
|
||||
|
||||
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
|
||||
{
|
||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
||||
GTK_WIDGET(child->m_widget),
|
||||
child->m_x,
|
||||
child->m_y );
|
||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
||||
GTK_WIDGET(child->m_widget),
|
||||
child->m_x,
|
||||
child->m_y );
|
||||
|
||||
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
|
||||
child->m_width,
|
||||
child->m_height );
|
||||
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
|
||||
child->m_width,
|
||||
child->m_height );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -901,6 +901,7 @@ wxWindow::wxWindow()
|
||||
m_wxwindow = (GtkWidget *) NULL;
|
||||
m_parent = (wxWindow *) NULL;
|
||||
m_children.DeleteContents( FALSE );
|
||||
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
m_width = 0;
|
||||
@ -909,35 +910,48 @@ wxWindow::wxWindow()
|
||||
m_minHeight = -1;
|
||||
m_maxWidth = -1;
|
||||
m_maxHeight = -1;
|
||||
|
||||
m_retCode = 0;
|
||||
|
||||
m_eventHandler = this;
|
||||
m_windowValidator = (wxValidator *) NULL;
|
||||
|
||||
m_windowId = -1;
|
||||
|
||||
m_cursor = (wxCursor *) NULL;
|
||||
m_font = *wxSWISS_FONT;
|
||||
m_windowStyle = 0;
|
||||
m_windowName = "noname";
|
||||
|
||||
m_constraints = (wxLayoutConstraints *) NULL;
|
||||
m_constraintsInvolvedIn = (wxList *) NULL;
|
||||
m_windowSizer = (wxSizer *) NULL;
|
||||
m_sizerParent = (wxWindow *) NULL;
|
||||
m_autoLayout = FALSE;
|
||||
|
||||
m_sizeSet = FALSE;
|
||||
m_hasVMT = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
m_hasScrolling = FALSE;
|
||||
m_isScrolling = FALSE;
|
||||
m_hAdjust = (GtkAdjustment *) NULL;
|
||||
m_vAdjust = (GtkAdjustment *) NULL;
|
||||
m_hAdjust = (GtkAdjustment*) NULL;
|
||||
m_vAdjust = (GtkAdjustment*) NULL;
|
||||
m_oldHorizontalPos = 0.0;
|
||||
m_oldVerticalPos = 0.0;
|
||||
|
||||
m_isShown = FALSE;
|
||||
m_isEnabled = TRUE;
|
||||
m_dropTarget = (wxDropTarget *) NULL;
|
||||
|
||||
m_dropTarget = (wxDropTarget*) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
|
||||
m_insertCallback = wxInsertChildInWindow;
|
||||
|
||||
m_clientObject = (wxClientData*) NULL;
|
||||
m_clientData = NULL;
|
||||
}
|
||||
|
||||
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
|
||||
@ -1104,6 +1118,8 @@ wxWindow::~wxWindow()
|
||||
wxTopLevelWindows.DeleteObject(this);
|
||||
|
||||
if (m_windowValidator) delete m_windowValidator;
|
||||
|
||||
if (m_clientObject) delete m_clientObject;
|
||||
}
|
||||
|
||||
void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
@ -1113,8 +1129,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
if (m_needParent && (parent == NULL))
|
||||
wxFatalError( "Need complete parent.", name );
|
||||
|
||||
m_widget = (GtkWidget *) NULL;
|
||||
m_wxwindow = (GtkWidget *) NULL;
|
||||
m_widget = (GtkWidget*) NULL;
|
||||
m_wxwindow = (GtkWidget*) NULL;
|
||||
m_hasVMT = FALSE;
|
||||
m_parent = parent;
|
||||
m_children.DeleteContents( FALSE );
|
||||
@ -1145,34 +1161,46 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
m_minHeight = -1;
|
||||
m_maxWidth = -1;
|
||||
m_maxHeight = -1;
|
||||
|
||||
m_retCode = 0;
|
||||
|
||||
m_eventHandler = this;
|
||||
|
||||
m_windowId = id;
|
||||
|
||||
m_sizeSet = FALSE;
|
||||
|
||||
m_cursor = new wxCursor( wxCURSOR_ARROW );
|
||||
m_font = *wxSWISS_FONT;
|
||||
// m_backgroundColour = wxWHITE;
|
||||
// m_foregroundColour = wxBLACK;
|
||||
m_windowStyle = style;
|
||||
m_windowName = name;
|
||||
|
||||
m_constraints = (wxLayoutConstraints *) NULL;
|
||||
m_constraintsInvolvedIn = (wxList *) NULL;
|
||||
m_windowSizer = (wxSizer *) NULL;
|
||||
m_sizerParent = (wxWindow *) NULL;
|
||||
m_autoLayout = FALSE;
|
||||
|
||||
m_hasScrolling = FALSE;
|
||||
m_isScrolling = FALSE;
|
||||
m_hAdjust = (GtkAdjustment *) NULL;
|
||||
m_vAdjust = (GtkAdjustment *) NULL;
|
||||
m_oldHorizontalPos = 0.0;
|
||||
m_oldVerticalPos = 0.0;
|
||||
|
||||
m_isShown = FALSE;
|
||||
m_isEnabled = TRUE;
|
||||
|
||||
m_dropTarget = (wxDropTarget *) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_windowValidator = (wxValidator *) NULL;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
|
||||
m_clientObject = (wxClientData*)NULL;
|
||||
m_clientData = NULL;
|
||||
}
|
||||
|
||||
void wxWindow::PostCreation()
|
||||
@ -1847,32 +1875,23 @@ void wxWindow::SetValidator( const wxValidator& validator )
|
||||
|
||||
void wxWindow::SetClientObject( wxClientData *data )
|
||||
{
|
||||
if (m_clientData) delete m_clientData;
|
||||
m_clientData = data;
|
||||
if (m_clientObject) delete m_clientObject;
|
||||
m_clientObject = data;
|
||||
}
|
||||
|
||||
wxClientData *wxWindow::GetClientObject()
|
||||
{
|
||||
return m_clientData;
|
||||
return m_clientObject;
|
||||
}
|
||||
|
||||
void wxWindow::SetClientData( void *data )
|
||||
{
|
||||
if (m_clientData) delete m_clientData;
|
||||
|
||||
if (data)
|
||||
m_clientData = new wxVoidClientData( data );
|
||||
else
|
||||
m_clientData = (wxClientData*) NULL;
|
||||
m_clientData = data;
|
||||
}
|
||||
|
||||
void *wxWindow::GetClientData()
|
||||
{
|
||||
if (!m_clientData) return NULL;
|
||||
|
||||
wxVoidClientData *vd = (wxVoidClientData*) m_clientData;
|
||||
|
||||
return vd->GetData();
|
||||
return m_clientData;
|
||||
}
|
||||
|
||||
bool wxWindow::IsBeingDeleted()
|
||||
|
Loading…
Reference in New Issue
Block a user