r3208 - software/ui/src
Miriam Ruiz
baby-guest at alioth.debian.org
Tue Jul 3 19:16:48 UTC 2007
Author: baby-guest
Date: 2007-07-03 19:16:48 +0000 (Tue, 03 Jul 2007)
New Revision: 3208
Added:
software/ui/src/windows.cpp
software/ui/src/windows.h
Modified:
software/ui/src/Makefile.am
software/ui/src/common.h
software/ui/src/pkgbrowser.h
software/ui/src/ui.fld
Log:
Make the layout behave properly when resizing the window
Modified: software/ui/src/Makefile.am
===================================================================
--- software/ui/src/Makefile.am 2007-07-03 19:11:42 UTC (rev 3207)
+++ software/ui/src/Makefile.am 2007-07-03 19:16:48 UTC (rev 3208)
@@ -8,6 +8,7 @@
Engine.cpp \
ui.cpp \
pkgbrowser.cpp \
+ windows.cpp \
games.cpp
games_LDFLAGS = $(LIBEPT_LIBS) `fltk-config --ldflags --use-images`
Modified: software/ui/src/common.h
===================================================================
--- software/ui/src/common.h 2007-07-03 19:11:42 UTC (rev 3207)
+++ software/ui/src/common.h 2007-07-03 19:16:48 UTC (rev 3208)
@@ -17,8 +17,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef common_ui
-#define common_ui
+#ifndef _games_common_h
+#define _games_common_h
#include "config.h"
Modified: software/ui/src/pkgbrowser.h
===================================================================
--- software/ui/src/pkgbrowser.h 2007-07-03 19:11:42 UTC (rev 3207)
+++ software/ui/src/pkgbrowser.h 2007-07-03 19:16:48 UTC (rev 3208)
@@ -20,8 +20,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef pkgbrowser_h
-#define pkgbrowser_h
+#ifndef _games_pkgbrowser_h
+#define _games_pkgbrowser_h
#include <stdlib.h>
Modified: software/ui/src/ui.fld
===================================================================
--- software/ui/src/ui.fld 2007-07-03 19:11:42 UTC (rev 3207)
+++ software/ui/src/ui.fld 2007-07-03 19:16:48 UTC (rev 3208)
@@ -11,6 +11,9 @@
decl {\#include "pkgbrowser.h"} {public
}
+decl {\#include "windows.h"} {public
+}
+
class GamesUI {open
} {
Function {GamesUI()} {open
@@ -27,6 +30,32 @@
if (InfoTextBuffer)
delete InfoTextBuffer;} {}
}
+ Function {Resize(int w, int h)} {open return_type void
+ } {
+ code {static const int border = 6;
+static const int vgap = 4;
+static const int hgap = 6;
+
+if (w < 710) w = 710;
+if (h < 500) h = 500;
+
+int x_ref = w - 320 - border;
+int h_info_tags = (h - 240 - border * 2 - vgap * 2);
+int h_info = h_info_tags * 2 / 3;
+int h_tags = h_info_tags - h_info;
+
+if (InputGroup)
+ InputGroup->resize(border, border, x_ref - border - hgap, 120);
+if (ResultsBrowser)
+ ResultsBrowser->resize(border, 120 + border + vgap, x_ref - border - hgap, h - 120 - border * 2 - vgap);
+
+if (ScreenshotWidget)
+ ScreenshotWidget->resize(x_ref, border, 320, 240);
+if (InfoText)
+ InfoText->resize(x_ref, border + 240 + vgap, 320, h_info);
+if (DebTagsBrowser)
+ DebTagsBrowser->resize(x_ref, border + 240 + h_info + vgap * 2, 320, h_tags);} {}
+ }
Function {Screenshot(Fl_Image *img)} {open return_type void
} {
code {Fl_Image *i=ScreenshotWidget->image();
@@ -47,67 +76,56 @@
Function {CreateMainWindow()} {open
} {
Fl_Window {} {open
- xywh {551 58 710 525} type Double resizable visible
+ xywh {551 58 710 525} type Single resizable
+ class MainWindow visible
} {
- Fl_Group {} {open
+ Fl_Group InputGroup {open
xywh {5 15 375 119} box UP_FRAME
} {
- Fl_Tile {} {open
- xywh {10 15 370 36} align 0
- } {
- Fl_Check_Button AlreadyInstalledButton {
- label {Already installed}
- xywh {14 15 25 36} down_box DOWN_BOX labelsize 12
- }
- Fl_Check_Button ToBeInstalledButton {
- label {To be installed}
- xywh {195 15 25 36} down_box DOWN_BOX labelsize 12
- }
+ Fl_Check_Button AlreadyInstalledButton {
+ label {Already installed}
+ xywh {19 20 25 36} down_box DOWN_BOX labelsize 12
}
- Fl_Input SearchInput {
- label Search
- xywh {65 95 300 25} labelsize 12
+ Fl_Check_Button ToBeInstalledButton {
+ label {To be installed}
+ xywh {200 20 25 36} down_box DOWN_BOX labelsize 12
}
- }
- Fl_Browser ResultsBrowser {
- xywh {5 140 375 375} type Select align 0 textsize 12 resizable
- class PackageBrowser
- }
- Fl_Tile {} {open
- xywh {10 50 360 35} labelsize 10 align 0
- } {
Fl_Choice TypeSelection {
label Type open
- xywh {60 55 120 25} down_box BORDER_BOX labelsize 12 when 1
+ xywh {70 60 120 25} down_box BORDER_BOX labelsize 12 when 1
} {
MenuItem {} {
label {Any type}
- xywh {15 15 100 20}
+ xywh {25 25 100 20}
}
}
Fl_Choice InterfaceSelection {
label Interface open
- xywh {250 55 115 25} down_box BORDER_BOX labelsize 12
+ xywh {260 60 115 25} down_box BORDER_BOX labelsize 12
} {
MenuItem {} {
label {Any interface}
- xywh {15 15 100 20}
+ xywh {25 25 100 20}
}
}
+ Fl_Input SearchInput {
+ label Search
+ xywh {65 95 300 25} labelsize 12
+ }
}
- Fl_Button ScreenshotWidget {selected
+ Fl_Button ScreenshotWidget {
xywh {385 15 320 240} box FLAT_BOX color 32 selection_color 32
}
- Fl_Group {} {open
- xywh {385 260 320 255}
- } {
- Fl_Text_Display InfoText {
- xywh {385 260 320 170} align 0 textsize 12
- }
- Fl_Browser DebTagsBrowser {
- xywh {385 435 320 80} align 0 textsize 11
- }
+ Fl_Browser ResultsBrowser {selected
+ xywh {5 140 375 375} type Select align 0 textsize 12
+ class PackageBrowser
}
+ Fl_Text_Display InfoText {
+ xywh {385 260 320 170} align 0 textsize 12
+ }
+ Fl_Browser DebTagsBrowser {
+ xywh {385 435 320 80} align 0 textsize 11
+ }
}
}
decl {Engine *engine;} {public
Added: software/ui/src/windows.cpp
===================================================================
--- software/ui/src/windows.cpp (rev 0)
+++ software/ui/src/windows.cpp 2007-07-03 19:16:48 UTC (rev 3208)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2007 Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "windows.h"
+#include "ui.h"
+
+#include <stdio.h>
+
+MainWindow::MainWindow(int w, int h, const char *label) : Fl_Double_Window(w, h, label)
+{
+}
+
+MainWindow::MainWindow(int x, int y, int w, int h, const char *label) : Fl_Double_Window(x, y, w, h, label)
+{
+}
+
+void MainWindow::resize(int x, int y, int w, int h)
+{
+ Fl_Double_Window::resize(x, y, w, h);
+ Fl_Group *highest_parent=this;
+ while (highest_parent->parent()) highest_parent = highest_parent->parent();
+ GamesUI *ui = highest_parent ? (GamesUI*)(highest_parent->user_data()) : NULL;
+ ui->Resize(Fl_Double_Window::w(), Fl_Double_Window::h());
+}
Added: software/ui/src/windows.h
===================================================================
--- software/ui/src/windows.h (rev 0)
+++ software/ui/src/windows.h 2007-07-03 19:16:48 UTC (rev 3208)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2007 Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _games_windows_h
+#define _games_windows_h
+
+#include <FL/Fl.H>
+#include <FL/Fl_Double_Window.H>
+
+class MainWindow : public Fl_Double_Window
+{
+public:
+ MainWindow(int w, int h, const char *label = 0);
+ MainWindow(int x, int y, int w, int h, const char *label = 0);
+
+ virtual void resize(int x, int y, int w, int h);
+
+private:
+};
+
+#endif
More information about the Pkg-games-commits
mailing list