r3277 - software/ui/src

Miriam Ruiz baby-guest at alioth.debian.org
Sat Jul 7 22:26:37 UTC 2007


Author: baby-guest
Date: 2007-07-07 22:26:37 +0000 (Sat, 07 Jul 2007)
New Revision: 3277

Modified:
   software/ui/src/aux.cpp
   software/ui/src/aux.h
   software/ui/src/ui.fld
Log:
About Star shall be always printed above



Modified: software/ui/src/aux.cpp
===================================================================
--- software/ui/src/aux.cpp	2007-07-07 21:12:37 UTC (rev 3276)
+++ software/ui/src/aux.cpp	2007-07-07 22:26:37 UTC (rev 3277)
@@ -31,6 +31,9 @@
 
 #include <string>
 
+#include <FL/Fl.H>
+#include <FL/Fl_Help_View.H>
+
 bool HTMLView::ExternalBrowser(const char *uri)
 {
 	pid_t pid = -1;
@@ -53,21 +56,32 @@
 	exit(1); /* This point should never be reached */
 }
 
-HTMLView::HTMLView(int xx, int yy, int ww, int hh, const char *l) : Fl_Help_View(xx, yy, ww, hh, l)
+HTMLView::HTMLView(int xx, int yy, int ww, int hh, const char *l) : Fl_Help_View(xx, yy, ww, hh, l), draw_cb(NULL)
 {
 	link(HTMLView::link_cb);
 }
 
+HTMLView::~HTMLView()
+{
+}
+
 const char *HTMLView::link_cb(Fl_Widget *w, const char *uri)
 {
+	HTMLView *html_view = (HTMLView *)w;
 	printf("PackageView::link_cb(): Widget=0x%lX, URI=\"%s\"\n", (unsigned long)w, uri);
 
-	if (!strncasecmp("http:", uri, 5) || !strncasecmp("mailto:", uri, 7) ||
-		!strncasecmp("ftp:", uri, 4) || !strncasecmp("https:", uri, 6))
+	if (html_view->draw_cb) html_view->draw_cb(html_view);
+
+	if (!strncasecmp("http:", uri, 5) || !strncasecmp("ftp:", uri, 4) || !strncasecmp("https:", uri, 6))
 	{
 		HTMLView::ExternalBrowser(uri);
 		return NULL;
 	}
 
+	if (!strncasecmp("mailto:", uri, 7))
+	{
+		return NULL;
+	}
+
 	return uri;
 }

Modified: software/ui/src/aux.h
===================================================================
--- software/ui/src/aux.h	2007-07-07 21:12:37 UTC (rev 3276)
+++ software/ui/src/aux.h	2007-07-07 22:26:37 UTC (rev 3277)
@@ -26,11 +26,17 @@
 {
 public:
 	HTMLView(int xx, int yy, int ww, int hh, const char *l = 0);
+	~HTMLView();
 
 	static bool ExternalBrowser(const char *uri);
 
+	typedef void DrawCallback(HTMLView *html_view);
+	inline void SetDrawCallback(DrawCallback *function) { draw_cb = function;}
+
 private:
 	static const char *link_cb(Fl_Widget *w, const char *uri);
+
+	DrawCallback *draw_cb;
 };
 
 #endif

Modified: software/ui/src/ui.fld
===================================================================
--- software/ui/src/ui.fld	2007-07-07 21:12:37 UTC (rev 3276)
+++ software/ui/src/ui.fld	2007-07-07 22:26:37 UTC (rev 3277)
@@ -8,7 +8,7 @@
 decl {class Engine;} {public
 } 
 
-decl {\#include "common.h"} {selected public
+decl {\#include "common.h"} {public
 } 
 
 decl {\#include "aux.h"} {public
@@ -144,17 +144,18 @@
   Function {CreateAboutWindow()} {open
   } {
     Fl_Window AboutWindow {open
-      xywh {727 534 520 430} type Double visible
+      xywh {717 505 520 430} type Double visible
     } {
       Fl_Help_View AboutView {
         xywh {5 75 510 350}
         class HTMLView
       }
-      Fl_Button {} {
-        image {../data/icons/Rating.png} xywh {400 5 90 90} box NO_BOX deactivate
+      Fl_Button AboutStar {
+        private image {../data/icons/Rating.png} xywh {400 5 90 90} box NO_BOX deactivate
       }
     }
     code {AboutWindow->clear_visible_focus();} {}
+    code {AboutView->SetDrawCallback(AboutViewUpdated);} {}
   }
   Function {CreateWindows()} {open return_type {MainWindow *}
   } {
@@ -162,4 +163,12 @@
 CreateAboutWindow();
 return Window;} {}
   }
+  Function {AboutViewUpdated(HTMLView *item)} {open return_type {static void}
+  } {
+    code {Fl_Group *highest_parent=item->parent();
+while (highest_parent->parent()) highest_parent = highest_parent->parent();
+GamesUI *ui = highest_parent ? (GamesUI*)(highest_parent->user_data()) : NULL;
+ui->AboutStar->redraw();} {selected
+    }
+  }
 } 




More information about the Pkg-games-commits mailing list