2 CLASS(XonoticScreenshotViewerDialog) EXTENDS(XonoticRootDialog)
3 METHOD(XonoticScreenshotViewerDialog, fill, void(entity))
4 METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float))
5 METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string))
6 ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
7 ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
8 ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
9 ATTRIB(XonoticScreenshotViewerDialog, columns, float, 6.5)
10 ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
11 ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_MULTIPLAYER)
12 ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
13 ATTRIB(XonoticScreenshotViewerDialog, titleLabel, entity, NULL)
15 ATTRIB(XonoticScreenshotViewerDialog, currentScrName, string, string_null)
16 ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
17 ENDCLASS(XonoticScreenshotViewerDialog)
21 void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
23 if (me.currentScrPath)
24 strunzone(me.currentScrPath);
25 me.currentScrPath = strzone(scrImage);
26 me.screenshotImage.configureImage(me.screenshotImage, me.currentScrPath);
27 me.screenshotImage.updateAspect(me.screenshotImage);
29 if (me.currentScrName)
30 strunzone(me.currentScrName);
31 me.currentScrName = strzone(substring(scrImage, 13, strlen(scrImage) - 13));
32 me.titleLabel.setText(me.titleLabel, me.currentScrName);
34 void prevScreenshot_Click(entity btn, entity me)
36 me.scrList.goScreenshot(me.scrList, -1);
38 void nextScreenshot_Click(entity btn, entity me)
40 me.scrList.goScreenshot(me.scrList, +1);
43 float XonoticScreenshotViewerDialog_keyDown(entity me, float key, float ascii, float shift)
49 me.scrList.goScreenshot(me.scrList, -1);
53 me.scrList.goScreenshot(me.scrList, +1);
56 if (me.scrList.keyDown(me.scrList, key, ascii, shift))
58 // keyDown has already changed the selected item
59 me.scrList.goScreenshot(me.scrList, 0);
62 return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
65 void XonoticScreenshotViewerDialog_fill(entity me)
70 me.TD(me, me.rows - 1, me.columns, e = makeXonoticImage(string_null, -1));
71 me.screenshotImage = e;
72 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
74 me.gotoRC(me, me.rows - 1, 0);
75 me.TD(me, 1, me.columns/2, e = makeXonoticButton("Previous", '0 0 0'));
76 e.onClick = prevScreenshot_Click;
78 me.TD(me, 1, me.columns/2, e = makeXonoticButton("Next", '0 0 0'));
79 e.onClick = nextScreenshot_Click;