ATTRIB(ListBox, itemHeight, float, 0)
ATTRIB(ListBox, colorBG, vector, '0 0 0')
ATTRIB(ListBox, alphaBG, float, 0)
+
+ ATTRIB(ListBox, lastClickedItem, float, -1)
+ ATTRIB(ListBox, lastClickedTime, float, 0)
+
METHOD(ListBox, drawListBoxItem, void(entity, float, vector, float)) // item number, width/height, selected
METHOD(ListBox, clickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
+ METHOD(ListBox, doubleClickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
METHOD(ListBox, setSelected, void(entity, float))
METHOD(ListBox, getLastFullyVisibleItemAtScrollPos, float(entity, float))
// and give it a nice click event
if(me.nItems > 0)
{
- me.clickListBoxItem(me, me.selectedItem, globalToBox(pos, eY * (me.getItemStart(me, me.selectedItem) - me.scrollPos), eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, me.selectedItem)));
+ vector where = globalToBox(pos, eY * (me.getItemStart(me, me.selectedItem) - me.scrollPos), eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, me.selectedItem));
+
+ if((me.selectedItem == me.lastClickedItem) && (time < me.lastClickedTime + 0.3))
+ me.doubleClickListBoxItem(me, me.selectedItem, where);
+ else
+ me.clickListBoxItem(me, me.selectedItem, where);
+
+ me.lastClickedItem = me.selectedItem;
+ me.lastClickedTime = time;
}
}
me.pressed = 0;
void ListBox_clickListBoxItem(entity me, float i, vector where)
{
- // itemclick, itemclick, does whatever itemclick does
+ // template method
+}
+
+void ListBox_doubleClickListBoxItem(entity me, float i, vector where)
+{
+ // template method
}
void ListBox_drawListBoxItem(entity me, float i, vector absSize, float selected)
ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
METHOD(XonoticCampaignList, draw, void(entity))
METHOD(XonoticCampaignList, drawListBoxItem, void(entity, float, vector, float))
- METHOD(XonoticCampaignList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticCampaignList, setSelected, void(entity, float))
METHOD(XonoticCampaignList, keyDown, float(entity, float, float, float))
ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0)
ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0)
- ATTRIB(XonoticCampaignList, lastClickedMap, float, -1)
- ATTRIB(XonoticCampaignList, lastClickedTime, float, 0)
-
ATTRIB(XonoticCampaignList, origin, vector, '0 0 0')
ATTRIB(XonoticCampaignList, itemAbsSize, vector, '0 0 0')
ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5)
rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
}
-void XonoticCampaignList_clickListBoxItem(entity me, float i, vector where)
+void XonoticCampaignList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedMap)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- // start game
- CampaignList_LoadMap(me, me);
- return;
- }
- me.lastClickedMap = i;
- me.lastClickedTime = time;
+ CampaignList_LoadMap(me, me);
}
void XonoticCampaignList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
{
METHOD(XonoticDemoList, startDemo, void(entity))
METHOD(XonoticDemoList, timeDemo, void(entity))
METHOD(XonoticDemoList, demoName, string(entity, float))
- METHOD(XonoticDemoList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticDemoList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticDemoList, keyDown, float(entity, float, float, float))
METHOD(XonoticDemoList, destroy, void(entity))
METHOD(XonoticDemoList, showNotify, void(entity))
ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
- ATTRIB(XonoticDemoList, lastClickedDemo, float, -1)
- ATTRIB(XonoticDemoList, lastClickedTime, float, 0)
ATTRIB(XonoticDemoList, filterString, string, string_null)
ENDCLASS(XonoticDemoList)
}
}
-void XonoticDemoList_clickListBoxItem(entity me, float i, vector where)
+void XonoticDemoList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedDemo)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- me.setSelected(me, i);
- DemoConfirm_ListClick_Check_Gamestatus(me);
- }
- me.lastClickedDemo = i;
- me.lastClickedTime = time;
+ DemoConfirm_ListClick_Check_Gamestatus(me);
}
float XonoticDemoList_keyDown(entity me, float scan, float ascii, float shift)
METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity))
ATTRIB(XonoticKeyBinder, rowsPerItem, float, 1)
METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, float, vector, float))
- METHOD(XonoticKeyBinder, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticKeyBinder, setSelected, void(entity, float))
METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float))
ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
- ATTRIB(XonoticKeyBinder, lastClickedKey, float, -1)
- ATTRIB(XonoticKeyBinder, lastClickedTime, float, 0)
ATTRIB(XonoticKeyBinder, previouslySelected, float, -1)
ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
cvar_set("_hud_showbinds_reload", "1");
}
-void XonoticKeyBinder_clickListBoxItem(entity me, float i, vector where)
+void XonoticKeyBinder_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedKey)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- KeyBinder_Bind_Change(NULL, me);
- }
- me.lastClickedKey = i;
- me.lastClickedTime = time;
+ KeyBinder_Bind_Change(NULL, me);
}
void XonoticKeyBinder_setSelected(entity me, float i)
{
ATTRIB(XonoticLanguageList, columnPercentageOrigin, float, 0)
ATTRIB(XonoticLanguageList, columnPercentageSize, float, 0)
- METHOD(XonoticLanguageList, clickListBoxItem, void(entity, float, vector)) // double click handling
+ METHOD(XonoticLanguageList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticLanguageList, keyDown, float(entity, float, float, float)) // enter handling
- ATTRIB(XonoticLanguageList, lastClickedLanguage, float, -1)
- ATTRIB(XonoticLanguageList, lastClickedTime, float, 0)
METHOD(XonoticLanguageList, destroy, void(entity))
cvar_set("_menu_prvm_language", me.languageParameter(me, me.selectedItem, LANGPARM_ID));
}
-void XonoticLanguageList_clickListBoxItem(entity me, float i, vector where)
+void XonoticLanguageList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedLanguage)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- me.setSelected(me, i);
- me.setLanguage(me);
- }
- me.lastClickedLanguage = i;
- me.lastClickedTime = time;
+ me.setLanguage(me);
}
float XonoticLanguageList_keyDown(entity me, float scan, float ascii, float shift)
METHOD(XonoticMapList, draw, void(entity))
METHOD(XonoticMapList, drawListBoxItem, void(entity, float, vector, float))
METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticMapList, refilter, void(entity))
METHOD(XonoticMapList, refilterCallback, void(entity, entity))
ATTRIB(XonoticMapList, realUpperMargin1, float, 0)
ATTRIB(XonoticMapList, realUpperMargin2, float, 0)
- ATTRIB(XonoticMapList, lastClickedMap, float, -1)
- ATTRIB(XonoticMapList, lastClickedTime, float, 0)
-
ATTRIB(XonoticMapList, lastGametype, float, 0)
ATTRIB(XonoticMapList, lastFeatures, float, 0)
if(where_x <= me.columnPreviewOrigin + me.columnPreviewSize)
if(where_x >= 0)
me.g_maplistCacheToggle(me, i);
+}
+void XonoticMapList_doubleClickListBoxItem(entity me, float i, vector where)
+{
if(where_x >= me.columnNameOrigin)
if(where_x <= 1)
{
- if(i == me.lastClickedMap)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- // pop up map info screen
- main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me);
- DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
- return;
- }
- me.lastClickedMap = i;
- me.lastClickedTime = time;
+ // pop up map info screen
+ main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me);
+ DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
}
}
METHOD(XonoticPlayList, startSound, void(entity, float))
METHOD(XonoticPlayList, resumeSound, void(entity))
METHOD(XonoticPlayList, pauseSound, void(entity))
- METHOD(XonoticPlayList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticPlayList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticPlayList, keyDown, float(entity, float, float, float))
METHOD(XonoticPlayList, mouseDrag, float(entity, vector))
ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
-
- ATTRIB(XonoticPlayList, lastClickedSound, float, -1)
- ATTRIB(XonoticPlayList, lastClickedTime, float, 0)
ENDCLASS(XonoticPlayList)
entity makeXonoticPlayList();
me.pauseSound(me);
}
-void XonoticPlayList_clickListBoxItem(entity me, float i, vector where)
+void XonoticPlayList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedSound)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- me.setSelected(me, i);
- me.startSound(me, 0);
- }
- me.lastClickedSound = i;
- me.lastClickedTime = time;
+ me.startSound(me, 0);
}
float XonoticPlayList_keyDown(entity me, float scan, float ascii, float shift)
METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
METHOD(XonoticScreenshotList, startScreenshot, void(entity))
METHOD(XonoticScreenshotList, screenshotName, string(entity, float))
- METHOD(XonoticScreenshotList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float))
METHOD(XonoticScreenshotList, destroy, void(entity))
METHOD(XonoticScreenshotList, showNotify, void(entity))
ATTRIB(XonoticScreenshotList, realUpperMargin, float, 0)
ATTRIB(XonoticScreenshotList, origin, vector, '0 0 0')
ATTRIB(XonoticScreenshotList, itemAbsSize, vector, '0 0 0')
- ATTRIB(XonoticScreenshotList, lastClickedScreenshot, float, -1)
- ATTRIB(XonoticScreenshotList, lastClickedTime, float, 0)
ATTRIB(XonoticScreenshotList, filterString, string, string_null)
ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
ATTRIB(XonoticScreenshotList, filterTime, float, 0)
me.startScreenshot(me);
}
-void XonoticScreenshotList_clickListBoxItem(entity me, float i, vector where)
+void XonoticScreenshotList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedScreenshot)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- // pop up screenshot
- me.setSelected(me, i);
- me.startScreenshot(me);
- }
- me.lastClickedScreenshot = i;
- me.lastClickedTime = time;
+ me.startScreenshot(me);
}
float XonoticScreenshotList_keyDown(entity me, float scan, float ascii, float shift)
ATTRIB(XonoticServerList, rowsPerItem, float, 1)
METHOD(XonoticServerList, draw, void(entity))
METHOD(XonoticServerList, drawListBoxItem, void(entity, float, vector, float))
- METHOD(XonoticServerList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticServerList, keyDown, float(entity, float, float, float))
METHOD(XonoticServerList, toggleFavorite, void(entity, string))
ATTRIB(XonoticServerList, infoButton, entity, NULL)
ATTRIB(XonoticServerList, currentSortOrder, float, 0)
ATTRIB(XonoticServerList, currentSortField, float, -1)
- ATTRIB(XonoticServerList, lastClickedServer, float, -1)
- ATTRIB(XonoticServerList, lastClickedTime, float, 0)
ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
{
if(gethostcachestring(SLIST_FIELD_CNAME, i) == me.selectedServer)
{
- if(i != me.selectedItem)
- {
- me.lastClickedServer = -1;
- me.selectedItem = i;
- }
+ me.selectedItem = i;
found = 1;
break;
}
vector sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size);
DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
}
-void XonoticServerList_clickListBoxItem(entity me, float i, vector where)
+void XonoticServerList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedServer)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- ServerList_Connect_Click(NULL, me);
- }
- me.lastClickedServer = i;
- me.lastClickedTime = time;
+ ServerList_Connect_Click(NULL, me);
}
void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
{
METHOD(XonoticSkinList, loadCvars, void(entity))
METHOD(XonoticSkinList, saveCvars, void(entity))
METHOD(XonoticSkinList, skinParameter, string(entity, float, float))
- METHOD(XonoticSkinList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticSkinList, keyDown, float(entity, float, float, float))
METHOD(XonoticSkinList, destroy, void(entity))
ATTRIB(XonoticSkinList, origin, vector, '0 0 0')
ATTRIB(XonoticSkinList, itemAbsSize, vector, '0 0 0')
- ATTRIB(XonoticSkinList, lastClickedSkin, float, -1)
- ATTRIB(XonoticSkinList, lastClickedTime, float, 0)
-
ATTRIB(XonoticSkinList, name, string, "skinselector")
ENDCLASS(XonoticSkinList)
me.setSkin(me);
}
-void XonoticSkinList_clickListBoxItem(entity me, float i, vector where)
+void XonoticSkinList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedSkin)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- me.setSelected(me, i);
- me.setSkin(me);
- }
- me.lastClickedSkin = i;
- me.lastClickedTime = time;
+ me.setSkin(me);
}
float XonoticSkinList_keyDown(entity me, float scan, float ascii, float shift)
METHOD(XonoticSoundList, drawListBoxItem, void(entity, float, vector, float))
METHOD(XonoticSoundList, getSounds, void(entity))
METHOD(XonoticSoundList, soundName, string(entity, float))
- METHOD(XonoticSoundList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticSoundList, keyDown, float(entity, float, float, float))
METHOD(XonoticSoundList, destroy, void(entity))
METHOD(XonoticSoundList, showNotify, void(entity))
ATTRIB(XonoticSoundList, origin, vector, '0 0 0')
ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
- ATTRIB(XonoticSoundList, lastClickedSound, float, -1)
- ATTRIB(XonoticSoundList, lastClickedTime, float, 0)
ATTRIB(XonoticSoundList, filterString, string, string_null)
ATTRIB(XonoticSoundList, playlist, entity, world)
ENDCLASS(XonoticSoundList)
me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
}
-void XonoticSoundList_clickListBoxItem(entity me, float i, vector where)
+void XonoticSoundList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedSound)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- me.setSelected(me, i);
- me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
- }
- me.lastClickedSound = i;
- me.lastClickedTime = time;
+ me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
}
float XonoticSoundList_keyDown(entity me, float scan, float ascii, float shift)
METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticStatsList, drawListBoxItem, void(entity, float, vector, float))
METHOD(XonoticStatsList, getStats, void(entity))
- METHOD(XonoticStatsList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticStatsList, keyDown, float(entity, float, float, float))
METHOD(XonoticStatsList, destroy, void(entity))
METHOD(XonoticStatsList, showNotify, void(entity))
ATTRIB(XonoticStatsList, realUpperMargin, float, 0)
ATTRIB(XonoticStatsList, columnNameOrigin, float, 0)
ATTRIB(XonoticStatsList, columnNameSize, float, 0)
-
- ATTRIB(XonoticStatsList, lastClickedDemo, float, -1)
- ATTRIB(XonoticStatsList, lastClickedTime, float, 0)
ENDCLASS(XonoticStatsList)
entity statslist; // for reference elsewhere
PlayerStats_PlayerDetail_CheckUpdate();
}
-void XonoticStatsList_clickListBoxItem(entity me, float i, vector where)
+void XonoticStatsList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedDemo)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- me.setSelected(me, i);
- //DemoConfirm_ListClick_Check_Gamestatus(me);
- }
- me.lastClickedDemo = i;
- me.lastClickedTime = time;
+ //DemoConfirm_ListClick_Check_Gamestatus(me);
}
float XonoticStatsList_keyDown(entity me, float scan, float ascii, float shift)