wxChoice *colourChoice;
wxCheckBox *underLineCheckBox;
wxChoice *pointSizeChoice;
+ bool m_useEvents;
// static bool fontDialogCancelled;
public:
bool MyApp::OnInit(void)
{
m_canvasTextColour = wxColour("BLACK");
- m_canvasFont = *wxSWISS_FONT;
+ m_canvasFont = *wxNORMAL_FONT;
// Create the main frame window
MyFrame *frame = new MyFrame(NULL, "wxWindows dialogs example", wxPoint(50, 50), wxSize(400, 300));
void DnDFrame::OnHelp(wxCommandEvent& /* event */)
{
wxMessageDialog dialog(this,
-"This small program demonstrates drag & drop support in wxWindows. "
-"The program window consists of 3 parts: the bottom pane is for "
-"debug messages, so that you can see what's going on inside. "
-"The top part is split into 2 listboxes, the left one accepts "
-"files and the right one accepts text."
-"\n\n"
-"To test wxDropTarget: open wordpad (write.exe), select some text in "
-"it and drag it to the right listbox (you'll notice the usual visual "
-"feedback, i.e. the cursor will change). Also, try dragging some "
-"files (you can select several at once) from Windows Explorer (or "
-"File Manager) to the left pane. Hold down Ctrl/Shift keys when "
-"you drop text (doesn't work with files) and see what changes. "
-"\n\n"
-"To test wxDropSource: just press any mouse button on the empty zone of "
-"the window and drag it to wordpad or any other droptarget accepting "
-"text (and of course you can just drag it to the right pane). Due to "
-"a lot of trace messages, the cursor might take some time to change, "
-"don't release the mouse button until it does. You can change the "
-"string being dragged in in \"File|Test drag...\" dialog."
-"\n\n"
-"Please send all questions/bug reports/suggestions &c to "
+"This small program demonstrates drag & drop support in wxWindows. The program window\n"
+"consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n"
+"going on inside. The top part is split into 2 listboxes, the left one accepts files\n"
+"and the right one accepts text."
+"\n"
+"To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n"
+"the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n"
+"Also, try dragging some files (you can select several at once) from Windows Explorer (or \n"
+"File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n"
+"work with files) and see what changes."
+"\n"
+"To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n"
+"it to wordpad or any other droptarget accepting text (and of course you can just drag it\n"
+"to the right pane). Due to a lot of trace messages, the cursor might take some time to \n"
+"change, don't release the mouse button until it does. You can change the string being\n"
+"dragged in in \"File|Test drag...\" dialog.\n"
+"Please send all questions/bug reports/suggestions &c to \n"
"Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>",
"wxDnD Help");
ScoreFile* file
) :
wxDialog(parent, -1, "Player Selection",
- wxDefaultPosition, wxSize(250, 200),
+ wxDefaultPosition, wxSize(320, 200),
wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
m_scoreFile(file)
{
cdef cc;
static cdef table[]={
-#ifdef __WXMSW__
+// #ifdef __WXMSW__
{"AQUAMARINE",112, 219, 147},
{"BLACK",0, 0, 0},
{"BLUE", 0, 0, 255},
{"WHITE", 255, 255, 255},
{"YELLOW", 255, 255, 0},
{"YELLOW GREEN", 153, 204, 50},
-#endif
+// #endif
#if defined(__WXGTK__) || defined(__X__)
{"MEDIUM GOLDENROD", 234, 234, 173},
unsigned char red = colour.Red ();
unsigned char green = colour.Green ();
unsigned char blue = colour.Blue ();
-
+
for (wxNode * node = First (); node; node = node->Next ())
{
wxColour *col = (wxColour *) node->Data ();
+
if (col->Red () == red && col->Green () == green && col->Blue () == blue)
{
char *found = node->key.string;
wxGenericFontDialog::wxGenericFontDialog(void)
{
+ m_useEvents = FALSE;
dialogParent = NULL;
}
wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, wxFontData *data):
wxDialog(parent, -1, "Font", wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
{
+ m_useEvents = FALSE;
Create(parent, data);
}
wxButton *okButton = new wxButton(this, wxID_OK, "OK", wxPoint(5, by));
(void) new wxButton(this, wxID_OK, "Cancel", wxPoint(50, by));
- familyChoice->SetStringSelection(wxFontFamilyIntToString(dialogFont.GetFamily()));
+ familyChoice->SetStringSelection( wxFontFamilyIntToString(dialogFont.GetFamily()) );
styleChoice->SetStringSelection(wxFontStyleIntToString(dialogFont.GetStyle()));
weightChoice->SetStringSelection(wxFontWeightIntToString(dialogFont.GetWeight()));
wxString name(wxTheColourDatabase->FindName(fontData.fontColour));
colourChoice->SetStringSelection(name);
underLineCheckBox->SetValue(dialogFont.GetUnderlined());
-
- pointSizeChoice->SetSelection(dialogFont.GetPointSize());
+ pointSizeChoice->SetSelection(dialogFont.GetPointSize()-1);
okButton->SetDefault();
Centre(wxBOTH);
wxEndBusyCursor();
+
+ m_useEvents = TRUE;
}
void wxGenericFontDialog::InitializeFont(void)
fontUnderline = fontData.initialFont.GetUnderlined();
}
dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0));
-
}
void wxGenericFontDialog::PaintFontBackground(wxDC& dc)
void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event))
{
+ if (!m_useEvents) return;
+
int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection());
int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection());
int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection());
class wxBitmapButton;
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxBitmapButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
-void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
+static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
+ if (!button->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
class wxButton;
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
+static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
{
+ if (!button->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
#include "wx/checkbox.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxCheckBox
//-----------------------------------------------------------------------------
-void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
+static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
{
+ if (!cb->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
event.SetInt( cb->GetValue() );
event.SetEventObject(cb);
#include "wx/choice.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxChoice
//-----------------------------------------------------------------------------
-void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
+static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
{
+ if (!choice->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
wxString tmp( choice->GetStringSelection() );
static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
+ if (!combo->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
if (combo->m_alreadySent)
{
combo->m_alreadySent = FALSE;
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] );
- gtk_signal_connect( GTK_OBJECT(list_item), "select",
- GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
-
gtk_container_add( GTK_CONTAINER(list), list_item );
m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item );
+
+ gtk_signal_connect( GTK_OBJECT(list_item), "select",
+ GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
};
PostCreation();
m_widget = gtk_file_selection_new( "File selection" );
+ int x = (gdk_screen_width () - 400) / 2;
+ int y = (gdk_screen_height () - 400) / 2;
+ gtk_widget_set_uposition( m_widget, x, y );
+
GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
m_path.Append(m_dir);
#include "wx/dynarray.h"
#include "wx/listbox.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxListBox
//-----------------------------------------------------------------------------
-void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
+static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
{
+ if (!listbox->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
event.SetInt( listbox->GetIndex( widget ) );
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] );
+ gtk_container_add( GTK_CONTAINER(m_list), list_item );
+
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
- gtk_container_add( GTK_CONTAINER(m_list), list_item );
-
m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item );
#include "wx/frame.h"
#include "wx/gtk/win_gtk.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxRadioBox
//-----------------------------------------------------------------------------
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
+static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
{
+ if (!rb->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
if (rb->m_alreadySent)
{
rb->m_alreadySent = FALSE;
#include "wx/scrolbar.h"
#include "wx/utils.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxScrollBar
//-----------------------------------------------------------------------------
-void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
+static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
{
-/*
- printf( "OnScroll from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
-
if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
#include "wx/slider.h"
#include "wx/utils.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxSlider
//-----------------------------------------------------------------------------
-void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
+static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
{
-/*
- printf( "OnScroll from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
-
if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
event.m_x = 0;
event.m_y = 0;
event.SetEventObject( win );
- return win->ProcessEvent( event );
+
+ bool ret = win->ProcessEvent( event );
+/*
+ if (ret) printf( "found.\n") ;
+*/
+ return ret;
};
//-----------------------------------------------------------------------------
void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
{
+ if (!win->HasVMT()) return;
+
if (win->GetDropTarget())
{
int x = 0;
bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
-
- if (g_blockEventsOnDrag) return FALSE;
+ if (g_blockEventsOnDrag) return TRUE;
+ if (!win->HasVMT()) return TRUE;
if (widget->window)
gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
-
- if (g_blockEventsOnDrag) return FALSE;
+ if (!win->HasVMT()) return TRUE;
+ if (g_blockEventsOnDrag) return TRUE;
if (widget->window)
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
m_wxwindow = gtk_myfixed_new();
+ if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+
if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL)
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
else
void wxWindow::ImplementSetPosition(void)
{
+ if (IS_KIND_OF(this,wxFrame) || IS_KIND_OF(this,wxDialog))
+ {
+ if ((m_x != -1) || (m_y != -1))
+ gtk_widget_set_uposition( m_widget, m_x, m_y );
+ return;
+ }
+
if (!m_parent)
{
- if (IsKindOf(CLASSINFO(wxFrame)) ||
- IsKindOf(CLASSINFO(wxDialog)))
- {
- if ((m_x != -1) || (m_y != -1))
- gtk_widget_set_uposition( m_widget, m_x, m_y );
- }
- else
- {
- printf( "wxWindow::SetSize error.\n" );
- }
+ printf( "wxWindow::SetSize error.\n" );
return;
}
void wxWindow::Centre( int direction )
{
- if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
+ if (IS_KIND_OF(this,wxDialog) || IS_KIND_OF(this,wxFrame))
{
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
class wxBitmapButton;
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxBitmapButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
-void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
+static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
+ if (!button->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
class wxButton;
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
+static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
{
+ if (!button->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
#include "wx/checkbox.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxCheckBox
//-----------------------------------------------------------------------------
-void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
+static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
{
+ if (!cb->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
event.SetInt( cb->GetValue() );
event.SetEventObject(cb);
#include "wx/choice.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxChoice
//-----------------------------------------------------------------------------
-void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
+static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
{
+ if (!choice->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
wxString tmp( choice->GetStringSelection() );
static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
+ if (!combo->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
if (combo->m_alreadySent)
{
combo->m_alreadySent = FALSE;
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] );
- gtk_signal_connect( GTK_OBJECT(list_item), "select",
- GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
-
gtk_container_add( GTK_CONTAINER(list), list_item );
m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item );
+
+ gtk_signal_connect( GTK_OBJECT(list_item), "select",
+ GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
};
PostCreation();
m_widget = gtk_file_selection_new( "File selection" );
+ int x = (gdk_screen_width () - 400) / 2;
+ int y = (gdk_screen_height () - 400) / 2;
+ gtk_widget_set_uposition( m_widget, x, y );
+
GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
m_path.Append(m_dir);
#include "wx/dynarray.h"
#include "wx/listbox.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxListBox
//-----------------------------------------------------------------------------
-void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
+static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
{
+ if (!listbox->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
event.SetInt( listbox->GetIndex( widget ) );
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] );
+ gtk_container_add( GTK_CONTAINER(m_list), list_item );
+
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
- gtk_container_add( GTK_CONTAINER(m_list), list_item );
-
m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item );
#include "wx/frame.h"
#include "wx/gtk/win_gtk.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxRadioBox
//-----------------------------------------------------------------------------
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
+static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
{
+ if (!rb->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
if (rb->m_alreadySent)
{
rb->m_alreadySent = FALSE;
#include "wx/scrolbar.h"
#include "wx/utils.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxScrollBar
//-----------------------------------------------------------------------------
-void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
+static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
{
-/*
- printf( "OnScroll from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
-
if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
#include "wx/slider.h"
#include "wx/utils.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxSlider
//-----------------------------------------------------------------------------
-void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
+static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
{
-/*
- printf( "OnScroll from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
-
if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
event.m_x = 0;
event.m_y = 0;
event.SetEventObject( win );
- return win->ProcessEvent( event );
+
+ bool ret = win->ProcessEvent( event );
+/*
+ if (ret) printf( "found.\n") ;
+*/
+ return ret;
};
//-----------------------------------------------------------------------------
void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
{
+ if (!win->HasVMT()) return;
+
if (win->GetDropTarget())
{
int x = 0;
bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
-
- if (g_blockEventsOnDrag) return FALSE;
+ if (g_blockEventsOnDrag) return TRUE;
+ if (!win->HasVMT()) return TRUE;
if (widget->window)
gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
-
- if (g_blockEventsOnDrag) return FALSE;
+ if (!win->HasVMT()) return TRUE;
+ if (g_blockEventsOnDrag) return TRUE;
if (widget->window)
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
m_wxwindow = gtk_myfixed_new();
+ if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+
if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL)
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
else
void wxWindow::ImplementSetPosition(void)
{
+ if (IS_KIND_OF(this,wxFrame) || IS_KIND_OF(this,wxDialog))
+ {
+ if ((m_x != -1) || (m_y != -1))
+ gtk_widget_set_uposition( m_widget, m_x, m_y );
+ return;
+ }
+
if (!m_parent)
{
- if (IsKindOf(CLASSINFO(wxFrame)) ||
- IsKindOf(CLASSINFO(wxDialog)))
- {
- if ((m_x != -1) || (m_y != -1))
- gtk_widget_set_uposition( m_widget, m_x, m_y );
- }
- else
- {
- printf( "wxWindow::SetSize error.\n" );
- }
+ printf( "wxWindow::SetSize error.\n" );
return;
}
void wxWindow::Centre( int direction )
{
- if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
+ if (IS_KIND_OF(this,wxDialog) || IS_KIND_OF(this,wxFrame))
{
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;