Fixed Fontdialog

Fixed frame positions/centering
  Fixed inserting mdi windows
  Changed control callbacks


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-08-02 20:38:05 +00:00
parent 5787c2b9c2
commit 66bd6b9300
28 changed files with 254 additions and 116 deletions

View File

@@ -54,6 +54,7 @@ class WXDLLEXPORT wxGenericFontDialog: public wxDialog
wxChoice *colourChoice; wxChoice *colourChoice;
wxCheckBox *underLineCheckBox; wxCheckBox *underLineCheckBox;
wxChoice *pointSizeChoice; wxChoice *pointSizeChoice;
bool m_useEvents;
// static bool fontDialogCancelled; // static bool fontDialogCancelled;
public: public:

View File

@@ -50,7 +50,7 @@ IMPLEMENT_WXWIN_MAIN
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
m_canvasTextColour = wxColour("BLACK"); m_canvasTextColour = wxColour("BLACK");
m_canvasFont = *wxSWISS_FONT; m_canvasFont = *wxNORMAL_FONT;
// Create the main frame window // Create the main frame window
MyFrame *frame = new MyFrame(NULL, "wxWindows dialogs example", wxPoint(50, 50), wxSize(400, 300)); MyFrame *frame = new MyFrame(NULL, "wxWindows dialogs example", wxPoint(50, 50), wxSize(400, 300));

View File

@@ -258,27 +258,23 @@ void DnDFrame::OnAbout(wxCommandEvent& /* event */)
void DnDFrame::OnHelp(wxCommandEvent& /* event */) void DnDFrame::OnHelp(wxCommandEvent& /* event */)
{ {
wxMessageDialog dialog(this, wxMessageDialog dialog(this,
"This small program demonstrates drag & drop support in wxWindows. " "This small program demonstrates drag & drop support in wxWindows. The program window\n"
"The program window consists of 3 parts: the bottom pane is for " "consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n"
"debug messages, so that you can see what's going on inside. " "going on inside. The top part is split into 2 listboxes, the left one accepts files\n"
"The top part is split into 2 listboxes, the left one accepts " "and the right one accepts text."
"files and the right one accepts text." "\n"
"\n\n" "To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n"
"To test wxDropTarget: open wordpad (write.exe), select some text in " "the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n"
"it and drag it to the right listbox (you'll notice the usual visual " "Also, try dragging some files (you can select several at once) from Windows Explorer (or \n"
"feedback, i.e. the cursor will change). Also, try dragging some " "File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n"
"files (you can select several at once) from Windows Explorer (or " "work with files) and see what changes."
"File Manager) to the left pane. Hold down Ctrl/Shift keys when " "\n"
"you drop text (doesn't work with files) and see what changes. " "To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n"
"\n\n" "it to wordpad or any other droptarget accepting text (and of course you can just drag it\n"
"To test wxDropSource: just press any mouse button on the empty zone of " "to the right pane). Due to a lot of trace messages, the cursor might take some time to \n"
"the window and drag it to wordpad or any other droptarget accepting " "change, don't release the mouse button until it does. You can change the string being\n"
"text (and of course you can just drag it to the right pane). Due to " "dragged in in \"File|Test drag...\" dialog.\n"
"a lot of trace messages, the cursor might take some time to change, " "Please send all questions/bug reports/suggestions &c to \n"
"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 "
"Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>", "Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>",
"wxDnD Help"); "wxDnD Help");

View File

@@ -44,7 +44,7 @@ PlayerSelectionDialog::PlayerSelectionDialog(
ScoreFile* file ScoreFile* file
) : ) :
wxDialog(parent, -1, "Player Selection", wxDialog(parent, -1, "Player Selection",
wxDefaultPosition, wxSize(250, 200), wxDefaultPosition, wxSize(320, 200),
wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE), wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
m_scoreFile(file) m_scoreFile(file)
{ {

View File

@@ -146,7 +146,7 @@ void wxColourDatabase::Initialize ()
cdef cc; cdef cc;
static cdef table[]={ static cdef table[]={
#ifdef __WXMSW__ // #ifdef __WXMSW__
{"AQUAMARINE",112, 219, 147}, {"AQUAMARINE",112, 219, 147},
{"BLACK",0, 0, 0}, {"BLACK",0, 0, 0},
{"BLUE", 0, 0, 255}, {"BLUE", 0, 0, 255},
@@ -218,7 +218,7 @@ void wxColourDatabase::Initialize ()
{"WHITE", 255, 255, 255}, {"WHITE", 255, 255, 255},
{"YELLOW", 255, 255, 0}, {"YELLOW", 255, 255, 0},
{"YELLOW GREEN", 153, 204, 50}, {"YELLOW GREEN", 153, 204, 50},
#endif // #endif
#if defined(__WXGTK__) || defined(__X__) #if defined(__WXGTK__) || defined(__X__)
{"MEDIUM GOLDENROD", 234, 234, 173}, {"MEDIUM GOLDENROD", 234, 234, 173},
@@ -303,10 +303,11 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
unsigned char red = colour.Red (); unsigned char red = colour.Red ();
unsigned char green = colour.Green (); unsigned char green = colour.Green ();
unsigned char blue = colour.Blue (); unsigned char blue = colour.Blue ();
for (wxNode * node = First (); node; node = node->Next ()) for (wxNode * node = First (); node; node = node->Next ())
{ {
wxColour *col = (wxColour *) node->Data (); wxColour *col = (wxColour *) node->Data ();
if (col->Red () == red && col->Green () == green && col->Blue () == blue) if (col->Red () == red && col->Green () == green && col->Blue () == blue)
{ {
char *found = node->key.string; char *found = node->key.string;

View File

@@ -116,12 +116,14 @@ static wxString wxColourDialogNames[NUM_COLS]={"ORANGE",
wxGenericFontDialog::wxGenericFontDialog(void) wxGenericFontDialog::wxGenericFontDialog(void)
{ {
m_useEvents = FALSE;
dialogParent = NULL; dialogParent = NULL;
} }
wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, wxFontData *data): wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, wxFontData *data):
wxDialog(parent, -1, "Font", wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL) wxDialog(parent, -1, "Font", wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
{ {
m_useEvents = FALSE;
Create(parent, data); Create(parent, data);
} }
@@ -243,15 +245,14 @@ void wxGenericFontDialog::CreateWidgets(void)
wxButton *okButton = new wxButton(this, wxID_OK, "OK", wxPoint(5, by)); wxButton *okButton = new wxButton(this, wxID_OK, "OK", wxPoint(5, by));
(void) new wxButton(this, wxID_OK, "Cancel", wxPoint(50, 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())); styleChoice->SetStringSelection(wxFontStyleIntToString(dialogFont.GetStyle()));
weightChoice->SetStringSelection(wxFontWeightIntToString(dialogFont.GetWeight())); weightChoice->SetStringSelection(wxFontWeightIntToString(dialogFont.GetWeight()));
wxString name(wxTheColourDatabase->FindName(fontData.fontColour)); wxString name(wxTheColourDatabase->FindName(fontData.fontColour));
colourChoice->SetStringSelection(name); colourChoice->SetStringSelection(name);
underLineCheckBox->SetValue(dialogFont.GetUnderlined()); underLineCheckBox->SetValue(dialogFont.GetUnderlined());
pointSizeChoice->SetSelection(dialogFont.GetPointSize()-1);
pointSizeChoice->SetSelection(dialogFont.GetPointSize());
okButton->SetDefault(); okButton->SetDefault();
@@ -260,6 +261,8 @@ void wxGenericFontDialog::CreateWidgets(void)
Centre(wxBOTH); Centre(wxBOTH);
wxEndBusyCursor(); wxEndBusyCursor();
m_useEvents = TRUE;
} }
void wxGenericFontDialog::InitializeFont(void) void wxGenericFontDialog::InitializeFont(void)
@@ -278,7 +281,6 @@ void wxGenericFontDialog::InitializeFont(void)
fontUnderline = fontData.initialFont.GetUnderlined(); fontUnderline = fontData.initialFont.GetUnderlined();
} }
dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0)); dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0));
} }
void wxGenericFontDialog::PaintFontBackground(wxDC& dc) void wxGenericFontDialog::PaintFontBackground(wxDC& dc)
@@ -313,6 +315,8 @@ void wxGenericFontDialog::PaintFont(wxDC& dc)
void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event)) void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event))
{ {
if (!m_useEvents) return;
int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection()); int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection());
int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection()); int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection());
int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection()); int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection());

View File

@@ -20,14 +20,23 @@
class wxBitmapButton; class wxBitmapButton;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmapButton // wxBitmapButton
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl) 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()); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button); event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event); button->GetEventHandler()->ProcessEvent(event);

View File

@@ -20,14 +20,23 @@
class wxButton; class wxButton;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxButton // wxButton
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl) 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()); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button); event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event); button->GetEventHandler()->ProcessEvent(event);

View File

@@ -15,12 +15,21 @@
#include "wx/checkbox.h" #include "wx/checkbox.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxCheckBox // 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()); wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
event.SetInt( cb->GetValue() ); event.SetInt( cb->GetValue() );
event.SetEventObject(cb); event.SetEventObject(cb);

View File

@@ -15,12 +15,21 @@
#include "wx/choice.h" #include "wx/choice.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxChoice // 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() ); wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() ); event.SetInt( choice->GetSelection() );
wxString tmp( choice->GetStringSelection() ); wxString tmp( choice->GetStringSelection() );

View File

@@ -29,6 +29,9 @@ extern bool g_blockEventsOnDrag;
static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{ {
if (!combo->HasVMT()) return;
if (g_blockEventsOnDrag) return;
if (combo->m_alreadySent) if (combo->m_alreadySent)
{ {
combo->m_alreadySent = FALSE; combo->m_alreadySent = FALSE;
@@ -90,14 +93,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
GtkWidget *list_item; GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] ); 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 ); gtk_container_add( GTK_CONTAINER(list), list_item );
m_clientData.Append( (wxObject*)NULL ); m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item ); gtk_widget_show( list_item );
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
}; };
PostCreation(); PostCreation();

View File

@@ -65,6 +65,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
m_widget = gtk_file_selection_new( "File selection" ); 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); GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
m_path.Append(m_dir); m_path.Append(m_dir);

View File

@@ -16,12 +16,21 @@
#include "wx/dynarray.h" #include "wx/dynarray.h"
#include "wx/listbox.h" #include "wx/listbox.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxListBox // 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() ); wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
event.SetInt( listbox->GetIndex( widget ) ); event.SetInt( listbox->GetIndex( widget ) );
@@ -84,11 +93,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
GtkWidget *list_item; GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] ); 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_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
gtk_container_add( GTK_CONTAINER(m_list), list_item );
m_clientData.Append( (wxObject*)NULL ); m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item ); gtk_widget_show( list_item );

View File

@@ -18,12 +18,21 @@
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxRadioBox // 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) if (rb->m_alreadySent)
{ {
rb->m_alreadySent = FALSE; rb->m_alreadySent = FALSE;

View File

@@ -16,20 +16,20 @@
#include "wx/scrolbar.h" #include "wx/scrolbar.h"
#include "wx/utils.h" #include "wx/utils.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxScrollBar // 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 (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos; float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return; if (fabs(diff) < 0.2) return;

View File

@@ -16,20 +16,20 @@
#include "wx/slider.h" #include "wx/slider.h"
#include "wx/utils.h" #include "wx/utils.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxSlider // 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 (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos; float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return; if (fabs(diff) < 0.2) return;

View File

@@ -256,7 +256,12 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
event.m_x = 0; event.m_x = 0;
event.m_y = 0; event.m_y = 0;
event.SetEventObject( win ); event.SetEventObject( win );
return win->ProcessEvent( event );
bool ret = win->ProcessEvent( event );
/*
if (ret) printf( "found.\n") ;
*/
return ret;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -627,6 +632,8 @@ void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *
void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win ) void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
{ {
if (!win->HasVMT()) return;
if (win->GetDropTarget()) if (win->GetDropTarget())
{ {
int x = 0; int x = 0;
@@ -662,8 +669,8 @@ bool gtk_window_destroy_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSE
bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (!win->HasVMT()) return TRUE;
if (widget->window) if (widget->window)
gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
@@ -679,8 +686,8 @@ bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event,
bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (!win->HasVMT()) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (widget->window) if (widget->window)
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
@@ -804,6 +811,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
m_wxwindow = gtk_myfixed_new(); m_wxwindow = gtk_myfixed_new();
if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL) if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL)
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
else else
@@ -1059,18 +1068,16 @@ void wxWindow::ImplementSetSize(void)
void wxWindow::ImplementSetPosition(void) 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 (!m_parent)
{ {
if (IsKindOf(CLASSINFO(wxFrame)) || printf( "wxWindow::SetSize error.\n" );
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" );
}
return; return;
} }
@@ -1325,7 +1332,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
void wxWindow::Centre( int direction ) 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 & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2; if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;

View File

@@ -20,14 +20,23 @@
class wxBitmapButton; class wxBitmapButton;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmapButton // wxBitmapButton
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl) 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()); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button); event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event); button->GetEventHandler()->ProcessEvent(event);

View File

@@ -20,14 +20,23 @@
class wxButton; class wxButton;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxButton // wxButton
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl) 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()); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button); event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event); button->GetEventHandler()->ProcessEvent(event);

View File

@@ -15,12 +15,21 @@
#include "wx/checkbox.h" #include "wx/checkbox.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxCheckBox // 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()); wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
event.SetInt( cb->GetValue() ); event.SetInt( cb->GetValue() );
event.SetEventObject(cb); event.SetEventObject(cb);

View File

@@ -15,12 +15,21 @@
#include "wx/choice.h" #include "wx/choice.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxChoice // 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() ); wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() ); event.SetInt( choice->GetSelection() );
wxString tmp( choice->GetStringSelection() ); wxString tmp( choice->GetStringSelection() );

View File

@@ -29,6 +29,9 @@ extern bool g_blockEventsOnDrag;
static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{ {
if (!combo->HasVMT()) return;
if (g_blockEventsOnDrag) return;
if (combo->m_alreadySent) if (combo->m_alreadySent)
{ {
combo->m_alreadySent = FALSE; combo->m_alreadySent = FALSE;
@@ -90,14 +93,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
GtkWidget *list_item; GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] ); 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 ); gtk_container_add( GTK_CONTAINER(list), list_item );
m_clientData.Append( (wxObject*)NULL ); m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item ); gtk_widget_show( list_item );
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
}; };
PostCreation(); PostCreation();

View File

@@ -65,6 +65,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
m_widget = gtk_file_selection_new( "File selection" ); 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); GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
m_path.Append(m_dir); m_path.Append(m_dir);

View File

@@ -16,12 +16,21 @@
#include "wx/dynarray.h" #include "wx/dynarray.h"
#include "wx/listbox.h" #include "wx/listbox.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxListBox // 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() ); wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
event.SetInt( listbox->GetIndex( widget ) ); event.SetInt( listbox->GetIndex( widget ) );
@@ -84,11 +93,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
GtkWidget *list_item; GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] ); 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_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
gtk_container_add( GTK_CONTAINER(m_list), list_item );
m_clientData.Append( (wxObject*)NULL ); m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item ); gtk_widget_show( list_item );

View File

@@ -18,12 +18,21 @@
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxRadioBox // 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) if (rb->m_alreadySent)
{ {
rb->m_alreadySent = FALSE; rb->m_alreadySent = FALSE;

View File

@@ -16,20 +16,20 @@
#include "wx/scrolbar.h" #include "wx/scrolbar.h"
#include "wx/utils.h" #include "wx/utils.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxScrollBar // 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 (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos; float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return; if (fabs(diff) < 0.2) return;

View File

@@ -16,20 +16,20 @@
#include "wx/slider.h" #include "wx/slider.h"
#include "wx/utils.h" #include "wx/utils.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxSlider // 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 (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos; float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return; if (fabs(diff) < 0.2) return;

View File

@@ -256,7 +256,12 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
event.m_x = 0; event.m_x = 0;
event.m_y = 0; event.m_y = 0;
event.SetEventObject( win ); event.SetEventObject( win );
return win->ProcessEvent( event );
bool ret = win->ProcessEvent( event );
/*
if (ret) printf( "found.\n") ;
*/
return ret;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -627,6 +632,8 @@ void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *
void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win ) void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
{ {
if (!win->HasVMT()) return;
if (win->GetDropTarget()) if (win->GetDropTarget())
{ {
int x = 0; int x = 0;
@@ -662,8 +669,8 @@ bool gtk_window_destroy_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSE
bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (!win->HasVMT()) return TRUE;
if (widget->window) if (widget->window)
gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
@@ -679,8 +686,8 @@ bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event,
bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (!win->HasVMT()) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (widget->window) if (widget->window)
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
@@ -804,6 +811,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
m_wxwindow = gtk_myfixed_new(); m_wxwindow = gtk_myfixed_new();
if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL) if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL)
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
else else
@@ -1059,18 +1068,16 @@ void wxWindow::ImplementSetSize(void)
void wxWindow::ImplementSetPosition(void) 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 (!m_parent)
{ {
if (IsKindOf(CLASSINFO(wxFrame)) || printf( "wxWindow::SetSize error.\n" );
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" );
}
return; return;
} }
@@ -1325,7 +1332,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
void wxWindow::Centre( int direction ) 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 & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2; if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;