diff options
author | nyamatongwe <unknown> | 2002-07-07 10:11:57 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2002-07-07 10:11:57 +0000 |
commit | 58845334f127de4431a8b5bbde8056b28bf6fa2f (patch) | |
tree | 75551c135f8808c8acf4b0dec6c7e0fef582cc0f | |
parent | 044a950d8e4ef7a211fb9e64ab3f53721999136e (diff) | |
download | scintilla-mirror-58845334f127de4431a8b5bbde8056b28bf6fa2f.tar.gz |
Made compatible with either GTK+ 1.x or GTK+ 2.x.
-rw-r--r-- | gtk/PlatGTK.cxx | 22 | ||||
-rw-r--r-- | gtk/makefile | 10 |
2 files changed, 26 insertions, 6 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 8d3ad5437..5e6bdf48c 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -768,9 +768,8 @@ void ListBox::Create(Window &, int) { } void ListBox::SetFont(Font &scint_font) { - GtkStyle* style; - - style = gtk_widget_get_style(GTK_WIDGET(PWidget(list))); +#if GTK_MAJOR_VERSION < 2 + GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(PWidget(list))); if (!gdk_font_equal(style->font, PFont(scint_font))) { style = gtk_style_copy(style); gdk_font_unref(style->font); @@ -779,6 +778,16 @@ void ListBox::SetFont(Font &scint_font) { gtk_widget_set_style(GTK_WIDGET(PWidget(list)), style); gtk_style_unref(style); } +#else + GtkStyle *styleCurrent = gtk_widget_get_style(GTK_WIDGET(PWidget(list))); + GdkFont *fontCurrent = gtk_style_get_font(styleCurrent); + if (!gdk_font_equal(fontCurrent, PFont(scint_font))) { + GtkStyle *styleNew = gtk_style_copy(styleCurrent); + gtk_style_set_font(styleNew, PFont(scint_font)); + gtk_widget_set_style(GTK_WIDGET(PWidget(list)), styleNew); + gtk_style_unref(styleCurrent); + } +#endif } void ListBox::SetAverageCharWidth(int width) { @@ -800,10 +809,15 @@ PRectangle ListBox::GetDesiredRect() { GtkRequisition req; int height; +#if GTK_MAJOR_VERSION < 2 + int ythickness = PWidget(list)->style->klass->ythickness; +#else + int ythickness = PWidget(list)->style->ythickness; +#endif // First calculate height of the clist for our desired visible row count otherwise it tries to expand to the total # of rows height = (rows * GTK_CLIST(list)->row_height + rows + 1 - + 2 * (PWidget(list)->style->klass->ythickness + + 2 * (ythickness + GTK_CONTAINER(PWidget(list))->border_width)); gtk_widget_set_usize(GTK_WIDGET(PWidget(list)), -1, height); diff --git a/gtk/makefile b/gtk/makefile index 7312ad14d..5b7a3cf28 100644 --- a/gtk/makefile +++ b/gtk/makefile @@ -29,8 +29,14 @@ else CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) endif +ifdef GTK2 +CONFIGFLAGS=pkg-config --cflags gtk+-2.0 +else +CONFIGFLAGS=gtk-config --cflags +endif + .cxx.o: - $(CC) `gtk-config --cflags` $(CXXFLAGS) -c $< + $(CC) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $< #++Autogenerated -- run src/LexGen.py to regenerate #**LEXOBJS=\\\n\(\*.o \) @@ -48,7 +54,7 @@ clean: rm -f *.o $(COMPLIB) deps: - $(CC) -MM `gtk-config --cflags` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak + $(CC) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak $(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o Document.o CallTip.o \ ScintillaBase.o ContractionState.o Editor.o PropSet.o PlatGTK.o \ |