processes a menu
| 876 | |
| 877 | // processes a menu |
| 878 | int newuiMenu::DoUI() { |
| 879 | int res, i; |
| 880 | |
| 881 | if (m_newoptionid != -1) { |
| 882 | m_cursheetidx = -1; |
| 883 | for (i = 0; i < m_nsheets; i++) { |
| 884 | if (m_sheetbtn[i].GetID() == (int)m_newoptionid) { |
| 885 | if (m_cursheet) { |
| 886 | m_cursheet->Unrealize(); |
| 887 | m_cursheet = NULL; |
| 888 | } |
| 889 | |
| 890 | if (m_hassheet[i]) { |
| 891 | if (m_activate_sheet_cb) { |
| 892 | (*m_activate_sheet_cb)(this, m_sheetbtn[i].GetID(), m_newoptionid, m_activate_sheet_cb_data); |
| 893 | } |
| 894 | |
| 895 | m_cursheet = &m_sheets[i]; |
| 896 | m_cursheet->Realize(); |
| 897 | } |
| 898 | |
| 899 | m_cursheetidx = i; |
| 900 | |
| 901 | SetFocusOnGadget(&m_sheetbtn[i]); |
| 902 | |
| 903 | if (m_option_focus_cb) { |
| 904 | (*m_option_focus_cb)(this, m_sheetbtn[i].GetID(), m_option_focus_cb_data); |
| 905 | } |
| 906 | |
| 907 | break; |
| 908 | } |
| 909 | } |
| 910 | if (i == m_nsheets) { // error! |
| 911 | Int3(); |
| 912 | if (m_cursheet) { |
| 913 | m_cursheet->Unrealize(); |
| 914 | m_cursheet = NULL; |
| 915 | } |
| 916 | } |
| 917 | m_newoptionid = -1; |
| 918 | } |
| 919 | |
| 920 | // refreshes gadgets on current sheet. |
| 921 | if (m_cursheet) { |
| 922 | m_cursheet->UpdateChanges(); |
| 923 | } |
| 924 | |
| 925 | // do ui and check if a new option was selected |
| 926 | res = ::DoUI(); |
| 927 | |
| 928 | for (i = 0; i < m_nsheets; i++) { |
| 929 | if (i != m_cursheetidx) { |
| 930 | if (res == m_sheetbtn[i].GetID() && m_hassheet[i]) { |
| 931 | m_newoptionid = (int16_t)res; |
| 932 | break; |
| 933 | } |
| 934 | } |
| 935 | } |
nothing calls this directly
no test coverage detected