Don't show "by", in case the author name is blank.
[supertux.git] / src / menu.h
index ae56b0b..a3b99e0 100644 (file)
 #ifndef SUPERTUX_MENU_H
 #define SUPERTUX_MENU_H
 
-#include <SDL.h>
 #include <vector>
-#include "texture.h"
+
+#include "SDL.h"
+
+#include "screen/surface.h"
 #include "timer.h"
 #include "type.h"
 #include "mousecursor.h"
@@ -53,7 +55,6 @@ enum GameMenuIDs {
 
 enum WorldMapMenuIDs {
   MNID_RETURNWORLDMAP,
-  MNID_SAVEGAME,
   MNID_QUITWORLDMAP
   };
 
@@ -62,11 +63,40 @@ enum LevelEditorMainMenuIDs {
   MNID_SUBSETSETTINGS,
   MNID_QUITLEVELEDITOR
   };
+  
+enum LevelEditorSubsetSettingsIDs {
+  MNID_SUBSETTITLE,
+  MNID_SUBSETDESCRIPTION,
+  MNID_SUBSETSAVECHANGES
+  };
+  
+enum LevelEditorSubsetNewIDs {
+ MNID_SUBSETNAME,
+ MNID_CREATESUBSET
+};
 
 enum LevelEditorSettingsMenuIDs {
+  MNID_NAME,
+  MNID_AUTHOR,
+  MNID_SONG,
+  MNID_BGIMG,
+  MNID_PARTICLE,
+  MNID_LENGTH,
+  MNID_HEIGHT,
+  MNID_TIME,
+  MNID_GRAVITY,
+  MNID_BGSPEED,
+  MNID_TopRed,
+  MNID_TopGreen,
+  MNID_TopBlue,
+  MNID_BottomRed,
+  MNID_BottomGreen,
+  MNID_BottomBlue,
   MNID_APPLY
   };
 
+bool confirm_dialog(Surface* background, std::string text);
+
 /* Kinds of menu items */
 enum MenuItemKind {
   MN_ACTION,
@@ -76,7 +106,8 @@ enum MenuItemKind {
   MN_DEACTIVE,
   MN_TEXTFIELD,
   MN_NUMFIELD,
-  MN_CONTROLFIELD,
+  MN_CONTROLFIELD_KB,
+  MN_CONTROLFIELD_JS,
   MN_STRINGSELECT,
   MN_LABEL,
   MN_HL, /* horizontal line */
@@ -100,6 +131,11 @@ public:
   void change_input(const char *text);
 
   static MenuItem* create(MenuItemKind kind, const char *text, int init_toggle, Menu* target_menu, int id, int* int_p);
+
+  std::string get_input_with_symbol(bool active_item);   // returns the text with an input symbol
+private:
+  bool input_flickering;
+  Timer input_flickering_timer;
 };
 
 class Menu
@@ -138,8 +174,6 @@ private:
   // position of the menu (ie. center of the menu, not top/left)
   int pos_x;
   int pos_y;
-  bool has_backitem;
-  int last_id;
 
   /** input event for the menu (up, down, left, right, etc.) */
   MenuAction menuaction;
@@ -147,6 +181,7 @@ private:
   /* input implementation variables */
   int delete_character;
   char mn_input_char;
+  Timer joystick_timer;
   
 public:
   Timer effect;
@@ -173,12 +208,16 @@ public:
   MenuItem& get_item(int index) { return item[index]; }
   MenuItem& get_item_by_id(int id);
 
+  int get_active_item_id();
+
   bool isToggled(int id);
 
   void Menu::get_controlfield_key_into_input(MenuItem *item);
+  void Menu::get_controlfield_js_into_input(MenuItem *item);
 
-  void draw   ();
-  void draw_item(int index, int menu_width, int menu_height);
+  void draw(DrawingContext& context);
+  void draw_item(DrawingContext& context,
+      int index, int menu_width, int menu_height);
   void set_pos(int x, int y, float rw = 0, float rh = 0);
 
   /** translate a SDL_Event into a menu_action */