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:
parent
5787c2b9c2
commit
66bd6b9300
@ -54,6 +54,7 @@ class WXDLLEXPORT wxGenericFontDialog: public wxDialog
|
||||
wxChoice *colourChoice;
|
||||
wxCheckBox *underLineCheckBox;
|
||||
wxChoice *pointSizeChoice;
|
||||
bool m_useEvents;
|
||||
|
||||
// static bool fontDialogCancelled;
|
||||
public:
|
||||
|
@ -50,7 +50,7 @@ IMPLEMENT_WXWIN_MAIN
|
||||
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));
|
||||
|
@ -258,27 +258,23 @@ void DnDFrame::OnAbout(wxCommandEvent& /* event */)
|
||||
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");
|
||||
|
||||
|
@ -44,7 +44,7 @@ PlayerSelectionDialog::PlayerSelectionDialog(
|
||||
ScoreFile* file
|
||||
) :
|
||||
wxDialog(parent, -1, "Player Selection",
|
||||
wxDefaultPosition, wxSize(250, 200),
|
||||
wxDefaultPosition, wxSize(320, 200),
|
||||
wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
|
||||
m_scoreFile(file)
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ void wxColourDatabase::Initialize ()
|
||||
cdef cc;
|
||||
static cdef table[]={
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// #ifdef __WXMSW__
|
||||
{"AQUAMARINE",112, 219, 147},
|
||||
{"BLACK",0, 0, 0},
|
||||
{"BLUE", 0, 0, 255},
|
||||
@ -218,7 +218,7 @@ void wxColourDatabase::Initialize ()
|
||||
{"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},
|
||||
@ -303,10 +303,11 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
|
||||
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;
|
||||
|
@ -116,12 +116,14 @@ static wxString wxColourDialogNames[NUM_COLS]={"ORANGE",
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -243,15 +245,14 @@ void wxGenericFontDialog::CreateWidgets(void)
|
||||
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();
|
||||
|
||||
@ -260,6 +261,8 @@ void wxGenericFontDialog::CreateWidgets(void)
|
||||
Centre(wxBOTH);
|
||||
|
||||
wxEndBusyCursor();
|
||||
|
||||
m_useEvents = TRUE;
|
||||
}
|
||||
|
||||
void wxGenericFontDialog::InitializeFont(void)
|
||||
@ -278,7 +281,6 @@ void wxGenericFontDialog::InitializeFont(void)
|
||||
fontUnderline = fontData.initialFont.GetUnderlined();
|
||||
}
|
||||
dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0));
|
||||
|
||||
}
|
||||
|
||||
void wxGenericFontDialog::PaintFontBackground(wxDC& dc)
|
||||
@ -313,6 +315,8 @@ void wxGenericFontDialog::PaintFont(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());
|
||||
|
@ -20,14 +20,23 @@
|
||||
|
||||
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);
|
||||
|
@ -20,14 +20,23 @@
|
||||
|
||||
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);
|
||||
|
@ -15,12 +15,21 @@
|
||||
|
||||
#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);
|
||||
|
@ -15,12 +15,21 @@
|
||||
|
||||
#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() );
|
||||
|
@ -29,6 +29,9 @@ extern bool g_blockEventsOnDrag;
|
||||
|
||||
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;
|
||||
@ -90,14 +93,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
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();
|
||||
|
@ -65,6 +65,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||
|
||||
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);
|
||||
|
@ -16,12 +16,21 @@
|
||||
#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 ) );
|
||||
@ -84,11 +93,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
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 );
|
||||
|
@ -18,12 +18,21 @@
|
||||
#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;
|
||||
|
@ -16,20 +16,20 @@
|
||||
#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;
|
||||
|
@ -16,20 +16,20 @@
|
||||
#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;
|
||||
|
@ -256,7 +256,12 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
|
||||
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;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -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 )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
|
||||
if (win->GetDropTarget())
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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() );
|
||||
@ -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 )
|
||||
{
|
||||
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() );
|
||||
@ -804,6 +811,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
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
|
||||
@ -1059,18 +1068,16 @@ void wxWindow::ImplementSetSize(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 (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;
|
||||
}
|
||||
|
||||
@ -1325,7 +1332,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
|
||||
|
||||
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;
|
||||
|
@ -20,14 +20,23 @@
|
||||
|
||||
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);
|
||||
|
@ -20,14 +20,23 @@
|
||||
|
||||
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);
|
||||
|
@ -15,12 +15,21 @@
|
||||
|
||||
#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);
|
||||
|
@ -15,12 +15,21 @@
|
||||
|
||||
#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() );
|
||||
|
@ -29,6 +29,9 @@ extern bool g_blockEventsOnDrag;
|
||||
|
||||
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;
|
||||
@ -90,14 +93,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
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();
|
||||
|
@ -65,6 +65,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||
|
||||
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);
|
||||
|
@ -16,12 +16,21 @@
|
||||
#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 ) );
|
||||
@ -84,11 +93,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
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 );
|
||||
|
@ -18,12 +18,21 @@
|
||||
#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;
|
||||
|
@ -16,20 +16,20 @@
|
||||
#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;
|
||||
|
@ -16,20 +16,20 @@
|
||||
#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;
|
||||
|
@ -256,7 +256,12 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
|
||||
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;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -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 )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
|
||||
if (win->GetDropTarget())
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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() );
|
||||
@ -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 )
|
||||
{
|
||||
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() );
|
||||
@ -804,6 +811,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
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
|
||||
@ -1059,18 +1068,16 @@ void wxWindow::ImplementSetSize(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 (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;
|
||||
}
|
||||
|
||||
@ -1325,7 +1332,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user