Added scrollbar size to settings

Added tetsing for cursor keys to wxTextValidator
  Correcte misspelled colour in wxColourDialog
  Made print dialogs look nicer
  Made wxStatixBox transparent (in the middle) for mouse
    actions (very useful for DialogEd)
  Corrected colour setting in DialogEd not to set any colour
    when using standard colour
  Corretced unresponding scrollbar in DialogEd


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1179 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-12-12 16:42:43 +00:00
parent 44c4a33486
commit 1ecc4d808e
20 changed files with 1529 additions and 1477 deletions

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSETTINGSH__ #ifndef __GTKSETTINGSH__
#define __GTKSETTINGSH__ #define __GTKSETTINGSH__
@@ -20,10 +19,10 @@
#include "wx/pen.h" #include "wx/pen.h"
#include "wx/font.h" #include "wx/font.h"
class WXDLLEXPORT wxSystemSettings: public wxObject class wxSystemSettings: public wxObject
{ {
public: public:
inline wxSystemSettings(void) {} inline wxSystemSettings() {}
inline static void Init() {} inline static void Init() {}
static void Done(); static void Done();

View File

@@ -330,6 +330,7 @@ public:
bool m_resizing; bool m_resizing;
GdkGC *m_scrollGC; GdkGC *m_scrollGC;
GtkStyle *m_widgetStyle; GtkStyle *m_widgetStyle;
bool m_isStaticBox;
wxInsertChildFunction m_insertCallback; wxInsertChildFunction m_insertCallback;

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSETTINGSH__ #ifndef __GTKSETTINGSH__
#define __GTKSETTINGSH__ #define __GTKSETTINGSH__
@@ -20,10 +19,10 @@
#include "wx/pen.h" #include "wx/pen.h"
#include "wx/font.h" #include "wx/font.h"
class WXDLLEXPORT wxSystemSettings: public wxObject class wxSystemSettings: public wxObject
{ {
public: public:
inline wxSystemSettings(void) {} inline wxSystemSettings() {}
inline static void Init() {} inline static void Init() {}
static void Done(); static void Done();

View File

@@ -330,6 +330,7 @@ public:
bool m_resizing; bool m_resizing;
GdkGC *m_scrollGC; GdkGC *m_scrollGC;
GtkStyle *m_widgetStyle; GtkStyle *m_widgetStyle;
bool m_isStaticBox;
wxInsertChildFunction m_insertCallback; wxInsertChildFunction m_insertCallback;

View File

@@ -270,7 +270,10 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
wxTextCtrl *textCtrl = (wxTextCtrl *)m_validatorWindow; wxTextCtrl *textCtrl = (wxTextCtrl *)m_validatorWindow;
int keyCode = event.KeyCode(); int keyCode = event.KeyCode();
if ( keyCode == WXK_DELETE || keyCode == WXK_RETURN || keyCode == WXK_BACK) if (keyCode == WXK_DELETE || keyCode == WXK_RETURN || keyCode == WXK_BACK ||
keyCode == WXK_HOME || keyCode == WXK_LEFT || keyCode == WXK_UP ||
keyCode == WXK_RIGHT || keyCode == WXK_DOWN || keyCode == WXK_PRIOR ||
keyCode == WXK_NEXT || keyCode == WXK_END || keyCode == WXK_HOME)
{ {
textCtrl->wxTextCtrl::OnChar(event); textCtrl->wxTextCtrl::OnChar(event);
return ; return ;

View File

@@ -85,7 +85,7 @@ static wxString wxColourDialogNames[NUM_COLS]={"ORANGE",
"FIREBRICK", "FIREBRICK",
"CORAL", "CORAL",
"FOREST GREEN", "FOREST GREEN",
"AQUARAMINE", "AQUAMARINE",
"BLUE", "BLUE",
"NAVY", "NAVY",
"THISTLE", "THISTLE",

View File

@@ -75,21 +75,11 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
if ( data ) if ( data )
printData = *data; printData = *data;
int buttonWidth = 65; (void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
int buttonHeight = 25;
int spacing = 5;
int yPos = 5;
int xPos = 5;
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(5, yPos), wxSize(buttonWidth, buttonHeight)); printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(buttonWidth + 5 + spacing, yPos), wxSize(buttonWidth, buttonHeight));
setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight)); setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
okButton->SetDefault();
okButton->SetFocus();
yPos += 35;
wxString *choices = new wxString[2]; wxString *choices = new wxString[2];
choices[0] = _("All"); choices[0] = _("All");
@@ -100,41 +90,30 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
if(printData.GetFromPage() != 0) if(printData.GetFromPage() != 0)
{ {
rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"), rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
wxPoint(5, yPos), wxSize(-1, -1), 2, choices, 2); wxPoint(5, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL);
rangeRadioBox->SetSelection(1); rangeRadioBox->SetSelection(1);
} }
yPos += 60;
xPos = 5;
int staticWidth = 45;
int textWidth = 40;
spacing = 10;
if(printData.GetFromPage() != 0) if(printData.GetFromPage() != 0)
{ {
(void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(xPos, yPos)); (void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(5, 135));
xPos += staticWidth;
fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(xPos, yPos), wxSize(textWidth, -1)); fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
xPos += spacing + textWidth;
(void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(xPos, yPos)); (void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(100, 135));
xPos += staticWidth;
toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(xPos, yPos), wxSize(textWidth, -1)); toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
xPos += spacing + textWidth;
} }
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(xPos, yPos)); (void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(200, 135));
xPos += spacing + staticWidth;
noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(xPos, yPos), wxSize(textWidth, -1)); noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
yPos += 30; wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1));
xPos = 5; (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(xPos, yPos));
okButton->SetDefault();
okButton->SetFocus();
Fit(); Fit();
Centre(wxBOTH); Centre(wxBOTH);
@@ -312,7 +291,7 @@ wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSe
choices[1] = _("Landscape"); choices[1] = _("Landscape");
orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"), orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
wxPoint(10, 80), wxSize(-1, -1), 2, choices, 2); wxPoint(10, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL );
orientationRadioBox->SetSelection(0); orientationRadioBox->SetSelection(0);
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(200,50) ); (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(200,50) );
@@ -330,8 +309,8 @@ wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSe
printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(260, 135), wxSize(150, -1)); printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(260, 135), wxSize(150, -1));
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(240, 200), wxSize(100, -1)); wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(80, 200), wxSize(100, -1));
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(360, 200), wxSize(100, -1)); (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(270, 200), wxSize(100, -1));
okButton->SetDefault(); okButton->SetDefault();
okButton->SetFocus(); okButton->SetFocus();

View File

@@ -91,6 +91,8 @@ void wxColour::InitFromName( const wxString &colourName )
if (!gdk_color_parse( colourName, &M_COLDATA->m_color )) if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
{ {
wxFAIL_MSG( "wxColour: couldn't find colour" ); wxFAIL_MSG( "wxColour: couldn't find colour" );
printf( "Colourname %s.\n", WXSTRINGCAST colourName );
delete m_refData; delete m_refData;
m_refData = (wxObjectRefData *) NULL; m_refData = (wxObjectRefData *) NULL;
} }
@@ -135,33 +137,21 @@ void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
unsigned char wxColour::Red() const unsigned char wxColour::Red() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid colour" );
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT); return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
} }
unsigned char wxColour::Green() const unsigned char wxColour::Green() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid colour" );
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT); return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
} }
unsigned char wxColour::Blue() const unsigned char wxColour::Blue() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid colour" );
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT); return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
} }
@@ -208,14 +198,14 @@ void wxColour::CalcPixel( GdkColormap *cmap )
int wxColour::GetPixel() const int wxColour::GetPixel() const
{ {
if (!Ok()) return 0; wxCHECK_MSG( Ok(), 0, "invalid colour" );
return M_COLDATA->m_color.pixel; return M_COLDATA->m_color.pixel;
} }
GdkColor *wxColour::GetColor() const GdkColor *wxColour::GetColor() const
{ {
if (!Ok()) return (GdkColor *) NULL; wxCHECK_MSG( Ok(), (GdkColor *) NULL, "invalid colour" );
return &M_COLDATA->m_color; return &M_COLDATA->m_color;
} }

View File

@@ -179,22 +179,14 @@ bool wxFont::Ok() const
int wxFont::GetPointSize() const int wxFont::GetPointSize() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_pointSize; return M_FONTDATA->m_pointSize;
} }
wxString wxFont::GetFaceString() const wxString wxFont::GetFaceString() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "";
}
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
@@ -202,11 +194,7 @@ wxString wxFont::GetFaceString() const
wxString wxFont::GetFaceName() const wxString wxFont::GetFaceName() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "";
}
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
@@ -214,22 +202,14 @@ wxString wxFont::GetFaceName() const
int wxFont::GetFamily() const int wxFont::GetFamily() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_family; return M_FONTDATA->m_family;
} }
wxString wxFont::GetFamilyString() const wxString wxFont::GetFamilyString() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
switch (M_FONTDATA->m_family) switch (M_FONTDATA->m_family)
{ {
@@ -247,33 +227,21 @@ wxString wxFont::GetFamilyString() const
int wxFont::GetFontId() const int wxFont::GetFontId() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_fontId; // stub return M_FONTDATA->m_fontId; // stub
} }
int wxFont::GetStyle() const int wxFont::GetStyle() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_style; return M_FONTDATA->m_style;
} }
wxString wxFont::GetStyleString() const wxString wxFont::GetStyleString() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
switch (M_FONTDATA->m_style) switch (M_FONTDATA->m_style)
{ {
@@ -288,22 +256,14 @@ wxString wxFont::GetStyleString() const
int wxFont::GetWeight() const int wxFont::GetWeight() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_weight; return M_FONTDATA->m_weight;
} }
wxString wxFont::GetWeightString() const wxString wxFont::GetWeightString() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
switch (M_FONTDATA->m_weight) switch (M_FONTDATA->m_weight)
{ {
@@ -318,11 +278,7 @@ wxString wxFont::GetWeightString() const
bool wxFont::GetUnderlined() const bool wxFont::GetUnderlined() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), FALSE, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return FALSE;
}
return M_FONTDATA->m_underlined; return M_FONTDATA->m_underlined;
} }

View File

@@ -80,7 +80,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
wxScrollBar *win ) wxScrollBar *win )
{ {
win->m_isScrolling = TRUE; win->m_isScrolling = TRUE;
g_blockEventsOnScroll = TRUE; // g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
return FALSE; return FALSE;
} }
@@ -94,7 +94,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
wxScrollBar *win ) wxScrollBar *win )
{ {
win->m_isScrolling = FALSE; win->m_isScrolling = FALSE;
g_blockEventsOnScroll = FALSE; // g_blockEventsOnScroll = FALSE;
gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" ); gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );

View File

@@ -13,6 +13,7 @@
#endif #endif
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/debug.h"
/* /*
#define wxSYS_COLOUR_SCROLLBAR 0 #define wxSYS_COLOUR_SCROLLBAR 0
@@ -59,7 +60,8 @@ wxColour *g_systemHighlightColour = (wxColour *) NULL;
wxFont *g_systemFont = (wxFont *) NULL; wxFont *g_systemFont = (wxFont *) NULL;
void wxSystemSettings::Done() { void wxSystemSettings::Done()
{
wxDELETE(g_systemBtnFaceColour); wxDELETE(g_systemBtnFaceColour);
wxDELETE(g_systemBtnShadowColour); wxDELETE(g_systemBtnShadowColour);
wxDELETE(g_systemBtnHighlightColour); wxDELETE(g_systemBtnHighlightColour);
@@ -178,10 +180,13 @@ int wxSystemSettings::GetSystemMetric( int index )
{ {
switch (index) switch (index)
{ {
case wxSYS_SCREEN_X: case wxSYS_SCREEN_X: return gdk_screen_width();
return gdk_screen_width(); case wxSYS_SCREEN_Y: return gdk_screen_height();
case wxSYS_SCREEN_Y: case wxSYS_HSCROLL_Y: return 15;
return gdk_screen_height(); case wxSYS_VSCROLL_X: return 15;
} }
wxCHECK_MSG( index, 0, "wxSystemSettings::GetSystemMetric not fully implemented" );
return 0; return 0;
} }

View File

@@ -38,6 +38,8 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
m_isStaticBox = TRUE;
m_widget = gtk_frame_new(m_label); m_widget = gtk_frame_new(m_label);
m_parent->AddChild( this ); m_parent->AddChild( this );

View File

@@ -400,6 +400,35 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
while (node) while (node)
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
int xx1 = child->m_x;
int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
event.m_x -= child->m_x;
event.m_y -= child->m_y;
break;
}
}
else
{
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
@@ -411,6 +440,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
}
node = node->Next(); node = node->Next();
} }
} }
@@ -474,6 +504,35 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
while (node) while (node)
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
int xx1 = child->m_x;
int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
event.m_x -= child->m_x;
event.m_y -= child->m_y;
break;
}
}
else
{
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
@@ -485,6 +544,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
}
node = node->Next(); node = node->Next();
} }
} }
@@ -538,6 +598,35 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
while (node) while (node)
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
int xx1 = child->m_x;
int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
event.m_x -= child->m_x;
event.m_y -= child->m_y;
break;
}
}
else
{
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
@@ -549,6 +638,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
}
node = node->Next(); node = node->Next();
} }
} }
@@ -881,6 +971,9 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
// don't test here as we can release the mouse while being over
// a different window then the slider
//
// if (gdk_event->window != widget->slider) return FALSE; // if (gdk_event->window != widget->slider) return FALSE;
win->m_isScrolling = TRUE; win->m_isScrolling = TRUE;
@@ -898,7 +991,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
wxWindow *win ) wxWindow *win )
{ {
// don't test here as we can reelase the mouse while being over // don't test here as we can release the mouse while being over
// a different window then the slider // a different window then the slider
// //
// if (gdk_event->window != widget->slider) return FALSE; // if (gdk_event->window != widget->slider) return FALSE;
@@ -924,8 +1017,8 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
// C++ has no virtual methods in a constructor. We have to emulate a // C++ has no virtual methods in a constructor. We have to emulate a
// virtual function here as wxNotebook requires a different way to insert // virtual function here as wxNotebook requires a different way to insert
// a child in it. I had opted for creating a wxNotebookPage window class // a child in it. I had opted for creating a wxNotebookPage window class
// which would have made this superflouus (such in the MDI window system), // which would have made this superfluous (such in the MDI window system),
// but no-one is listening to me... // but no-one was listening to me...
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child ) static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{ {
@@ -1009,6 +1102,8 @@ wxWindow::wxWindow()
m_clientObject = (wxClientData*) NULL; m_clientObject = (wxClientData*) NULL;
m_clientData = NULL; m_clientData = NULL;
m_isStaticBox = FALSE;
} }
wxWindow::wxWindow( wxWindow *parent, wxWindowID id, wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
@@ -1238,8 +1333,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_cursor = new wxCursor( wxCURSOR_ARROW ); m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
// m_backgroundColour = wxWHITE; m_backgroundColour = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
// m_foregroundColour = wxBLACK; m_foregroundColour = *wxBLACK;
m_windowStyle = style; m_windowStyle = style;
m_windowName = name; m_windowName = name;
@@ -1267,6 +1362,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_clientObject = (wxClientData*)NULL; m_clientObject = (wxClientData*)NULL;
m_clientData = NULL; m_clientData = NULL;
m_isStaticBox = FALSE;
} }
void wxWindow::PostCreation() void wxWindow::PostCreation()
@@ -1457,7 +1554,7 @@ void wxWindow::Move( int x, int y )
void wxWindow::GetSize( int *width, int *height ) const void wxWindow::GetSize( int *width, int *height ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (width) (*width) = m_width; if (width) (*width) = m_width;
if (height) (*height) = m_height; if (height) (*height) = m_height;
@@ -1465,7 +1562,7 @@ void wxWindow::GetSize( int *width, int *height ) const
void wxWindow::SetClientSize( int width, int height ) void wxWindow::SetClientSize( int width, int height )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (!m_wxwindow) if (!m_wxwindow)
{ {
@@ -1529,7 +1626,7 @@ void wxWindow::SetClientSize( int width, int height )
void wxWindow::GetClientSize( int *width, int *height ) const void wxWindow::GetClientSize( int *width, int *height ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (!m_wxwindow) if (!m_wxwindow)
{ {
@@ -1594,7 +1691,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
void wxWindow::GetPosition( int *x, int *y ) const void wxWindow::GetPosition( int *x, int *y ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (x) (*x) = m_x; if (x) (*x) = m_x;
if (y) (*y) = m_y; if (y) (*y) = m_y;
@@ -1602,7 +1699,7 @@ void wxWindow::GetPosition( int *x, int *y ) const
void wxWindow::ClientToScreen( int *x, int *y ) void wxWindow::ClientToScreen( int *x, int *y )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
@@ -1633,7 +1730,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
void wxWindow::ScreenToClient( int *x, int *y ) void wxWindow::ScreenToClient( int *x, int *y )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
@@ -1664,7 +1761,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
void wxWindow::Centre( int direction ) void wxWindow::Centre( int direction )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
int x = m_x; int x = m_x;
int y = m_y; int y = m_y;
@@ -1688,7 +1785,7 @@ void wxWindow::Centre( int direction )
void wxWindow::Fit() void wxWindow::Fit()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
@@ -1699,19 +1796,18 @@ void wxWindow::Fit()
int wx, wy, ww, wh; int wx, wy, ww, wh;
win->GetPosition(&wx, &wy); win->GetPosition(&wx, &wy);
win->GetSize(&ww, &wh); win->GetSize(&ww, &wh);
if ( wx + ww > maxX ) if (wx + ww > maxX) maxX = wx + ww;
maxX = wx + ww; if (wy + wh > maxY) maxY = wy + wh;
if ( wy + wh > maxY )
maxY = wy + wh;
node = node->Next(); node = node->Next();
} }
SetClientSize(maxX + 5, maxY + 10);
SetClientSize(maxX + 7, maxY + 14);
} }
void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) ) void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
m_minWidth = minW; m_minWidth = minW;
m_minHeight = minH; m_minHeight = minH;
@@ -1726,67 +1822,57 @@ void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
bool wxWindow::Show( bool show ) bool wxWindow::Show( bool show )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" );
if (show) if (show)
gtk_widget_show( m_widget ); gtk_widget_show( m_widget );
else else
gtk_widget_hide( m_widget ); gtk_widget_hide( m_widget );
m_isShown = show; m_isShown = show;
return TRUE; return TRUE;
} }
void wxWindow::Enable( bool enable ) void wxWindow::Enable( bool enable )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
m_isEnabled = enable; m_isEnabled = enable;
gtk_widget_set_sensitive( m_widget, enable ); gtk_widget_set_sensitive( m_widget, enable );
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable ); if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
} }
int wxWindow::GetCharHeight() const int wxWindow::GetCharHeight() const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( (m_widget != NULL), 12, "invalid window" );
if (!m_font.Ok()) wxCHECK_MSG( m_font.Ok(), 12, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return -1;
}
GdkFont *font = m_font.GetInternalFont( 1.0 ); GdkFont *font = m_font.GetInternalFont( 1.0 );
return font->ascent + font->descent; return font->ascent + font->descent;
} }
int wxWindow::GetCharWidth() const int wxWindow::GetCharWidth() const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( (m_widget != NULL), 8, "invalid window" );
if (!m_font.Ok()) wxCHECK_MSG( m_font.Ok(), 8, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return -1;
}
GdkFont *font = m_font.GetInternalFont( 1.0 ); GdkFont *font = m_font.GetInternalFont( 1.0 );
return gdk_string_width( font, "H" ); return gdk_string_width( font, "H" );
} }
void wxWindow::GetTextExtent( const wxString& string, int *x, int *y, void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
int *descent, int *externalLeading, const wxFont *theFont, bool WXUNUSED(use16) ) const int *descent, int *externalLeading, const wxFont *theFont, bool WXUNUSED(use16) ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
wxFont fontToUse = m_font; wxFont fontToUse = m_font;
if (theFont) fontToUse = *theFont; if (theFont) fontToUse = *theFont;
if (!fontToUse.Ok()) wxCHECK_RET( fontToUse.Ok(), "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return;
}
wxASSERT_MSG( (m_font.Ok()), "invalid font" );
GdkFont *font = fontToUse.GetInternalFont( 1.0 ); GdkFont *font = fontToUse.GetInternalFont( 1.0 );
if (x) (*x) = gdk_string_width( font, string ); if (x) (*x) = gdk_string_width( font, string );
@@ -1798,6 +1884,7 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
void wxWindow::MakeModal( bool modal ) void wxWindow::MakeModal( bool modal )
{ {
return; return;
// Disable all other windows // Disable all other windows
if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame))) if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
{ {
@@ -1805,8 +1892,7 @@ void wxWindow::MakeModal( bool modal )
while (node) while (node)
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (win != this) if (win != this) win->Enable(!modal);
win->Enable(!modal);
node = node->Next(); node = node->Next();
} }
@@ -1815,7 +1901,7 @@ void wxWindow::MakeModal( bool modal )
void wxWindow::SetFocus() void wxWindow::SetFocus()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (connect_widget) if (connect_widget)
@@ -1834,14 +1920,16 @@ bool wxWindow::OnClose()
void wxWindow::AddChild( wxWindow *child ) void wxWindow::AddChild( wxWindow *child )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
wxASSERT_MSG( (child != NULL), "invalid child" ); wxCHECK_RET( (child != NULL), "invalid child" );
m_children.Append( child ); m_children.Append( child );
} }
wxWindow *wxWindow::ReParent( wxWindow *newParent ) wxWindow *wxWindow::ReParent( wxWindow *newParent )
{ {
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" );
wxWindow *oldParent = GetParent(); wxWindow *oldParent = GetParent();
if (oldParent) oldParent->RemoveChild( this ); if (oldParent) oldParent->RemoveChild( this );
@@ -1875,14 +1963,14 @@ int wxWindow::GetReturnCode()
void wxWindow::Raise() void wxWindow::Raise()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (m_widget) gdk_window_raise( m_widget->window ); if (m_widget) gdk_window_raise( m_widget->window );
} }
void wxWindow::Lower() void wxWindow::Lower()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (m_widget) gdk_window_lower( m_widget->window ); if (m_widget) gdk_window_lower( m_widget->window );
} }
@@ -1973,18 +2061,11 @@ wxWindowID wxWindow::GetId() const
void wxWindow::SetCursor( const wxCursor &cursor ) void wxWindow::SetCursor( const wxCursor &cursor )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (m_cursor == NULL)
{
wxFAIL_MSG( "wxWindow::SetCursor m_cursor == NULL" );
m_cursor = new wxCursor( wxCURSOR_ARROW );
}
if (cursor.Ok()) if (cursor.Ok())
{ {
if ( cursor == *m_cursor ) if (cursor == *m_cursor) return;
return;
*m_cursor = cursor; *m_cursor = cursor;
} }
else else
@@ -2083,8 +2164,13 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
if (m_backgroundColour == colour) return; if (m_backgroundColour == colour) return;
if (!m_backgroundColour.Ok()) wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return; if (sysbg.Red() == colour.Red() &&
sysbg.Green() == colour.Green() &&
sysbg.Blue() == colour.Blue())
{
return;
}
m_backgroundColour = colour; m_backgroundColour = colour;
if (!m_backgroundColour.Ok()) return; if (!m_backgroundColour.Ok()) return;
@@ -2170,7 +2256,9 @@ bool wxWindow::Validate()
{ {
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();
if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this)) if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this))
{ return FALSE; } {
return FALSE;
}
node = node->Next(); node = node->Next();
} }
return TRUE; return TRUE;
@@ -2197,14 +2285,16 @@ bool wxWindow::TransferDataToWindow()
bool wxWindow::TransferDataFromWindow() bool wxWindow::TransferDataFromWindow()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
{ {
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();
if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() ) if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() )
{ return FALSE; } {
return FALSE;
}
node = node->Next(); node = node->Next();
} }
return TRUE; return TRUE;
@@ -2237,7 +2327,9 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{ {
wxMenuItem *menuitem = (wxMenuItem*)node->Data(); wxMenuItem *menuitem = (wxMenuItem*)node->Data();
if (menuitem->IsSubMenu()) if (menuitem->IsSubMenu())
{
SetInvokingWindow( menuitem->GetSubMenu(), win ); SetInvokingWindow( menuitem->GetSubMenu(), win );
}
node = node->Next(); node = node->Next();
} }
} }
@@ -2329,7 +2421,9 @@ void wxWindow::CaptureMouse()
(GDK_BUTTON_PRESS_MASK | (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK), GDK_POINTER_MOTION_MASK),
(GdkWindow *) NULL, (GdkCursor *) NULL, GDK_CURRENT_TIME ); (GdkWindow *) NULL,
(GdkCursor *) NULL,
GDK_CURRENT_TIME );
g_capturing = TRUE; g_capturing = TRUE;
} }
@@ -2410,11 +2504,9 @@ wxWindow *wxWindow::FindWindow( const wxString& name )
void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh ) int range, bool refresh )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" );
if (!m_wxwindow) return;
m_hasScrolling = TRUE; m_hasScrolling = TRUE;
@@ -2480,11 +2572,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" );
if (!m_wxwindow) return;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
@@ -2521,11 +2611,9 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
int wxWindow::GetScrollThumb( int orient ) const int wxWindow::GetScrollThumb( int orient ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" );
if (!m_wxwindow) return 0;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->page_size+0.5); return (int)(m_hAdjust->page_size+0.5);
@@ -2535,11 +2623,9 @@ int wxWindow::GetScrollThumb( int orient ) const
int wxWindow::GetScrollPos( int orient ) const int wxWindow::GetScrollPos( int orient ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" );
if (!m_wxwindow) return 0;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->value+0.5); return (int)(m_hAdjust->value+0.5);
@@ -2549,11 +2635,9 @@ int wxWindow::GetScrollPos( int orient ) const
int wxWindow::GetScrollRange( int orient ) const int wxWindow::GetScrollRange( int orient ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" );
if (!m_wxwindow) return 0;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->upper+0.5); return (int)(m_hAdjust->upper+0.5);
@@ -2563,11 +2647,9 @@ int wxWindow::GetScrollRange( int orient ) const
void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" );
if (!m_wxwindow) return;
int cw = 0; int cw = 0;
int ch = 0; int ch = 0;

View File

@@ -91,6 +91,8 @@ void wxColour::InitFromName( const wxString &colourName )
if (!gdk_color_parse( colourName, &M_COLDATA->m_color )) if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
{ {
wxFAIL_MSG( "wxColour: couldn't find colour" ); wxFAIL_MSG( "wxColour: couldn't find colour" );
printf( "Colourname %s.\n", WXSTRINGCAST colourName );
delete m_refData; delete m_refData;
m_refData = (wxObjectRefData *) NULL; m_refData = (wxObjectRefData *) NULL;
} }
@@ -135,33 +137,21 @@ void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
unsigned char wxColour::Red() const unsigned char wxColour::Red() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid colour" );
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT); return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
} }
unsigned char wxColour::Green() const unsigned char wxColour::Green() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid colour" );
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT); return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
} }
unsigned char wxColour::Blue() const unsigned char wxColour::Blue() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid colour" );
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT); return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
} }
@@ -208,14 +198,14 @@ void wxColour::CalcPixel( GdkColormap *cmap )
int wxColour::GetPixel() const int wxColour::GetPixel() const
{ {
if (!Ok()) return 0; wxCHECK_MSG( Ok(), 0, "invalid colour" );
return M_COLDATA->m_color.pixel; return M_COLDATA->m_color.pixel;
} }
GdkColor *wxColour::GetColor() const GdkColor *wxColour::GetColor() const
{ {
if (!Ok()) return (GdkColor *) NULL; wxCHECK_MSG( Ok(), (GdkColor *) NULL, "invalid colour" );
return &M_COLDATA->m_color; return &M_COLDATA->m_color;
} }

View File

@@ -179,22 +179,14 @@ bool wxFont::Ok() const
int wxFont::GetPointSize() const int wxFont::GetPointSize() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_pointSize; return M_FONTDATA->m_pointSize;
} }
wxString wxFont::GetFaceString() const wxString wxFont::GetFaceString() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "";
}
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
@@ -202,11 +194,7 @@ wxString wxFont::GetFaceString() const
wxString wxFont::GetFaceName() const wxString wxFont::GetFaceName() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "";
}
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
@@ -214,22 +202,14 @@ wxString wxFont::GetFaceName() const
int wxFont::GetFamily() const int wxFont::GetFamily() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_family; return M_FONTDATA->m_family;
} }
wxString wxFont::GetFamilyString() const wxString wxFont::GetFamilyString() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
switch (M_FONTDATA->m_family) switch (M_FONTDATA->m_family)
{ {
@@ -247,33 +227,21 @@ wxString wxFont::GetFamilyString() const
int wxFont::GetFontId() const int wxFont::GetFontId() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_fontId; // stub return M_FONTDATA->m_fontId; // stub
} }
int wxFont::GetStyle() const int wxFont::GetStyle() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_style; return M_FONTDATA->m_style;
} }
wxString wxFont::GetStyleString() const wxString wxFont::GetStyleString() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
switch (M_FONTDATA->m_style) switch (M_FONTDATA->m_style)
{ {
@@ -288,22 +256,14 @@ wxString wxFont::GetStyleString() const
int wxFont::GetWeight() const int wxFont::GetWeight() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), 0, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return 0;
}
return M_FONTDATA->m_weight; return M_FONTDATA->m_weight;
} }
wxString wxFont::GetWeightString() const wxString wxFont::GetWeightString() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
switch (M_FONTDATA->m_weight) switch (M_FONTDATA->m_weight)
{ {
@@ -318,11 +278,7 @@ wxString wxFont::GetWeightString() const
bool wxFont::GetUnderlined() const bool wxFont::GetUnderlined() const
{ {
if (!Ok()) wxCHECK_MSG( Ok(), FALSE, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return FALSE;
}
return M_FONTDATA->m_underlined; return M_FONTDATA->m_underlined;
} }

View File

@@ -80,7 +80,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
wxScrollBar *win ) wxScrollBar *win )
{ {
win->m_isScrolling = TRUE; win->m_isScrolling = TRUE;
g_blockEventsOnScroll = TRUE; // g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
return FALSE; return FALSE;
} }
@@ -94,7 +94,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
wxScrollBar *win ) wxScrollBar *win )
{ {
win->m_isScrolling = FALSE; win->m_isScrolling = FALSE;
g_blockEventsOnScroll = FALSE; // g_blockEventsOnScroll = FALSE;
gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" ); gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );

View File

@@ -13,6 +13,7 @@
#endif #endif
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/debug.h"
/* /*
#define wxSYS_COLOUR_SCROLLBAR 0 #define wxSYS_COLOUR_SCROLLBAR 0
@@ -59,7 +60,8 @@ wxColour *g_systemHighlightColour = (wxColour *) NULL;
wxFont *g_systemFont = (wxFont *) NULL; wxFont *g_systemFont = (wxFont *) NULL;
void wxSystemSettings::Done() { void wxSystemSettings::Done()
{
wxDELETE(g_systemBtnFaceColour); wxDELETE(g_systemBtnFaceColour);
wxDELETE(g_systemBtnShadowColour); wxDELETE(g_systemBtnShadowColour);
wxDELETE(g_systemBtnHighlightColour); wxDELETE(g_systemBtnHighlightColour);
@@ -178,10 +180,13 @@ int wxSystemSettings::GetSystemMetric( int index )
{ {
switch (index) switch (index)
{ {
case wxSYS_SCREEN_X: case wxSYS_SCREEN_X: return gdk_screen_width();
return gdk_screen_width(); case wxSYS_SCREEN_Y: return gdk_screen_height();
case wxSYS_SCREEN_Y: case wxSYS_HSCROLL_Y: return 15;
return gdk_screen_height(); case wxSYS_VSCROLL_X: return 15;
} }
wxCHECK_MSG( index, 0, "wxSystemSettings::GetSystemMetric not fully implemented" );
return 0; return 0;
} }

View File

@@ -38,6 +38,8 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
m_isStaticBox = TRUE;
m_widget = gtk_frame_new(m_label); m_widget = gtk_frame_new(m_label);
m_parent->AddChild( this ); m_parent->AddChild( this );

View File

@@ -400,6 +400,35 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
while (node) while (node)
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
int xx1 = child->m_x;
int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
event.m_x -= child->m_x;
event.m_y -= child->m_y;
break;
}
}
else
{
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
@@ -411,6 +440,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
}
node = node->Next(); node = node->Next();
} }
} }
@@ -474,6 +504,35 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
while (node) while (node)
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
int xx1 = child->m_x;
int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
event.m_x -= child->m_x;
event.m_y -= child->m_y;
break;
}
}
else
{
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
@@ -485,6 +544,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
}
node = node->Next(); node = node->Next();
} }
} }
@@ -538,6 +598,35 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
while (node) while (node)
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
int xx1 = child->m_x;
int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
event.m_x -= child->m_x;
event.m_y -= child->m_y;
break;
}
}
else
{
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
@@ -549,6 +638,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
}
node = node->Next(); node = node->Next();
} }
} }
@@ -881,6 +971,9 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
// don't test here as we can release the mouse while being over
// a different window then the slider
//
// if (gdk_event->window != widget->slider) return FALSE; // if (gdk_event->window != widget->slider) return FALSE;
win->m_isScrolling = TRUE; win->m_isScrolling = TRUE;
@@ -898,7 +991,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
wxWindow *win ) wxWindow *win )
{ {
// don't test here as we can reelase the mouse while being over // don't test here as we can release the mouse while being over
// a different window then the slider // a different window then the slider
// //
// if (gdk_event->window != widget->slider) return FALSE; // if (gdk_event->window != widget->slider) return FALSE;
@@ -924,8 +1017,8 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
// C++ has no virtual methods in a constructor. We have to emulate a // C++ has no virtual methods in a constructor. We have to emulate a
// virtual function here as wxNotebook requires a different way to insert // virtual function here as wxNotebook requires a different way to insert
// a child in it. I had opted for creating a wxNotebookPage window class // a child in it. I had opted for creating a wxNotebookPage window class
// which would have made this superflouus (such in the MDI window system), // which would have made this superfluous (such in the MDI window system),
// but no-one is listening to me... // but no-one was listening to me...
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child ) static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{ {
@@ -1009,6 +1102,8 @@ wxWindow::wxWindow()
m_clientObject = (wxClientData*) NULL; m_clientObject = (wxClientData*) NULL;
m_clientData = NULL; m_clientData = NULL;
m_isStaticBox = FALSE;
} }
wxWindow::wxWindow( wxWindow *parent, wxWindowID id, wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
@@ -1238,8 +1333,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_cursor = new wxCursor( wxCURSOR_ARROW ); m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
// m_backgroundColour = wxWHITE; m_backgroundColour = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
// m_foregroundColour = wxBLACK; m_foregroundColour = *wxBLACK;
m_windowStyle = style; m_windowStyle = style;
m_windowName = name; m_windowName = name;
@@ -1267,6 +1362,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_clientObject = (wxClientData*)NULL; m_clientObject = (wxClientData*)NULL;
m_clientData = NULL; m_clientData = NULL;
m_isStaticBox = FALSE;
} }
void wxWindow::PostCreation() void wxWindow::PostCreation()
@@ -1457,7 +1554,7 @@ void wxWindow::Move( int x, int y )
void wxWindow::GetSize( int *width, int *height ) const void wxWindow::GetSize( int *width, int *height ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (width) (*width) = m_width; if (width) (*width) = m_width;
if (height) (*height) = m_height; if (height) (*height) = m_height;
@@ -1465,7 +1562,7 @@ void wxWindow::GetSize( int *width, int *height ) const
void wxWindow::SetClientSize( int width, int height ) void wxWindow::SetClientSize( int width, int height )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (!m_wxwindow) if (!m_wxwindow)
{ {
@@ -1529,7 +1626,7 @@ void wxWindow::SetClientSize( int width, int height )
void wxWindow::GetClientSize( int *width, int *height ) const void wxWindow::GetClientSize( int *width, int *height ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (!m_wxwindow) if (!m_wxwindow)
{ {
@@ -1594,7 +1691,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
void wxWindow::GetPosition( int *x, int *y ) const void wxWindow::GetPosition( int *x, int *y ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (x) (*x) = m_x; if (x) (*x) = m_x;
if (y) (*y) = m_y; if (y) (*y) = m_y;
@@ -1602,7 +1699,7 @@ void wxWindow::GetPosition( int *x, int *y ) const
void wxWindow::ClientToScreen( int *x, int *y ) void wxWindow::ClientToScreen( int *x, int *y )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
@@ -1633,7 +1730,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
void wxWindow::ScreenToClient( int *x, int *y ) void wxWindow::ScreenToClient( int *x, int *y )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
@@ -1664,7 +1761,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
void wxWindow::Centre( int direction ) void wxWindow::Centre( int direction )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
int x = m_x; int x = m_x;
int y = m_y; int y = m_y;
@@ -1688,7 +1785,7 @@ void wxWindow::Centre( int direction )
void wxWindow::Fit() void wxWindow::Fit()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
@@ -1699,19 +1796,18 @@ void wxWindow::Fit()
int wx, wy, ww, wh; int wx, wy, ww, wh;
win->GetPosition(&wx, &wy); win->GetPosition(&wx, &wy);
win->GetSize(&ww, &wh); win->GetSize(&ww, &wh);
if ( wx + ww > maxX ) if (wx + ww > maxX) maxX = wx + ww;
maxX = wx + ww; if (wy + wh > maxY) maxY = wy + wh;
if ( wy + wh > maxY )
maxY = wy + wh;
node = node->Next(); node = node->Next();
} }
SetClientSize(maxX + 5, maxY + 10);
SetClientSize(maxX + 7, maxY + 14);
} }
void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) ) void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
m_minWidth = minW; m_minWidth = minW;
m_minHeight = minH; m_minHeight = minH;
@@ -1726,67 +1822,57 @@ void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
bool wxWindow::Show( bool show ) bool wxWindow::Show( bool show )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" );
if (show) if (show)
gtk_widget_show( m_widget ); gtk_widget_show( m_widget );
else else
gtk_widget_hide( m_widget ); gtk_widget_hide( m_widget );
m_isShown = show; m_isShown = show;
return TRUE; return TRUE;
} }
void wxWindow::Enable( bool enable ) void wxWindow::Enable( bool enable )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
m_isEnabled = enable; m_isEnabled = enable;
gtk_widget_set_sensitive( m_widget, enable ); gtk_widget_set_sensitive( m_widget, enable );
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable ); if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
} }
int wxWindow::GetCharHeight() const int wxWindow::GetCharHeight() const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( (m_widget != NULL), 12, "invalid window" );
if (!m_font.Ok()) wxCHECK_MSG( m_font.Ok(), 12, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return -1;
}
GdkFont *font = m_font.GetInternalFont( 1.0 ); GdkFont *font = m_font.GetInternalFont( 1.0 );
return font->ascent + font->descent; return font->ascent + font->descent;
} }
int wxWindow::GetCharWidth() const int wxWindow::GetCharWidth() const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( (m_widget != NULL), 8, "invalid window" );
if (!m_font.Ok()) wxCHECK_MSG( m_font.Ok(), 8, "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return -1;
}
GdkFont *font = m_font.GetInternalFont( 1.0 ); GdkFont *font = m_font.GetInternalFont( 1.0 );
return gdk_string_width( font, "H" ); return gdk_string_width( font, "H" );
} }
void wxWindow::GetTextExtent( const wxString& string, int *x, int *y, void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
int *descent, int *externalLeading, const wxFont *theFont, bool WXUNUSED(use16) ) const int *descent, int *externalLeading, const wxFont *theFont, bool WXUNUSED(use16) ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
wxFont fontToUse = m_font; wxFont fontToUse = m_font;
if (theFont) fontToUse = *theFont; if (theFont) fontToUse = *theFont;
if (!fontToUse.Ok()) wxCHECK_RET( fontToUse.Ok(), "invalid font" );
{
wxFAIL_MSG( "invalid font" );
return;
}
wxASSERT_MSG( (m_font.Ok()), "invalid font" );
GdkFont *font = fontToUse.GetInternalFont( 1.0 ); GdkFont *font = fontToUse.GetInternalFont( 1.0 );
if (x) (*x) = gdk_string_width( font, string ); if (x) (*x) = gdk_string_width( font, string );
@@ -1798,6 +1884,7 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
void wxWindow::MakeModal( bool modal ) void wxWindow::MakeModal( bool modal )
{ {
return; return;
// Disable all other windows // Disable all other windows
if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame))) if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
{ {
@@ -1805,8 +1892,7 @@ void wxWindow::MakeModal( bool modal )
while (node) while (node)
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (win != this) if (win != this) win->Enable(!modal);
win->Enable(!modal);
node = node->Next(); node = node->Next();
} }
@@ -1815,7 +1901,7 @@ void wxWindow::MakeModal( bool modal )
void wxWindow::SetFocus() void wxWindow::SetFocus()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (connect_widget) if (connect_widget)
@@ -1834,14 +1920,16 @@ bool wxWindow::OnClose()
void wxWindow::AddChild( wxWindow *child ) void wxWindow::AddChild( wxWindow *child )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
wxASSERT_MSG( (child != NULL), "invalid child" ); wxCHECK_RET( (child != NULL), "invalid child" );
m_children.Append( child ); m_children.Append( child );
} }
wxWindow *wxWindow::ReParent( wxWindow *newParent ) wxWindow *wxWindow::ReParent( wxWindow *newParent )
{ {
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" );
wxWindow *oldParent = GetParent(); wxWindow *oldParent = GetParent();
if (oldParent) oldParent->RemoveChild( this ); if (oldParent) oldParent->RemoveChild( this );
@@ -1875,14 +1963,14 @@ int wxWindow::GetReturnCode()
void wxWindow::Raise() void wxWindow::Raise()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (m_widget) gdk_window_raise( m_widget->window ); if (m_widget) gdk_window_raise( m_widget->window );
} }
void wxWindow::Lower() void wxWindow::Lower()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (m_widget) gdk_window_lower( m_widget->window ); if (m_widget) gdk_window_lower( m_widget->window );
} }
@@ -1973,18 +2061,11 @@ wxWindowID wxWindow::GetId() const
void wxWindow::SetCursor( const wxCursor &cursor ) void wxWindow::SetCursor( const wxCursor &cursor )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );
if (m_cursor == NULL)
{
wxFAIL_MSG( "wxWindow::SetCursor m_cursor == NULL" );
m_cursor = new wxCursor( wxCURSOR_ARROW );
}
if (cursor.Ok()) if (cursor.Ok())
{ {
if ( cursor == *m_cursor ) if (cursor == *m_cursor) return;
return;
*m_cursor = cursor; *m_cursor = cursor;
} }
else else
@@ -2083,8 +2164,13 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
if (m_backgroundColour == colour) return; if (m_backgroundColour == colour) return;
if (!m_backgroundColour.Ok()) wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return; if (sysbg.Red() == colour.Red() &&
sysbg.Green() == colour.Green() &&
sysbg.Blue() == colour.Blue())
{
return;
}
m_backgroundColour = colour; m_backgroundColour = colour;
if (!m_backgroundColour.Ok()) return; if (!m_backgroundColour.Ok()) return;
@@ -2170,7 +2256,9 @@ bool wxWindow::Validate()
{ {
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();
if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this)) if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this))
{ return FALSE; } {
return FALSE;
}
node = node->Next(); node = node->Next();
} }
return TRUE; return TRUE;
@@ -2197,14 +2285,16 @@ bool wxWindow::TransferDataToWindow()
bool wxWindow::TransferDataFromWindow() bool wxWindow::TransferDataFromWindow()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
{ {
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();
if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() ) if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() )
{ return FALSE; } {
return FALSE;
}
node = node->Next(); node = node->Next();
} }
return TRUE; return TRUE;
@@ -2237,7 +2327,9 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{ {
wxMenuItem *menuitem = (wxMenuItem*)node->Data(); wxMenuItem *menuitem = (wxMenuItem*)node->Data();
if (menuitem->IsSubMenu()) if (menuitem->IsSubMenu())
{
SetInvokingWindow( menuitem->GetSubMenu(), win ); SetInvokingWindow( menuitem->GetSubMenu(), win );
}
node = node->Next(); node = node->Next();
} }
} }
@@ -2329,7 +2421,9 @@ void wxWindow::CaptureMouse()
(GDK_BUTTON_PRESS_MASK | (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK), GDK_POINTER_MOTION_MASK),
(GdkWindow *) NULL, (GdkCursor *) NULL, GDK_CURRENT_TIME ); (GdkWindow *) NULL,
(GdkCursor *) NULL,
GDK_CURRENT_TIME );
g_capturing = TRUE; g_capturing = TRUE;
} }
@@ -2410,11 +2504,9 @@ wxWindow *wxWindow::FindWindow( const wxString& name )
void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh ) int range, bool refresh )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" );
if (!m_wxwindow) return;
m_hasScrolling = TRUE; m_hasScrolling = TRUE;
@@ -2480,11 +2572,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" );
if (!m_wxwindow) return;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
@@ -2521,11 +2611,9 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
int wxWindow::GetScrollThumb( int orient ) const int wxWindow::GetScrollThumb( int orient ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" );
if (!m_wxwindow) return 0;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->page_size+0.5); return (int)(m_hAdjust->page_size+0.5);
@@ -2535,11 +2623,9 @@ int wxWindow::GetScrollThumb( int orient ) const
int wxWindow::GetScrollPos( int orient ) const int wxWindow::GetScrollPos( int orient ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" );
if (!m_wxwindow) return 0;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->value+0.5); return (int)(m_hAdjust->value+0.5);
@@ -2549,11 +2635,9 @@ int wxWindow::GetScrollPos( int orient ) const
int wxWindow::GetScrollRange( int orient ) const int wxWindow::GetScrollRange( int orient ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" );
if (!m_wxwindow) return 0;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->upper+0.5); return (int)(m_hAdjust->upper+0.5);
@@ -2563,11 +2647,9 @@ int wxWindow::GetScrollRange( int orient ) const
void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" );
if (!m_wxwindow) return;
int cw = 0; int cw = 0;
int ch = 0; int ch = 0;

View File

@@ -313,7 +313,7 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *WXUNUSED(parent)
c->bottom.SameAs (m_editorFrame, wxBottom, 0); c->bottom.SameAs (m_editorFrame, wxBottom, 0);
c->width.Unconstrained(); c->width.Unconstrained();
#ifdef __WXGTK__ #ifdef __WXGTK__
c->height.Absolute(140); c->height.Absolute(105);
#else #else
c->height.Absolute(60); c->height.Absolute(60);
#endif #endif