diff options
Diffstat (limited to 'gtk/PlatGTK.cxx')
-rw-r--r-- | gtk/PlatGTK.cxx | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 9bc207896..2109c4d62 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -173,8 +173,8 @@ static FontHandle *PFont(Font &f) { return reinterpret_cast<FontHandle *>(f.GetID()); } -static GtkWidget *PWidget(WindowID id) { - return reinterpret_cast<GtkWidget *>(id); +static GtkWidget *PWidget(WindowID wid) { + return reinterpret_cast<GtkWidget *>(wid); } static GtkWidget *PWidget(Window &w) { @@ -421,7 +421,7 @@ class FontCached : Font { static FontCached *first; public: static FontID FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); - static void ReleaseId(FontID id_); + static void ReleaseId(FontID fid_); }; FontCached *FontCached::first = 0; @@ -430,7 +430,7 @@ FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool next(0), usage(0), hash(0) { ::SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_); hash = HashFont(faceName_, characterSet_, size_, bold_, italic_); - id = CreateNewFont(faceName_, characterSet_, size_, bold_, italic_); + fid = CreateNewFont(faceName_, characterSet_, size_, bold_, italic_); usage = 1; } @@ -444,9 +444,9 @@ bool FontCached::SameAs(const char *faceName_, int characterSet_, int size_, boo } void FontCached::Release() { - if (id) + if (fid) delete PFont(*this); - id = 0; + fid = 0; } FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) { @@ -457,7 +457,7 @@ FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, int si if ((cur->hash == hashFind) && cur->SameAs(faceName_, characterSet_, size_, bold_, italic_)) { cur->usage++; - ret = cur->id; + ret = cur->fid; } } if (ret == 0) { @@ -465,18 +465,18 @@ FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, int si if (fc) { fc->next = first; first = fc; - ret = fc->id; + ret = fc->fid; } } FontMutexUnlock(); return ret; } -void FontCached::ReleaseId(FontID id_) { +void FontCached::ReleaseId(FontID fid_) { FontMutexLock(); FontCached **pcur = &first; for (FontCached *cur = first; cur; cur = cur->next) { - if (cur->id == id_) { + if (cur->fid == fid_) { cur->usage--; if (cur->usage == 0) { *pcur = cur->next; @@ -661,20 +661,20 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet, return new FontHandle(newid); } -Font::Font() : id(0) {} +Font::Font() : fid(0) {} Font::~Font() {} void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic, bool) { Release(); - id = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic); + fid = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic); } void Font::Release() { - if (id) - FontCached::ReleaseId(id); - id = 0; + if (fid) + FontCached::ReleaseId(fid); + fid = 0; } // Required on OS X @@ -1735,24 +1735,24 @@ Surface *Surface::Allocate() { Window::~Window() {} void Window::Destroy() { - if (id) - gtk_widget_destroy(GTK_WIDGET(id)); - id = 0; + if (wid) + gtk_widget_destroy(GTK_WIDGET(wid)); + wid = 0; } bool Window::HasFocus() { - return GTK_WIDGET_HAS_FOCUS(id); + return GTK_WIDGET_HAS_FOCUS(wid); } PRectangle Window::GetPosition() { // Before any size allocated pretend its 1000 wide so not scrolled PRectangle rc(0, 0, 1000, 1000); - if (id) { - rc.left = PWidget(id)->allocation.x; - rc.top = PWidget(id)->allocation.y; - if (PWidget(id)->allocation.width > 20) { - rc.right = rc.left + PWidget(id)->allocation.width; - rc.bottom = rc.top + PWidget(id)->allocation.height; + if (wid) { + rc.left = PWidget(wid)->allocation.x; + rc.top = PWidget(wid)->allocation.y; + if (PWidget(wid)->allocation.width > 20) { + rc.right = rc.left + PWidget(wid)->allocation.width; + rc.bottom = rc.top + PWidget(wid)->allocation.height; } } return rc; @@ -1765,18 +1765,18 @@ void Window::SetPosition(PRectangle rc) { alloc.y = rc.top; alloc.width = rc.Width(); alloc.height = rc.Height(); - gtk_widget_size_allocate(PWidget(id), &alloc); + gtk_widget_size_allocate(PWidget(wid), &alloc); #else - gtk_widget_set_uposition(id, rc.left, rc.top); - gtk_widget_set_usize(id, rc.right - rc.left, rc.bottom - rc.top); + gtk_widget_set_uposition(wid, rc.left, rc.top); + gtk_widget_set_usize(wid, rc.right - rc.left, rc.bottom - rc.top); #endif } void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { int ox = 0; int oy = 0; - gdk_window_get_origin(PWidget(relativeTo.id)->window, &ox, &oy); + gdk_window_get_origin(PWidget(relativeTo.wid)->window, &ox, &oy); ox += rc.left; if (ox < 0) ox = 0; @@ -1797,9 +1797,9 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { oy = screenHeight - sizey; #if GTK_MAJOR_VERSION >= 2 - gtk_window_move(GTK_WINDOW(PWidget(id)), ox, oy); + gtk_window_move(GTK_WINDOW(PWidget(wid)), ox, oy); #else - gtk_widget_set_uposition(PWidget(id), ox, oy); + gtk_widget_set_uposition(PWidget(wid), ox, oy); #endif #if 0 @@ -1809,9 +1809,9 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { alloc.y = rc.top + oy; alloc.width = rc.right - rc.left; alloc.height = rc.bottom - rc.top; - gtk_widget_size_allocate(id, &alloc); + gtk_widget_size_allocate(wid, &alloc); #endif - gtk_widget_set_usize(PWidget(id), sizex, sizey); + gtk_widget_set_usize(PWidget(wid), sizex, sizey); } PRectangle Window::GetClientPosition() { @@ -1821,18 +1821,18 @@ PRectangle Window::GetClientPosition() { void Window::Show(bool show) { if (show) - gtk_widget_show(PWidget(id)); + gtk_widget_show(PWidget(wid)); } void Window::InvalidateAll() { - if (id) { - gtk_widget_queue_draw(PWidget(id)); + if (wid) { + gtk_widget_queue_draw(PWidget(wid)); } } void Window::InvalidateRectangle(PRectangle rc) { - if (id) { - gtk_widget_queue_draw_area(PWidget(id), + if (wid) { + gtk_widget_queue_draw_area(PWidget(wid), rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); } @@ -1875,13 +1875,13 @@ void Window::SetCursor(Cursor curs) { break; } - if (PWidget(id)->window) - gdk_window_set_cursor(PWidget(id)->window, gdkCurs); + if (PWidget(wid)->window) + gdk_window_set_cursor(PWidget(wid)->window, gdkCurs); gdk_cursor_destroy(gdkCurs); } void Window::SetTitle(const char *s) { - gtk_window_set_title(GTK_WINDOW(id), s); + gtk_window_set_title(GTK_WINDOW(wid), s); } /* Returns rectangle of monitor pt is on, both rect and pt are in Window's @@ -1890,7 +1890,7 @@ PRectangle Window::GetMonitorRect(Point pt) { gint x_offset, y_offset; pt = pt; - gdk_window_get_origin(PWidget(id)->window, &x_offset, &y_offset); + gdk_window_get_origin(PWidget(wid)->window, &x_offset, &y_offset); // gtk 2.2+ #if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 2) @@ -1899,7 +1899,7 @@ PRectangle Window::GetMonitorRect(Point pt) { gint monitor_num; GdkRectangle rect; - screen = gtk_widget_get_screen(PWidget(id)); + screen = gtk_widget_get_screen(PWidget(wid)); monitor_num = gdk_screen_get_monitor_at_point(screen, pt.x + x_offset, pt.y + y_offset); gdk_screen_get_monitor_geometry(screen, monitor_num, &rect); rect.x -= x_offset; @@ -2060,7 +2060,7 @@ static void StyleSet(GtkWidget *w, GtkStyle*, void*) { #endif void ListBoxX::Create(Window &, int, Point, int, bool) { - id = gtk_window_new(GTK_WINDOW_POPUP); + wid = gtk_window_new(GTK_WINDOW_POPUP); GtkWidget *frame = gtk_frame_new(NULL); gtk_widget_show(frame); @@ -2129,7 +2129,7 @@ void ListBoxX::Create(Window &, int, Point, int, bool) { g_signal_connect(G_OBJECT(wid), "button_press_event", G_CALLBACK(ButtonPress), this); #endif - gtk_widget_realize(PWidget(id)); + gtk_widget_realize(PWidget(wid)); } void ListBoxX::SetFont(Font &scint_font) { @@ -2167,7 +2167,7 @@ int ListBoxX::GetVisibleRows() const { PRectangle ListBoxX::GetDesiredRect() { // Before any size allocated pretend its 100 wide so not scrolled PRectangle rc(0, 0, 100, 100); - if (id) { + if (wid) { int rows = Length(); if ((rows == 0) || (rows > desiredVisibleRows)) rows = desiredVisibleRows; @@ -2316,7 +2316,7 @@ void ListBoxX::Append(char *s, int type) { } int ListBoxX::Length() { - if (id) + if (wid) #if GTK_MAJOR_VERSION < 2 return GTK_CLIST(list)->rows; #else @@ -2538,27 +2538,27 @@ void ListBoxX::SetList(const char *listText, char separator, char typesep) { } } -Menu::Menu() : id(0) {} +Menu::Menu() : mid(0) {} void Menu::CreatePopUp() { Destroy(); - id = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL); + mid = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL); } void Menu::Destroy() { - if (id) + if (mid) #if GTK_MAJOR_VERSION < 2 - gtk_object_unref(GTK_OBJECT(id)); + gtk_object_unref(GTK_OBJECT(mid)); #else - g_object_unref(G_OBJECT(id)); + g_object_unref(G_OBJECT(mid)); #endif - id = 0; + mid = 0; } void Menu::Show(Point pt, Window &) { int screenHeight = gdk_screen_height(); int screenWidth = gdk_screen_width(); - GtkItemFactory *factory = reinterpret_cast<GtkItemFactory *>(id); + GtkItemFactory *factory = reinterpret_cast<GtkItemFactory *>(mid); GtkWidget *widget = gtk_item_factory_get_widget(factory, "<main>"); gtk_widget_show_all(widget); GtkRequisition requisition; |