After resolving all conflicts that came down the

telephone line: DialogEd is ready for general
  consumption now.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-09-07 22:01:55 +00:00
parent b8c631bb29
commit d84eb08384
14 changed files with 218 additions and 190 deletions

View File

@@ -59,7 +59,7 @@ class wxFont: public wxGDIObject
wxFont& operator = ( const wxFont& font ); wxFont& operator = ( const wxFont& font );
bool operator == ( const wxFont& font ); bool operator == ( const wxFont& font );
bool operator != ( const wxFont& font ); bool operator != ( const wxFont& font );
bool Ok(); bool Ok() const;
int GetPointSize(void) const; int GetPointSize(void) const;
wxString GetFaceName(void) const; wxString GetFaceName(void) const;

View File

@@ -59,7 +59,7 @@ class wxFont: public wxGDIObject
wxFont& operator = ( const wxFont& font ); wxFont& operator = ( const wxFont& font );
bool operator == ( const wxFont& font ); bool operator == ( const wxFont& font );
bool operator != ( const wxFont& font ); bool operator != ( const wxFont& font );
bool Ok(); bool Ok() const;
int GetPointSize(void) const; int GetPointSize(void) const;
wxString GetFaceName(void) const; wxString GetFaceName(void) const;

View File

@@ -56,8 +56,6 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
SetValidator( validator ); SetValidator( validator );
wxControl::SetLabel( label );
m_widget = gtk_check_button_new_with_label( m_label ); m_widget = gtk_check_button_new_with_label( m_label );
wxSize newSize = size; wxSize newSize = size;
@@ -70,6 +68,8 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
PostCreation(); PostCreation();
SetLabel( label );
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;

View File

@@ -20,21 +20,6 @@
// local data // local data
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static char *wx_font_family [] = {
"wxDEFAULT", "wxDECORATIVE", "wxROMAN", "wxSCRIPT",
"wxSWISS", "wxMODERN", "wxTELETYPE",
};
/*
static char *wx_font_style [] = {
"wxDEFAULT", "wxNORMAL", "wxSLANT", "wxITALIC",
};
static char *wx_font_weight [] = {
"wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT",
};
*/
extern wxFontNameDirectory *wxTheFontNameDirectory; extern wxFontNameDirectory *wxTheFontNameDirectory;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -64,10 +49,10 @@ class wxFontRefData: public wxObjectRefData
wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER) wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER)
{ {
m_byXFontName = FALSE; m_byXFontName = FALSE;
m_pointSize = -1; m_pointSize = 12;
m_family = -1; m_family = wxSWISS;
m_style = -1; m_style = wxNORMAL;
m_weight = -1; m_weight = wxNORMAL;
m_underlined = FALSE; m_underlined = FALSE;
m_fontId = 0; m_fontId = 0;
m_faceName = (char *) NULL; m_faceName = (char *) NULL;
@@ -128,8 +113,11 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
M_FONTDATA->m_fontId = FontIdOrFamily; M_FONTDATA->m_fontId = FontIdOrFamily;
M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily ); M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
} }
if (Style == wxDEFAULT) Style = wxSWISS;
M_FONTDATA->m_style = Style; M_FONTDATA->m_style = Style;
if (Weight == wxDEFAULT) Weight = wxNORMAL;
M_FONTDATA->m_weight = Weight; M_FONTDATA->m_weight = Weight;
if (PointSize == wxDEFAULT) PointSize = 10;
M_FONTDATA->m_pointSize = PointSize; M_FONTDATA->m_pointSize = PointSize;
M_FONTDATA->m_underlined = Underlined; M_FONTDATA->m_underlined = Underlined;
@@ -189,106 +177,120 @@ bool wxFont::operator != ( const wxFont& font )
return m_refData != font.m_refData; return m_refData != font.m_refData;
} }
bool wxFont::Ok() bool wxFont::Ok() const
{ {
return (m_refData != NULL); if (!m_refData)
{
wxFAIL_MSG( "invalid font" );
return FALSE;
}
else
return TRUE;
} }
int wxFont::GetPointSize(void) const int wxFont::GetPointSize(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_pointSize; return M_FONTDATA->m_pointSize;
} }
wxString wxFont::GetFaceString(void) const wxString wxFont::GetFaceString(void) const
{ {
if (!Ok()) return "";
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
} }
wxString wxFont::GetFaceName(void) const wxString wxFont::GetFaceName(void) const
{ {
if (!Ok()) return "";
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
} }
int wxFont::GetFamily(void) const int wxFont::GetFamily(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_family; return M_FONTDATA->m_family;
} }
wxString wxFont::GetFamilyString(void) const wxString wxFont::GetFamilyString(void) const
{ {
wxString s = wx_font_family[M_FONTDATA->m_family - wxDEFAULT]; if (!Ok()) return "wxDEFAULT";
return s;
switch (M_FONTDATA->m_family)
{
case wxDECORATIVE: return wxString("wxDECORATIVE");
case wxROMAN: return wxString("wxROMAN");
case wxSCRIPT: return wxString("wxSCRIPT");
case wxSWISS: return wxString("wxSWISS");
case wxMODERN: return wxString("wxMODERN");
case wxTELETYPE: return wxString("wxTELETYPE");
default: return "wxDEFAULT";
}
return "wxDEFAULT";
} }
int wxFont::GetFontId(void) const int wxFont::GetFontId(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_fontId; // stub return M_FONTDATA->m_fontId; // stub
} }
int wxFont::GetStyle(void) const int wxFont::GetStyle(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_style; return M_FONTDATA->m_style;
} }
wxString wxFont::GetStyleString(void) const wxString wxFont::GetStyleString(void) const
{ {
if (!Ok()) return "wxDEFAULT";
switch (M_FONTDATA->m_style) switch (M_FONTDATA->m_style)
{ {
case wxNORMAL: case wxNORMAL: return wxString("wxNORMAL");
{ case wxSLANT: return wxString("wxSLANT");
return wxString("wxNORMAL"); case wxITALIC: return wxString("wxITALIC");
} default: return wxString("wxDEFAULT");
case wxSLANT:
{
return wxString("wxSLANT");
}
case wxITALIC:
{
return wxString("wxITALIC");
}
case wxDEFAULT:
default:
{
return wxString("wxDEFAULT");
}
} }
return wxString("wxDEFAULT"); return wxString("wxDEFAULT");
} }
int wxFont::GetWeight(void) const int wxFont::GetWeight(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_weight; return M_FONTDATA->m_weight;
} }
wxString wxFont::GetWeightString(void) const wxString wxFont::GetWeightString(void) const
{ {
if (!Ok()) return "wxDEFAULT";
switch (M_FONTDATA->m_weight) switch (M_FONTDATA->m_weight)
{ {
case wxNORMAL: case wxNORMAL: return wxString("wxNORMAL");
{ case wxBOLD: return wxString("wxBOLD");
return wxString("wxNORMAL"); case wxLIGHT: return wxString("wxLIGHT");
} default: return wxString("wxDEFAULT");
case wxBOLD:
{
return wxString("wxBOLD");
}
case wxLIGHT:
{
return wxString("wxLIGHT");
}
case wxDEFAULT:
default:
{
return wxString("wxDEFAULT");
}
} }
return wxString("wxDEFAULT"); return wxString("wxDEFAULT");
} }
bool wxFont::GetUnderlined(void) const bool wxFont::GetUnderlined(void) const
{ {
if (!Ok()) return FALSE;
return M_FONTDATA->m_underlined; return M_FONTDATA->m_underlined;
} }

View File

@@ -85,7 +85,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
m_list = GTK_LIST( gtk_list_new() ); m_list = GTK_LIST( gtk_list_new() );
GtkSelectionMode mode = GTK_SELECTION_SINGLE; GtkSelectionMode mode = GTK_SELECTION_BROWSE;
if (style & wxLB_MULTIPLE) if (style & wxLB_MULTIPLE)
mode = GTK_SELECTION_MULTIPLE; mode = GTK_SELECTION_MULTIPLE;
else if (style & wxLB_EXTENDED) else if (style & wxLB_EXTENDED)
@@ -96,6 +96,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
gtk_container_add (GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) ); gtk_container_add (GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) );
gtk_widget_show( GTK_WIDGET(m_list) ); gtk_widget_show( GTK_WIDGET(m_list) );
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 100;
if (newSize.y == -1) newSize.y = 110;
SetSize( newSize.x, newSize.y );
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
GtkWidget *list_item; GtkWidget *list_item;
@@ -222,21 +227,14 @@ char *wxListBox::GetClientData( int n ) const
int wxListBox::GetSelection(void) const int wxListBox::GetSelection(void) const
{ {
GList *selection = m_list->selection;
if (selection)
{
GList *child = m_list->children; GList *child = m_list->children;
int count = 0; int count = 0;
while (child) while (child)
{ {
if (child->data == selection->data) return count; if (GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED) return count;
count++; count++;
child = child->next; child = child->next;
} }
}
// No, I think it's reasonable to return -1 to indicate
// there is no selection. -- JACS
// wxFAIL_MSG("wrong listbox index");
return -1; return -1;
} }

View File

@@ -80,15 +80,11 @@ int wxDisplayDepth(void)
// user and home routines // user and home routines
//------------------------------------------------------------------------ //------------------------------------------------------------------------
char* wxGetHomeDir( char *dest ) const char* wxGetHomeDir( wxString *home )
{ {
wxString tmp = wxGetUserHome( wxString() ); *home = wxGetUserHome( wxString() );
if (tmp.IsNull()) if (home->IsNull()) *home = "/";
strcpy( wxBuffer, "/" ); return *home;
else
strcpy( wxBuffer, tmp );
if (dest) strcpy( dest, WXSTRINGCAST tmp );
return wxBuffer;
}; };
char *wxGetUserHome( const wxString &user ) char *wxGetUserHome( const wxString &user )

View File

@@ -116,6 +116,7 @@
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
extern wxList wxTopLevelWindows; extern wxList wxTopLevelWindows;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
wxWindow *g_captureWindow = (wxWindow*)NULL;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "expose_event" (of m_wxwindow, not of m_widget) // "expose_event" (of m_wxwindow, not of m_widget)
@@ -299,6 +300,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
{ {
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow) if (win->m_wxwindow)
@@ -403,6 +406,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{ {
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE; if (!win->HasVMT()) return TRUE;
@@ -469,6 +475,9 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win ) static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{ {
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE; if (!win->HasVMT()) return TRUE;
@@ -599,7 +608,11 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE; if (!win->HasVMT()) return TRUE;
if (widget->window) if (widget->window)
@@ -621,9 +634,13 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (!win->HasVMT()) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
if (widget->window) if (widget->window)
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
@@ -1981,6 +1998,7 @@ void wxWindow::CaptureMouse(void)
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_captureWindow = this;
} }
void wxWindow::ReleaseMouse(void) void wxWindow::ReleaseMouse(void)
@@ -1988,6 +2006,7 @@ void wxWindow::ReleaseMouse(void)
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
gtk_grab_remove( connect_widget ); gtk_grab_remove( connect_widget );
gdk_pointer_ungrab ( GDK_CURRENT_TIME ); gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_captureWindow = (wxWindow*) NULL;;
} }
void wxWindow::SetTitle( const wxString &WXUNUSED(title) ) void wxWindow::SetTitle( const wxString &WXUNUSED(title) )

View File

@@ -56,8 +56,6 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
SetValidator( validator ); SetValidator( validator );
wxControl::SetLabel( label );
m_widget = gtk_check_button_new_with_label( m_label ); m_widget = gtk_check_button_new_with_label( m_label );
wxSize newSize = size; wxSize newSize = size;
@@ -70,6 +68,8 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
PostCreation(); PostCreation();
SetLabel( label );
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;

View File

@@ -20,21 +20,6 @@
// local data // local data
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static char *wx_font_family [] = {
"wxDEFAULT", "wxDECORATIVE", "wxROMAN", "wxSCRIPT",
"wxSWISS", "wxMODERN", "wxTELETYPE",
};
/*
static char *wx_font_style [] = {
"wxDEFAULT", "wxNORMAL", "wxSLANT", "wxITALIC",
};
static char *wx_font_weight [] = {
"wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT",
};
*/
extern wxFontNameDirectory *wxTheFontNameDirectory; extern wxFontNameDirectory *wxTheFontNameDirectory;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -64,10 +49,10 @@ class wxFontRefData: public wxObjectRefData
wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER) wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER)
{ {
m_byXFontName = FALSE; m_byXFontName = FALSE;
m_pointSize = -1; m_pointSize = 12;
m_family = -1; m_family = wxSWISS;
m_style = -1; m_style = wxNORMAL;
m_weight = -1; m_weight = wxNORMAL;
m_underlined = FALSE; m_underlined = FALSE;
m_fontId = 0; m_fontId = 0;
m_faceName = (char *) NULL; m_faceName = (char *) NULL;
@@ -128,8 +113,11 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
M_FONTDATA->m_fontId = FontIdOrFamily; M_FONTDATA->m_fontId = FontIdOrFamily;
M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily ); M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
} }
if (Style == wxDEFAULT) Style = wxSWISS;
M_FONTDATA->m_style = Style; M_FONTDATA->m_style = Style;
if (Weight == wxDEFAULT) Weight = wxNORMAL;
M_FONTDATA->m_weight = Weight; M_FONTDATA->m_weight = Weight;
if (PointSize == wxDEFAULT) PointSize = 10;
M_FONTDATA->m_pointSize = PointSize; M_FONTDATA->m_pointSize = PointSize;
M_FONTDATA->m_underlined = Underlined; M_FONTDATA->m_underlined = Underlined;
@@ -189,106 +177,120 @@ bool wxFont::operator != ( const wxFont& font )
return m_refData != font.m_refData; return m_refData != font.m_refData;
} }
bool wxFont::Ok() bool wxFont::Ok() const
{ {
return (m_refData != NULL); if (!m_refData)
{
wxFAIL_MSG( "invalid font" );
return FALSE;
}
else
return TRUE;
} }
int wxFont::GetPointSize(void) const int wxFont::GetPointSize(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_pointSize; return M_FONTDATA->m_pointSize;
} }
wxString wxFont::GetFaceString(void) const wxString wxFont::GetFaceString(void) const
{ {
if (!Ok()) return "";
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
} }
wxString wxFont::GetFaceName(void) const wxString wxFont::GetFaceName(void) const
{ {
if (!Ok()) return "";
wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
} }
int wxFont::GetFamily(void) const int wxFont::GetFamily(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_family; return M_FONTDATA->m_family;
} }
wxString wxFont::GetFamilyString(void) const wxString wxFont::GetFamilyString(void) const
{ {
wxString s = wx_font_family[M_FONTDATA->m_family - wxDEFAULT]; if (!Ok()) return "wxDEFAULT";
return s;
switch (M_FONTDATA->m_family)
{
case wxDECORATIVE: return wxString("wxDECORATIVE");
case wxROMAN: return wxString("wxROMAN");
case wxSCRIPT: return wxString("wxSCRIPT");
case wxSWISS: return wxString("wxSWISS");
case wxMODERN: return wxString("wxMODERN");
case wxTELETYPE: return wxString("wxTELETYPE");
default: return "wxDEFAULT";
}
return "wxDEFAULT";
} }
int wxFont::GetFontId(void) const int wxFont::GetFontId(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_fontId; // stub return M_FONTDATA->m_fontId; // stub
} }
int wxFont::GetStyle(void) const int wxFont::GetStyle(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_style; return M_FONTDATA->m_style;
} }
wxString wxFont::GetStyleString(void) const wxString wxFont::GetStyleString(void) const
{ {
if (!Ok()) return "wxDEFAULT";
switch (M_FONTDATA->m_style) switch (M_FONTDATA->m_style)
{ {
case wxNORMAL: case wxNORMAL: return wxString("wxNORMAL");
{ case wxSLANT: return wxString("wxSLANT");
return wxString("wxNORMAL"); case wxITALIC: return wxString("wxITALIC");
} default: return wxString("wxDEFAULT");
case wxSLANT:
{
return wxString("wxSLANT");
}
case wxITALIC:
{
return wxString("wxITALIC");
}
case wxDEFAULT:
default:
{
return wxString("wxDEFAULT");
}
} }
return wxString("wxDEFAULT"); return wxString("wxDEFAULT");
} }
int wxFont::GetWeight(void) const int wxFont::GetWeight(void) const
{ {
if (!Ok()) return 0;
return M_FONTDATA->m_weight; return M_FONTDATA->m_weight;
} }
wxString wxFont::GetWeightString(void) const wxString wxFont::GetWeightString(void) const
{ {
if (!Ok()) return "wxDEFAULT";
switch (M_FONTDATA->m_weight) switch (M_FONTDATA->m_weight)
{ {
case wxNORMAL: case wxNORMAL: return wxString("wxNORMAL");
{ case wxBOLD: return wxString("wxBOLD");
return wxString("wxNORMAL"); case wxLIGHT: return wxString("wxLIGHT");
} default: return wxString("wxDEFAULT");
case wxBOLD:
{
return wxString("wxBOLD");
}
case wxLIGHT:
{
return wxString("wxLIGHT");
}
case wxDEFAULT:
default:
{
return wxString("wxDEFAULT");
}
} }
return wxString("wxDEFAULT"); return wxString("wxDEFAULT");
} }
bool wxFont::GetUnderlined(void) const bool wxFont::GetUnderlined(void) const
{ {
if (!Ok()) return FALSE;
return M_FONTDATA->m_underlined; return M_FONTDATA->m_underlined;
} }

View File

@@ -85,7 +85,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
m_list = GTK_LIST( gtk_list_new() ); m_list = GTK_LIST( gtk_list_new() );
GtkSelectionMode mode = GTK_SELECTION_SINGLE; GtkSelectionMode mode = GTK_SELECTION_BROWSE;
if (style & wxLB_MULTIPLE) if (style & wxLB_MULTIPLE)
mode = GTK_SELECTION_MULTIPLE; mode = GTK_SELECTION_MULTIPLE;
else if (style & wxLB_EXTENDED) else if (style & wxLB_EXTENDED)
@@ -96,6 +96,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
gtk_container_add (GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) ); gtk_container_add (GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) );
gtk_widget_show( GTK_WIDGET(m_list) ); gtk_widget_show( GTK_WIDGET(m_list) );
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 100;
if (newSize.y == -1) newSize.y = 110;
SetSize( newSize.x, newSize.y );
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
GtkWidget *list_item; GtkWidget *list_item;
@@ -222,21 +227,14 @@ char *wxListBox::GetClientData( int n ) const
int wxListBox::GetSelection(void) const int wxListBox::GetSelection(void) const
{ {
GList *selection = m_list->selection;
if (selection)
{
GList *child = m_list->children; GList *child = m_list->children;
int count = 0; int count = 0;
while (child) while (child)
{ {
if (child->data == selection->data) return count; if (GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED) return count;
count++; count++;
child = child->next; child = child->next;
} }
}
// No, I think it's reasonable to return -1 to indicate
// there is no selection. -- JACS
// wxFAIL_MSG("wrong listbox index");
return -1; return -1;
} }

View File

@@ -80,15 +80,11 @@ int wxDisplayDepth(void)
// user and home routines // user and home routines
//------------------------------------------------------------------------ //------------------------------------------------------------------------
char* wxGetHomeDir( char *dest ) const char* wxGetHomeDir( wxString *home )
{ {
wxString tmp = wxGetUserHome( wxString() ); *home = wxGetUserHome( wxString() );
if (tmp.IsNull()) if (home->IsNull()) *home = "/";
strcpy( wxBuffer, "/" ); return *home;
else
strcpy( wxBuffer, tmp );
if (dest) strcpy( dest, WXSTRINGCAST tmp );
return wxBuffer;
}; };
char *wxGetUserHome( const wxString &user ) char *wxGetUserHome( const wxString &user )

View File

@@ -116,6 +116,7 @@
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
extern wxList wxTopLevelWindows; extern wxList wxTopLevelWindows;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
wxWindow *g_captureWindow = (wxWindow*)NULL;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "expose_event" (of m_wxwindow, not of m_widget) // "expose_event" (of m_wxwindow, not of m_widget)
@@ -299,6 +300,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
{ {
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow) if (win->m_wxwindow)
@@ -403,6 +406,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{ {
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE; if (!win->HasVMT()) return TRUE;
@@ -469,6 +475,9 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win ) static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{ {
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE; if (!win->HasVMT()) return TRUE;
@@ -599,7 +608,11 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE; if (!win->HasVMT()) return TRUE;
if (widget->window) if (widget->window)
@@ -621,9 +634,13 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (!win->HasVMT()) return TRUE;
if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
if (widget->window) if (widget->window)
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
@@ -1981,6 +1998,7 @@ void wxWindow::CaptureMouse(void)
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_captureWindow = this;
} }
void wxWindow::ReleaseMouse(void) void wxWindow::ReleaseMouse(void)
@@ -1988,6 +2006,7 @@ void wxWindow::ReleaseMouse(void)
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
gtk_grab_remove( connect_widget ); gtk_grab_remove( connect_widget );
gdk_pointer_ungrab ( GDK_CURRENT_TIME ); gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_captureWindow = (wxWindow*) NULL;;
} }
void wxWindow::SetTitle( const wxString &WXUNUSED(title) ) void wxWindow::SetTitle( const wxString &WXUNUSED(title) )

View File

@@ -371,6 +371,7 @@ void wxResourceEditorDialogHandler::OnItemEvent(wxControl *item, wxMouseEvent& e
event.m_x = event.m_x + x; event.m_x = event.m_x + x;
event.m_y = event.m_y + y; event.m_y = event.m_y + y;
ProcessItemEvent(item, event, dragType); ProcessItemEvent(item, event, dragType);
} }
@@ -378,6 +379,8 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
{ {
wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
if (dragItem) childHandler = (wxResourceEditorControlHandler *)dragItem->GetEventHandler();
long x, y; long x, y;
event.Position(&x, &y); event.Position(&x, &y);
int keys = 0; int keys = 0;

View File

@@ -150,13 +150,8 @@ bool wxResourceManager::Initialize()
strcat(buf, "\\dialoged.ini"); strcat(buf, "\\dialoged.ini");
m_optionsResourceFilename = buf; m_optionsResourceFilename = buf;
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
/* wxGetHomeDir( &m_optionsResourceFilename );
wxString buf; m_optionsResourceFilename += "/.dialogedrc";
wxGetHomeDir(&buf);
buf += "/.dialogedrc";
m_optionsResourceFilename = buf;
*/
m_optionsResourceFilename = ".dialoged.rc";
#else #else
#error "Unsupported platform." #error "Unsupported platform."
#endif #endif