Added Pop-up menus.
Hunted down bug in dnd Changed widget, that wxWin connects to in certain case (in controls, where m_widget is not the connect widget, such as list control and text control) Compile fixes all over git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -540,7 +540,9 @@ class wxListMainWindow: public wxScrolledWindow
|
|||||||
long FindItem(long start, long data);
|
long FindItem(long start, long data);
|
||||||
long HitTest( int x, int y, int &flags );
|
long HitTest( int x, int y, int &flags );
|
||||||
void InsertItem( wxListItem &item );
|
void InsertItem( wxListItem &item );
|
||||||
|
// void AddItem( wxListItem &item );
|
||||||
void InsertColumn( long col, wxListItem &item );
|
void InsertColumn( long col, wxListItem &item );
|
||||||
|
// void AddColumn( wxListItem &item );
|
||||||
void SortItems( wxListCtrlCompare fn, long data );
|
void SortItems( wxListCtrlCompare fn, long data );
|
||||||
virtual bool OnListNotify( wxListEvent &event );
|
virtual bool OnListNotify( wxListEvent &event );
|
||||||
|
|
||||||
|
@@ -74,7 +74,7 @@ class wxListBox: public wxControl
|
|||||||
void SetString( int n, const wxString &string );
|
void SetString( int n, const wxString &string );
|
||||||
void SetStringSelection( const wxString &string, bool select = TRUE );
|
void SetStringSelection( const wxString &string, bool select = TRUE );
|
||||||
|
|
||||||
virtual GtkWidget *GetDropTargetWidget(void);
|
virtual GtkWidget *GetConnectWidget(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ public:
|
|||||||
wxTextCtrl& operator<<(double d);
|
wxTextCtrl& operator<<(double d);
|
||||||
wxTextCtrl& operator<<(const char c);
|
wxTextCtrl& operator<<(const char c);
|
||||||
|
|
||||||
virtual GtkWidget* GetDropTargetWidget(void);
|
virtual GtkWidget* GetConnectWidget(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
|
@@ -164,11 +164,14 @@ public:
|
|||||||
virtual bool TransferDataFromWindow();
|
virtual bool TransferDataFromWindow();
|
||||||
void OnInitDialog( wxInitDialogEvent &event );
|
void OnInitDialog( wxInitDialogEvent &event );
|
||||||
virtual void InitDialog();
|
virtual void InitDialog();
|
||||||
|
|
||||||
|
virtual bool PopupMenu( wxMenu *menu, int x, int y );
|
||||||
|
|
||||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||||
virtual wxDropTarget *GetDropTarget() const;
|
virtual wxDropTarget *GetDropTarget() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual GtkWidget* GetDropTargetWidget(void);
|
virtual GtkWidget* GetConnectWidget(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||||
|
@@ -74,7 +74,7 @@ class wxListBox: public wxControl
|
|||||||
void SetString( int n, const wxString &string );
|
void SetString( int n, const wxString &string );
|
||||||
void SetStringSelection( const wxString &string, bool select = TRUE );
|
void SetStringSelection( const wxString &string, bool select = TRUE );
|
||||||
|
|
||||||
virtual GtkWidget *GetDropTargetWidget(void);
|
virtual GtkWidget *GetConnectWidget(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ public:
|
|||||||
wxTextCtrl& operator<<(double d);
|
wxTextCtrl& operator<<(double d);
|
||||||
wxTextCtrl& operator<<(const char c);
|
wxTextCtrl& operator<<(const char c);
|
||||||
|
|
||||||
virtual GtkWidget* GetDropTargetWidget(void);
|
virtual GtkWidget* GetConnectWidget(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
|
@@ -164,11 +164,14 @@ public:
|
|||||||
virtual bool TransferDataFromWindow();
|
virtual bool TransferDataFromWindow();
|
||||||
void OnInitDialog( wxInitDialogEvent &event );
|
void OnInitDialog( wxInitDialogEvent &event );
|
||||||
virtual void InitDialog();
|
virtual void InitDialog();
|
||||||
|
|
||||||
|
virtual bool PopupMenu( wxMenu *menu, int x, int y );
|
||||||
|
|
||||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||||
virtual wxDropTarget *GetDropTarget() const;
|
virtual wxDropTarget *GetDropTarget() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual GtkWidget* GetDropTargetWidget(void);
|
virtual GtkWidget* GetConnectWidget(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||||
|
@@ -123,6 +123,20 @@ bool MyApp::OnInit(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// MyTextCtrl
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyTextCtrl, wxTextCtrl)
|
||||||
|
EVT_RIGHT_DOWN (MyTextCtrl::OnRightButton)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyTextCtrl::MyTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||||
|
const wxPoint &pos, const wxSize &size, int style ) :
|
||||||
|
wxTextCtrl( parent, id, value, pos, size, style )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// MyPanel
|
// MyPanel
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@@ -82,7 +82,8 @@ public:
|
|||||||
void OnHelp (wxCommandEvent& event);
|
void OnHelp (wxCommandEvent& event);
|
||||||
void OnLogClear(wxCommandEvent& event);
|
void OnLogClear(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnMouseBtnDown(wxMouseEvent& event);
|
void OnLeftDown(wxMouseEvent& event);
|
||||||
|
void OnRightDown(wxMouseEvent& event);
|
||||||
|
|
||||||
bool OnClose();
|
bool OnClose();
|
||||||
|
|
||||||
@@ -116,10 +117,8 @@ BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
|
|||||||
EVT_MENU(Menu_Drag, DnDFrame::OnDrag)
|
EVT_MENU(Menu_Drag, DnDFrame::OnDrag)
|
||||||
EVT_MENU(Menu_Help, DnDFrame::OnHelp)
|
EVT_MENU(Menu_Help, DnDFrame::OnHelp)
|
||||||
EVT_MENU(Menu_Clear, DnDFrame::OnLogClear)
|
EVT_MENU(Menu_Clear, DnDFrame::OnLogClear)
|
||||||
|
EVT_LEFT_DOWN(OnLeftDown)
|
||||||
EVT_LEFT_DOWN(OnMouseBtnDown)
|
EVT_RIGHT_DOWN(OnRightDown)
|
||||||
EVT_RIGHT_DOWN(OnMouseBtnDown)
|
|
||||||
EVT_MIDDLE_DOWN(OnMouseBtnDown)
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// `Main program' equivalent, creating windows and returning main app frame
|
// `Main program' equivalent, creating windows and returning main app frame
|
||||||
@@ -291,10 +290,11 @@ bool DnDFrame::OnClose()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DnDFrame::OnMouseBtnDown(wxMouseEvent& /* event */ )
|
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if ( !m_strText.IsEmpty() ) {
|
if ( !m_strText.IsEmpty() ) {
|
||||||
// start drag operation
|
// start drag operation
|
||||||
|
|
||||||
wxTextDataObject data(m_strText);
|
wxTextDataObject data(m_strText);
|
||||||
wxDropSource dragSource(data, this);
|
wxDropSource dragSource(data, this);
|
||||||
const char *pc;
|
const char *pc;
|
||||||
@@ -312,6 +312,17 @@ void DnDFrame::OnMouseBtnDown(wxMouseEvent& /* event */ )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DnDFrame::OnRightDown(wxMouseEvent &event )
|
||||||
|
{
|
||||||
|
wxMenu *menu = new wxMenu;
|
||||||
|
|
||||||
|
menu->Append(Menu_Drag, "&Test drag...");
|
||||||
|
menu->Append(Menu_About, "&About");
|
||||||
|
menu->Append(Menu_Quit, "E&xit");
|
||||||
|
|
||||||
|
PopupMenu( menu, event.GetX(), event.GetY() );
|
||||||
|
}
|
||||||
|
|
||||||
DnDFrame::~DnDFrame()
|
DnDFrame::~DnDFrame()
|
||||||
{
|
{
|
||||||
if ( m_pLog != NULL ) {
|
if ( m_pLog != NULL ) {
|
||||||
|
@@ -263,6 +263,8 @@ wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
|||||||
|
|
||||||
UnregisterWindow();
|
UnregisterWindow();
|
||||||
|
|
||||||
|
g_blockEventsOnDrag = FALSE;
|
||||||
|
|
||||||
return m_retValue;
|
return m_retValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -400,16 +400,16 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
|||||||
|
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
|
wxNode *node = m_frameMenuBar->m_menus.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxMenu *menu = (wxMenu*)node->Data();
|
||||||
|
SetInvokingWindow( menu, this );
|
||||||
|
node = node->Next();
|
||||||
|
};
|
||||||
|
|
||||||
if (m_frameMenuBar->m_parent != this)
|
if (m_frameMenuBar->m_parent != this)
|
||||||
{
|
{
|
||||||
wxNode *node = m_frameMenuBar->m_menus.First();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxMenu *menu = (wxMenu*)node->Data();
|
|
||||||
SetInvokingWindow( menu, this );
|
|
||||||
node = node->Next();
|
|
||||||
};
|
|
||||||
|
|
||||||
m_frameMenuBar->m_parent = this;
|
m_frameMenuBar->m_parent = this;
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
|
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
|
||||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||||
|
@@ -167,7 +167,7 @@ void wxListBox::Delete( int n )
|
|||||||
wxNode *node = m_clientData.Nth( n );
|
wxNode *node = m_clientData.Nth( n );
|
||||||
if (!node)
|
if (!node)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("wxListBox::Delete wrong index"));
|
wxFAIL_MSG("wxListBox::Delete wrong index");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_clientData.DeleteNode( node );
|
m_clientData.DeleteNode( node );
|
||||||
@@ -347,7 +347,7 @@ int wxListBox::GetIndex( GtkWidget *item ) const
|
|||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
GtkWidget *wxListBox::GetDropTargetWidget(void)
|
GtkWidget *wxListBox::GetConnectWidget(void)
|
||||||
{
|
{
|
||||||
return GTK_WIDGET(m_list);
|
return GTK_WIDGET(m_list);
|
||||||
};
|
};
|
||||||
|
@@ -324,7 +324,7 @@ void wxMDIClientWindow::AddChild( wxWindow *child )
|
|||||||
{
|
{
|
||||||
if (!child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
if (!child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("wxNotebook::AddChild: Child has to be wxMDIChildFrame"));
|
wxFAIL_MSG("wxNotebook::AddChild: Child has to be wxMDIChildFrame");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMenuBar
|
// wxMenuBar
|
||||||
@@ -183,6 +184,7 @@ wxMenuItem::wxMenuItem()
|
|||||||
|
|
||||||
void wxMenuItem::SetText(const wxString& str)
|
void wxMenuItem::SetText(const wxString& str)
|
||||||
{
|
{
|
||||||
|
m_text = "";
|
||||||
for ( const char *pc = str; *pc != '\0'; pc++ ) {
|
for ( const char *pc = str; *pc != '\0'; pc++ ) {
|
||||||
if ( *pc == '&' )
|
if ( *pc == '&' )
|
||||||
pc++; // skip it
|
pc++; // skip it
|
||||||
@@ -193,7 +195,7 @@ void wxMenuItem::SetText(const wxString& str)
|
|||||||
|
|
||||||
void wxMenuItem::Check( bool check )
|
void wxMenuItem::Check( bool check )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsCheckable(), _("can't check uncheckable item!") )
|
wxCHECK_RET( IsCheckable(), _("Can't check uncheckable item!") )
|
||||||
|
|
||||||
m_isChecked = check;
|
m_isChecked = check;
|
||||||
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include "wx/panel.h"
|
#include "wx/panel.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -387,7 +387,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget* wxTextCtrl::GetDropTargetWidget(void)
|
GtkWidget* wxTextCtrl::GetConnectWidget(void)
|
||||||
{
|
{
|
||||||
return GTK_WIDGET(m_text);
|
return GTK_WIDGET(m_text);
|
||||||
};
|
};
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
|
#include "wx/menu.h"
|
||||||
#include "wx/notebook.h"
|
#include "wx/notebook.h"
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
@@ -55,13 +56,13 @@ void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gd
|
|||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (IS_KIND_OF(win,wxTreeCtrl))
|
if (IS_KIND_OF(win,wxStatusBar))
|
||||||
{
|
{
|
||||||
printf( "OnExpose from " );
|
printf( "OnExpose from " );
|
||||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||||
printf( win->GetClassInfo()->GetClassName() );
|
printf( win->GetClassInfo()->GetClassName() );
|
||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
|
|
||||||
printf( "x: %d \n", gdk_event->area.x );
|
printf( "x: %d \n", gdk_event->area.x );
|
||||||
printf( "y: %d \n", gdk_event->area.y );
|
printf( "y: %d \n", gdk_event->area.y );
|
||||||
printf( "w: %d \n", gdk_event->area.width );
|
printf( "w: %d \n", gdk_event->area.width );
|
||||||
@@ -92,6 +93,8 @@ void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect,
|
|||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
if (IS_KIND_OF(win,wxStatusBar))
|
||||||
|
{
|
||||||
printf( "OnDraw from " );
|
printf( "OnDraw from " );
|
||||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||||
printf( win->GetClassInfo()->GetClassName() );
|
printf( win->GetClassInfo()->GetClassName() );
|
||||||
@@ -101,6 +104,7 @@ void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect,
|
|||||||
printf( "y: %d \n", rect->y );
|
printf( "y: %d \n", rect->y );
|
||||||
printf( "w: %d \n", rect->width );
|
printf( "w: %d \n", rect->width );
|
||||||
printf( "h: %d \n", rect->height );
|
printf( "h: %d \n", rect->height );
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||||
@@ -297,7 +301,7 @@ gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_ev
|
|||||||
printf( win->GetClassInfo()->GetClassName() );
|
printf( win->GetClassInfo()->GetClassName() );
|
||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxEventType event_type = wxEVT_LEFT_DOWN;
|
wxEventType event_type = wxEVT_LEFT_DOWN;
|
||||||
|
|
||||||
if (gdk_event->button == 1)
|
if (gdk_event->button == 1)
|
||||||
@@ -945,8 +949,7 @@ void wxWindow::PostCreation(void)
|
|||||||
// GtkStyle *style = m_widget->style;
|
// GtkStyle *style = m_widget->style;
|
||||||
// style->font = m_font.GetInternalFont( 1.0 ); // destroy old font ?
|
// style->font = m_font.GetInternalFont( 1.0 ); // destroy old font ?
|
||||||
|
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
|
||||||
|
|
||||||
gtk_object_set_data (GTK_OBJECT (connect_widget), "MyWxWindow", (gpointer)this );
|
gtk_object_set_data (GTK_OBJECT (connect_widget), "MyWxWindow", (gpointer)this );
|
||||||
|
|
||||||
@@ -1418,8 +1421,7 @@ void wxWindow::MakeModal( bool modal )
|
|||||||
|
|
||||||
void wxWindow::SetFocus(void)
|
void wxWindow::SetFocus(void)
|
||||||
{
|
{
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
|
||||||
if (connect_widget)
|
if (connect_widget)
|
||||||
{
|
{
|
||||||
if (GTK_WIDGET_CAN_FOCUS(connect_widget) && !GTK_WIDGET_HAS_FOCUS (connect_widget) )
|
if (GTK_WIDGET_CAN_FOCUS(connect_widget) && !GTK_WIDGET_HAS_FOCUS (connect_widget) )
|
||||||
@@ -1587,7 +1589,7 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
rect->width,
|
rect->width,
|
||||||
rect->height );
|
rect->height );
|
||||||
else
|
else
|
||||||
Clear();
|
Clear();
|
||||||
};
|
};
|
||||||
if (!rect)
|
if (!rect)
|
||||||
{
|
{
|
||||||
@@ -1713,9 +1715,29 @@ void wxWindow::InitDialog(void)
|
|||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||||
|
{
|
||||||
|
menu->SetInvokingWindow( win );
|
||||||
|
wxNode *node = menu->m_items.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
|
||||||
|
if (menuitem->IsSubMenu())
|
||||||
|
SetInvokingWindow( menuitem->GetSubMenu(), win );
|
||||||
|
node = node->Next();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wxWindow::PopupMenu( wxMenu *menu, int WXUNUSED(x), int WXUNUSED(y) )
|
||||||
|
{
|
||||||
|
SetInvokingWindow( menu, this );
|
||||||
|
gtk_menu_popup( GTK_MENU(menu->m_menu), NULL, NULL, NULL, NULL, 0, 0 );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
|
void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
|
||||||
{
|
{
|
||||||
GtkWidget *dnd_widget = GetDropTargetWidget();
|
GtkWidget *dnd_widget = GetConnectWidget();
|
||||||
|
|
||||||
if (m_pDropTarget)
|
if (m_pDropTarget)
|
||||||
{
|
{
|
||||||
@@ -1740,7 +1762,7 @@ wxDropTarget *wxWindow::GetDropTarget() const
|
|||||||
return m_pDropTarget;
|
return m_pDropTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
GtkWidget* wxWindow::GetDropTargetWidget(void)
|
GtkWidget* wxWindow::GetConnectWidget(void)
|
||||||
{
|
{
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = m_widget;
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
if (m_wxwindow) connect_widget = m_wxwindow;
|
||||||
@@ -1779,8 +1801,7 @@ long wxWindow::GetWindowStyleFlag(void) const
|
|||||||
|
|
||||||
void wxWindow::CaptureMouse(void)
|
void wxWindow::CaptureMouse(void)
|
||||||
{
|
{
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
|
||||||
gtk_grab_add( connect_widget );
|
gtk_grab_add( connect_widget );
|
||||||
gdk_pointer_grab ( connect_widget->window, FALSE,
|
gdk_pointer_grab ( connect_widget->window, FALSE,
|
||||||
(GdkEventMask)
|
(GdkEventMask)
|
||||||
@@ -1792,8 +1813,7 @@ void wxWindow::CaptureMouse(void)
|
|||||||
|
|
||||||
void wxWindow::ReleaseMouse(void)
|
void wxWindow::ReleaseMouse(void)
|
||||||
{
|
{
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
|
||||||
gtk_grab_remove( connect_widget );
|
gtk_grab_remove( connect_widget );
|
||||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||||
};
|
};
|
||||||
|
@@ -263,6 +263,8 @@ wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
|||||||
|
|
||||||
UnregisterWindow();
|
UnregisterWindow();
|
||||||
|
|
||||||
|
g_blockEventsOnDrag = FALSE;
|
||||||
|
|
||||||
return m_retValue;
|
return m_retValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -400,16 +400,16 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
|||||||
|
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
|
wxNode *node = m_frameMenuBar->m_menus.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxMenu *menu = (wxMenu*)node->Data();
|
||||||
|
SetInvokingWindow( menu, this );
|
||||||
|
node = node->Next();
|
||||||
|
};
|
||||||
|
|
||||||
if (m_frameMenuBar->m_parent != this)
|
if (m_frameMenuBar->m_parent != this)
|
||||||
{
|
{
|
||||||
wxNode *node = m_frameMenuBar->m_menus.First();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxMenu *menu = (wxMenu*)node->Data();
|
|
||||||
SetInvokingWindow( menu, this );
|
|
||||||
node = node->Next();
|
|
||||||
};
|
|
||||||
|
|
||||||
m_frameMenuBar->m_parent = this;
|
m_frameMenuBar->m_parent = this;
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
|
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
|
||||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||||
|
@@ -167,7 +167,7 @@ void wxListBox::Delete( int n )
|
|||||||
wxNode *node = m_clientData.Nth( n );
|
wxNode *node = m_clientData.Nth( n );
|
||||||
if (!node)
|
if (!node)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("wxListBox::Delete wrong index"));
|
wxFAIL_MSG("wxListBox::Delete wrong index");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_clientData.DeleteNode( node );
|
m_clientData.DeleteNode( node );
|
||||||
@@ -347,7 +347,7 @@ int wxListBox::GetIndex( GtkWidget *item ) const
|
|||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
GtkWidget *wxListBox::GetDropTargetWidget(void)
|
GtkWidget *wxListBox::GetConnectWidget(void)
|
||||||
{
|
{
|
||||||
return GTK_WIDGET(m_list);
|
return GTK_WIDGET(m_list);
|
||||||
};
|
};
|
||||||
|
@@ -324,7 +324,7 @@ void wxMDIClientWindow::AddChild( wxWindow *child )
|
|||||||
{
|
{
|
||||||
if (!child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
if (!child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(_("wxNotebook::AddChild: Child has to be wxMDIChildFrame"));
|
wxFAIL_MSG("wxNotebook::AddChild: Child has to be wxMDIChildFrame");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMenuBar
|
// wxMenuBar
|
||||||
@@ -183,6 +184,7 @@ wxMenuItem::wxMenuItem()
|
|||||||
|
|
||||||
void wxMenuItem::SetText(const wxString& str)
|
void wxMenuItem::SetText(const wxString& str)
|
||||||
{
|
{
|
||||||
|
m_text = "";
|
||||||
for ( const char *pc = str; *pc != '\0'; pc++ ) {
|
for ( const char *pc = str; *pc != '\0'; pc++ ) {
|
||||||
if ( *pc == '&' )
|
if ( *pc == '&' )
|
||||||
pc++; // skip it
|
pc++; // skip it
|
||||||
@@ -193,7 +195,7 @@ void wxMenuItem::SetText(const wxString& str)
|
|||||||
|
|
||||||
void wxMenuItem::Check( bool check )
|
void wxMenuItem::Check( bool check )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsCheckable(), _("can't check uncheckable item!") )
|
wxCHECK_RET( IsCheckable(), _("Can't check uncheckable item!") )
|
||||||
|
|
||||||
m_isChecked = check;
|
m_isChecked = check;
|
||||||
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include "wx/panel.h"
|
#include "wx/panel.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -387,7 +387,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget* wxTextCtrl::GetDropTargetWidget(void)
|
GtkWidget* wxTextCtrl::GetConnectWidget(void)
|
||||||
{
|
{
|
||||||
return GTK_WIDGET(m_text);
|
return GTK_WIDGET(m_text);
|
||||||
};
|
};
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
|
#include "wx/menu.h"
|
||||||
#include "wx/notebook.h"
|
#include "wx/notebook.h"
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
@@ -55,13 +56,13 @@ void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gd
|
|||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (IS_KIND_OF(win,wxTreeCtrl))
|
if (IS_KIND_OF(win,wxStatusBar))
|
||||||
{
|
{
|
||||||
printf( "OnExpose from " );
|
printf( "OnExpose from " );
|
||||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||||
printf( win->GetClassInfo()->GetClassName() );
|
printf( win->GetClassInfo()->GetClassName() );
|
||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
|
|
||||||
printf( "x: %d \n", gdk_event->area.x );
|
printf( "x: %d \n", gdk_event->area.x );
|
||||||
printf( "y: %d \n", gdk_event->area.y );
|
printf( "y: %d \n", gdk_event->area.y );
|
||||||
printf( "w: %d \n", gdk_event->area.width );
|
printf( "w: %d \n", gdk_event->area.width );
|
||||||
@@ -92,6 +93,8 @@ void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect,
|
|||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
if (IS_KIND_OF(win,wxStatusBar))
|
||||||
|
{
|
||||||
printf( "OnDraw from " );
|
printf( "OnDraw from " );
|
||||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||||
printf( win->GetClassInfo()->GetClassName() );
|
printf( win->GetClassInfo()->GetClassName() );
|
||||||
@@ -101,6 +104,7 @@ void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect,
|
|||||||
printf( "y: %d \n", rect->y );
|
printf( "y: %d \n", rect->y );
|
||||||
printf( "w: %d \n", rect->width );
|
printf( "w: %d \n", rect->width );
|
||||||
printf( "h: %d \n", rect->height );
|
printf( "h: %d \n", rect->height );
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||||
@@ -297,7 +301,7 @@ gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_ev
|
|||||||
printf( win->GetClassInfo()->GetClassName() );
|
printf( win->GetClassInfo()->GetClassName() );
|
||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxEventType event_type = wxEVT_LEFT_DOWN;
|
wxEventType event_type = wxEVT_LEFT_DOWN;
|
||||||
|
|
||||||
if (gdk_event->button == 1)
|
if (gdk_event->button == 1)
|
||||||
@@ -945,8 +949,7 @@ void wxWindow::PostCreation(void)
|
|||||||
// GtkStyle *style = m_widget->style;
|
// GtkStyle *style = m_widget->style;
|
||||||
// style->font = m_font.GetInternalFont( 1.0 ); // destroy old font ?
|
// style->font = m_font.GetInternalFont( 1.0 ); // destroy old font ?
|
||||||
|
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
|
||||||
|
|
||||||
gtk_object_set_data (GTK_OBJECT (connect_widget), "MyWxWindow", (gpointer)this );
|
gtk_object_set_data (GTK_OBJECT (connect_widget), "MyWxWindow", (gpointer)this );
|
||||||
|
|
||||||
@@ -1418,8 +1421,7 @@ void wxWindow::MakeModal( bool modal )
|
|||||||
|
|
||||||
void wxWindow::SetFocus(void)
|
void wxWindow::SetFocus(void)
|
||||||
{
|
{
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
|
||||||
if (connect_widget)
|
if (connect_widget)
|
||||||
{
|
{
|
||||||
if (GTK_WIDGET_CAN_FOCUS(connect_widget) && !GTK_WIDGET_HAS_FOCUS (connect_widget) )
|
if (GTK_WIDGET_CAN_FOCUS(connect_widget) && !GTK_WIDGET_HAS_FOCUS (connect_widget) )
|
||||||
@@ -1587,7 +1589,7 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
rect->width,
|
rect->width,
|
||||||
rect->height );
|
rect->height );
|
||||||
else
|
else
|
||||||
Clear();
|
Clear();
|
||||||
};
|
};
|
||||||
if (!rect)
|
if (!rect)
|
||||||
{
|
{
|
||||||
@@ -1713,9 +1715,29 @@ void wxWindow::InitDialog(void)
|
|||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||||
|
{
|
||||||
|
menu->SetInvokingWindow( win );
|
||||||
|
wxNode *node = menu->m_items.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
|
||||||
|
if (menuitem->IsSubMenu())
|
||||||
|
SetInvokingWindow( menuitem->GetSubMenu(), win );
|
||||||
|
node = node->Next();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wxWindow::PopupMenu( wxMenu *menu, int WXUNUSED(x), int WXUNUSED(y) )
|
||||||
|
{
|
||||||
|
SetInvokingWindow( menu, this );
|
||||||
|
gtk_menu_popup( GTK_MENU(menu->m_menu), NULL, NULL, NULL, NULL, 0, 0 );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
|
void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
|
||||||
{
|
{
|
||||||
GtkWidget *dnd_widget = GetDropTargetWidget();
|
GtkWidget *dnd_widget = GetConnectWidget();
|
||||||
|
|
||||||
if (m_pDropTarget)
|
if (m_pDropTarget)
|
||||||
{
|
{
|
||||||
@@ -1740,7 +1762,7 @@ wxDropTarget *wxWindow::GetDropTarget() const
|
|||||||
return m_pDropTarget;
|
return m_pDropTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
GtkWidget* wxWindow::GetDropTargetWidget(void)
|
GtkWidget* wxWindow::GetConnectWidget(void)
|
||||||
{
|
{
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = m_widget;
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
if (m_wxwindow) connect_widget = m_wxwindow;
|
||||||
@@ -1779,8 +1801,7 @@ long wxWindow::GetWindowStyleFlag(void) const
|
|||||||
|
|
||||||
void wxWindow::CaptureMouse(void)
|
void wxWindow::CaptureMouse(void)
|
||||||
{
|
{
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
|
||||||
gtk_grab_add( connect_widget );
|
gtk_grab_add( connect_widget );
|
||||||
gdk_pointer_grab ( connect_widget->window, FALSE,
|
gdk_pointer_grab ( connect_widget->window, FALSE,
|
||||||
(GdkEventMask)
|
(GdkEventMask)
|
||||||
@@ -1792,8 +1813,7 @@ void wxWindow::CaptureMouse(void)
|
|||||||
|
|
||||||
void wxWindow::ReleaseMouse(void)
|
void wxWindow::ReleaseMouse(void)
|
||||||
{
|
{
|
||||||
GtkWidget *connect_widget = m_widget;
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
|
||||||
gtk_grab_remove( connect_widget );
|
gtk_grab_remove( connect_widget );
|
||||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user