| 961 | } |
| 962 | |
| 963 | newuiSheet *newuiMenu::AddOption(int16_t id, const char *title, int size, bool has_sheet, int yoff) { |
| 964 | newuiMenuOptionButton *last_btn = NULL; |
| 965 | |
| 966 | if (m_nsheets == N_NEWUI_SHEETS) { |
| 967 | Int3(); |
| 968 | return NULL; |
| 969 | } |
| 970 | |
| 971 | if (has_sheet) { |
| 972 | m_sheets[m_nsheets].Create(this, title, size, m_sheetx, m_sheety); |
| 973 | } |
| 974 | |
| 975 | if (m_nsheets > 0) { |
| 976 | last_btn = &m_sheetbtn[m_nsheets - 1]; |
| 977 | } |
| 978 | |
| 979 | switch (m_align) { |
| 980 | case NEWUI_ALIGN_VERT: |
| 981 | m_sheetbtn[m_nsheets].Create(this, last_btn, id, title, m_optionsx, m_optionsy + m_nsheets * m_optionsh + yoff, |
| 982 | has_sheet); |
| 983 | break; |
| 984 | case NEWUI_ALIGN_HORIZ: |
| 985 | m_sheetbtn[m_nsheets].Create(this, last_btn, id, title, m_optionsx + m_nsheets * m_optionsw + yoff, m_optionsy, |
| 986 | has_sheet); |
| 987 | break; |
| 988 | default: |
| 989 | Int3(); |
| 990 | } |
| 991 | |
| 992 | m_hassheet[m_nsheets] = has_sheet; |
| 993 | m_newoptionid = id; |
| 994 | m_nsheets++; |
| 995 | |
| 996 | if (!has_sheet) { |
| 997 | return NULL; |
| 998 | } |
| 999 | |
| 1000 | return &m_sheets[m_nsheets - 1]; |
| 1001 | } |
| 1002 | |
| 1003 | // set master sheet,button locations |
| 1004 | void newuiMenu::SetPlacements(int x, int y, int options_x, int options_y, int options_w, int options_h, int title_x, |