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
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSETTINGSH__
#define __GTKSETTINGSH__
@@ -20,10 +19,10 @@
#include "wx/pen.h"
#include "wx/font.h"
class WXDLLEXPORT wxSystemSettings: public wxObject
class wxSystemSettings: public wxObject
{
public:
inline wxSystemSettings(void) {}
inline wxSystemSettings() {}
inline static void Init() {}
static void Done();

View File

@@ -307,7 +307,7 @@ public:
wxCursor *m_cursor;
wxFont m_font;
wxColour m_backgroundColour;
wxColour m_foregroundColour ;
wxColour m_foregroundColour;
wxRegion m_updateRegion;
long m_windowStyle;
bool m_isShown;
@@ -330,6 +330,7 @@ public:
bool m_resizing;
GdkGC *m_scrollGC;
GtkStyle *m_widgetStyle;
bool m_isStaticBox;
wxInsertChildFunction m_insertCallback;

View File

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

View File

@@ -307,7 +307,7 @@ public:
wxCursor *m_cursor;
wxFont m_font;
wxColour m_backgroundColour;
wxColour m_foregroundColour ;
wxColour m_foregroundColour;
wxRegion m_updateRegion;
long m_windowStyle;
bool m_isShown;
@@ -330,6 +330,7 @@ public:
bool m_resizing;
GdkGC *m_scrollGC;
GtkStyle *m_widgetStyle;
bool m_isStaticBox;
wxInsertChildFunction m_insertCallback;

View File

@@ -270,7 +270,10 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
wxTextCtrl *textCtrl = (wxTextCtrl *)m_validatorWindow;
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);
return ;

View File

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

View File

@@ -75,22 +75,12 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
if ( data )
printData = *data;
int buttonWidth = 65;
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));
(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));
okButton->SetDefault();
okButton->SetFocus();
yPos += 35;
(void)new wxStaticBox( this, -1, _( "Printer options" ), wxPoint( 5, 5), wxSize( 300, 60 ) );
printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(20, 25) );
setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(160, 25), wxSize(100, -1));
wxString *choices = new wxString[2];
choices[0] = _("All");
choices[1] = _("Pages");
@@ -100,41 +90,30 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
if(printData.GetFromPage() != 0)
{
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);
}
yPos += 60;
xPos = 5;
int staticWidth = 45;
int textWidth = 40;
spacing = 10;
if(printData.GetFromPage() != 0)
{
(void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(xPos, yPos));
xPos += staticWidth;
(void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(5, 135));
fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
xPos += spacing + textWidth;
fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(45, 130), wxSize(40, -1));
(void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(xPos, yPos));
xPos += staticWidth;
(void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(100, 135));
toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
xPos += spacing + textWidth;
toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(133, 130), wxSize(40, -1));
}
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(xPos, yPos));
xPos += spacing + staticWidth;
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(200, 135));
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;
xPos = 5;
printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(xPos, yPos));
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1));
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1));
okButton->SetDefault();
okButton->SetFocus();
Fit();
Centre(wxBOTH);
@@ -312,7 +291,7 @@ wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSe
choices[1] = _("Landscape");
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);
(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));
wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(240, 200), wxSize(100, -1));
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(360, 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(270, 200), wxSize(100, -1));
okButton->SetDefault();
okButton->SetFocus();

View File

@@ -37,17 +37,17 @@ class wxColourRefData: public wxObjectRefData
wxColourRefData::wxColourRefData()
{
m_color.red = 0;
m_color.green = 0;
m_color.blue = 0;
m_color.pixel = 0;
m_colormap = (GdkColormap *) NULL;
m_hasPixel = FALSE;
m_color.red = 0;
m_color.green = 0;
m_color.blue = 0;
m_color.pixel = 0;
m_colormap = (GdkColormap *) NULL;
m_hasPixel = FALSE;
}
wxColourRefData::~wxColourRefData()
{
FreeColour();
FreeColour();
}
void wxColourRefData::FreeColour()
@@ -69,37 +69,39 @@ wxColour::wxColour()
wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
{
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
}
void wxColour::InitFromName( const wxString &colourName )
{
wxNode *node = (wxNode *) NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxColour *col = (wxColour*)node->Data();
UnRef();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
wxNode *node = (wxNode *) NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxFAIL_MSG( "wxColour: couldn't find colour" );
delete m_refData;
m_refData = (wxObjectRefData *) NULL;
wxColour *col = (wxColour*)node->Data();
UnRef();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
{
wxFAIL_MSG( "wxColour: couldn't find colour" );
printf( "Colourname %s.\n", WXSTRINGCAST colourName );
delete m_refData;
m_refData = (wxObjectRefData *) NULL;
}
}
}
}
wxColour::wxColour( const wxColour& col )
{
Ref( col );
Ref( col );
}
wxColour::~wxColour()
@@ -108,75 +110,63 @@ wxColour::~wxColour()
wxColour& wxColour::operator = ( const wxColour& col )
{
if (*this == col) return (*this);
Ref( col );
return *this;
if (*this == col) return (*this);
Ref( col );
return *this;
}
bool wxColour::operator == ( const wxColour& col )
{
return m_refData == col.m_refData;
return m_refData == col.m_refData;
}
bool wxColour::operator != ( const wxColour& col)
{
return m_refData != col.m_refData;
return m_refData != col.m_refData;
}
void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
{
UnRef();
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
UnRef();
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
}
unsigned char wxColour::Red() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid colour" );
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
}
unsigned char wxColour::Green() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid colour" );
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
}
unsigned char wxColour::Blue() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid colour" );
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
}
bool wxColour::Ok() const
{
return (m_refData != NULL);
return (m_refData != NULL);
}
void wxColour::CalcPixel( GdkColormap *cmap )
{
if (!Ok()) return;
if (!Ok()) return;
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
M_COLDATA->FreeColour();
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
M_COLDATA->FreeColour();
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
@@ -198,26 +188,26 @@ void wxColour::CalcPixel( GdkColormap *cmap )
M_COLDATA->m_hasPixel = TRUE;
M_COLDATA->m_color.pixel = index;
}
else
{
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
}
else
{
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
}
M_COLDATA->m_colormap = cmap;
M_COLDATA->m_colormap = cmap;
}
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
{
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
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_pointSize;
}
wxString wxFont::GetFaceString() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "";
}
wxCHECK_MSG( Ok(), "", "invalid font" );
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s;
@@ -202,11 +194,7 @@ wxString wxFont::GetFaceString() const
wxString wxFont::GetFaceName() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "";
}
wxCHECK_MSG( Ok(), "", "invalid font" );
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s;
@@ -214,22 +202,14 @@ wxString wxFont::GetFaceName() const
int wxFont::GetFamily() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_family;
}
wxString wxFont::GetFamilyString() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
switch (M_FONTDATA->m_family)
{
@@ -247,33 +227,21 @@ wxString wxFont::GetFamilyString() const
int wxFont::GetFontId() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_fontId; // stub
}
int wxFont::GetStyle() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_style;
}
wxString wxFont::GetStyleString() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
switch (M_FONTDATA->m_style)
{
@@ -288,22 +256,14 @@ wxString wxFont::GetStyleString() const
int wxFont::GetWeight() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_weight;
}
wxString wxFont::GetWeightString() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
switch (M_FONTDATA->m_weight)
{
@@ -318,11 +278,7 @@ wxString wxFont::GetWeightString() const
bool wxFont::GetUnderlined() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return FALSE;
}
wxCHECK_MSG( Ok(), FALSE, "invalid font" );
return M_FONTDATA->m_underlined;
}

View File

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

View File

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

View File

@@ -27,45 +27,47 @@ wxStaticBox::wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
Create( parent, id, label, pos, size, style, name );
}
bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_needParent = TRUE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_frame_new(m_label);
m_isStaticBox = TRUE;
m_widget = gtk_frame_new(m_label);
m_parent->AddChild( this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
(m_parent->m_insertCallback)( m_parent, this );
PostCreation();
PostCreation();
SetLabel(label);
SetLabel(label);
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
Show( TRUE );
Show( TRUE );
return TRUE;
return TRUE;
}
void wxStaticBox::SetLabel( const wxString &label )
{
wxControl::SetLabel( label );
GtkFrame *frame = GTK_FRAME( m_widget );
gtk_frame_set_label( frame, GetLabel() );
wxControl::SetLabel( label );
GtkFrame *frame = GTK_FRAME( m_widget );
gtk_frame_set_label( frame, GetLabel() );
}
void wxStaticBox::ApplyWidgetStyle()
{
SetWidgetStyle();
gtk_widget_set_style( m_widget, m_widgetStyle );
SetWidgetStyle();
gtk_widget_set_style( m_widget, m_widgetStyle );
}

File diff suppressed because it is too large Load Diff

View File

@@ -37,17 +37,17 @@ class wxColourRefData: public wxObjectRefData
wxColourRefData::wxColourRefData()
{
m_color.red = 0;
m_color.green = 0;
m_color.blue = 0;
m_color.pixel = 0;
m_colormap = (GdkColormap *) NULL;
m_hasPixel = FALSE;
m_color.red = 0;
m_color.green = 0;
m_color.blue = 0;
m_color.pixel = 0;
m_colormap = (GdkColormap *) NULL;
m_hasPixel = FALSE;
}
wxColourRefData::~wxColourRefData()
{
FreeColour();
FreeColour();
}
void wxColourRefData::FreeColour()
@@ -69,37 +69,39 @@ wxColour::wxColour()
wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
{
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
}
void wxColour::InitFromName( const wxString &colourName )
{
wxNode *node = (wxNode *) NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxColour *col = (wxColour*)node->Data();
UnRef();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
wxNode *node = (wxNode *) NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxFAIL_MSG( "wxColour: couldn't find colour" );
delete m_refData;
m_refData = (wxObjectRefData *) NULL;
wxColour *col = (wxColour*)node->Data();
UnRef();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
{
wxFAIL_MSG( "wxColour: couldn't find colour" );
printf( "Colourname %s.\n", WXSTRINGCAST colourName );
delete m_refData;
m_refData = (wxObjectRefData *) NULL;
}
}
}
}
wxColour::wxColour( const wxColour& col )
{
Ref( col );
Ref( col );
}
wxColour::~wxColour()
@@ -108,75 +110,63 @@ wxColour::~wxColour()
wxColour& wxColour::operator = ( const wxColour& col )
{
if (*this == col) return (*this);
Ref( col );
return *this;
if (*this == col) return (*this);
Ref( col );
return *this;
}
bool wxColour::operator == ( const wxColour& col )
{
return m_refData == col.m_refData;
return m_refData == col.m_refData;
}
bool wxColour::operator != ( const wxColour& col)
{
return m_refData != col.m_refData;
return m_refData != col.m_refData;
}
void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
{
UnRef();
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
UnRef();
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
}
unsigned char wxColour::Red() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid colour" );
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
}
unsigned char wxColour::Green() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid colour" );
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
}
unsigned char wxColour::Blue() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid colour" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid colour" );
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
}
bool wxColour::Ok() const
{
return (m_refData != NULL);
return (m_refData != NULL);
}
void wxColour::CalcPixel( GdkColormap *cmap )
{
if (!Ok()) return;
if (!Ok()) return;
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
M_COLDATA->FreeColour();
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
M_COLDATA->FreeColour();
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
@@ -198,26 +188,26 @@ void wxColour::CalcPixel( GdkColormap *cmap )
M_COLDATA->m_hasPixel = TRUE;
M_COLDATA->m_color.pixel = index;
}
else
{
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
}
else
{
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
}
M_COLDATA->m_colormap = cmap;
M_COLDATA->m_colormap = cmap;
}
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
{
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
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_pointSize;
}
wxString wxFont::GetFaceString() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "";
}
wxCHECK_MSG( Ok(), "", "invalid font" );
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s;
@@ -202,11 +194,7 @@ wxString wxFont::GetFaceString() const
wxString wxFont::GetFaceName() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "";
}
wxCHECK_MSG( Ok(), "", "invalid font" );
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s;
@@ -214,22 +202,14 @@ wxString wxFont::GetFaceName() const
int wxFont::GetFamily() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_family;
}
wxString wxFont::GetFamilyString() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
switch (M_FONTDATA->m_family)
{
@@ -247,33 +227,21 @@ wxString wxFont::GetFamilyString() const
int wxFont::GetFontId() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_fontId; // stub
}
int wxFont::GetStyle() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_style;
}
wxString wxFont::GetStyleString() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
switch (M_FONTDATA->m_style)
{
@@ -288,22 +256,14 @@ wxString wxFont::GetStyleString() const
int wxFont::GetWeight() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return 0;
}
wxCHECK_MSG( Ok(), 0, "invalid font" );
return M_FONTDATA->m_weight;
}
wxString wxFont::GetWeightString() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return "wxDEFAULT";
}
wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" );
switch (M_FONTDATA->m_weight)
{
@@ -318,11 +278,7 @@ wxString wxFont::GetWeightString() const
bool wxFont::GetUnderlined() const
{
if (!Ok())
{
wxFAIL_MSG( "invalid font" );
return FALSE;
}
wxCHECK_MSG( Ok(), FALSE, "invalid font" );
return M_FONTDATA->m_underlined;
}

View File

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

View File

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

View File

@@ -27,45 +27,47 @@ wxStaticBox::wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
Create( parent, id, label, pos, size, style, name );
}
bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_needParent = TRUE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_frame_new(m_label);
m_isStaticBox = TRUE;
m_widget = gtk_frame_new(m_label);
m_parent->AddChild( this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
(m_parent->m_insertCallback)( m_parent, this );
PostCreation();
PostCreation();
SetLabel(label);
SetLabel(label);
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
Show( TRUE );
Show( TRUE );
return TRUE;
return TRUE;
}
void wxStaticBox::SetLabel( const wxString &label )
{
wxControl::SetLabel( label );
GtkFrame *frame = GTK_FRAME( m_widget );
gtk_frame_set_label( frame, GetLabel() );
wxControl::SetLabel( label );
GtkFrame *frame = GTK_FRAME( m_widget );
gtk_frame_set_label( frame, GetLabel() );
}
void wxStaticBox::ApplyWidgetStyle()
{
SetWidgetStyle();
gtk_widget_set_style( m_widget, m_widgetStyle );
SetWidgetStyle();
gtk_widget_set_style( m_widget, m_widgetStyle );
}

File diff suppressed because it is too large Load Diff

View File

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