6 #ifndef TCMENU_BASE_DIALOG_H_
7 #define TCMENU_BASE_DIALOG_H_
15 #define FIRST_DEFAULT_BUTTON 0
16 #define SECOND_DEFAULT_BUTTON 1
17 #define CUSTOM_DIALOG_BUTTON_START 2
23 BTNTYPE_OK, BTNTYPE_ACCEPT, BTNTYPE_CANCEL, BTNTYPE_CLOSE, BTNTYPE_NONE,
24 BTNTYPE_CUSTOM0 = 15, BTNTYPE_CUSTOM1, BTNTYPE_CUSTOM2, BTNTYPE_CUSTOM3,
25 BTNTYPE_CUSTOM4, BTNTYPE_CUSTOM5, BTNTYPE_CUSTOM6, BTNTYPE_CUSTOM7 };
36 #define DLG_FLAG_SMALLDISPLAY 0
37 #define DLG_FLAG_INUSE 1
38 #define DLG_FLAG_CAN_SEND_REMOTE 2
39 #define DLG_FLAG_MENUITEM_BASED 3
40 #define DLG_FLAG_NEEDS_RENDERING 4
41 #define DLG_FLAG_USING_OO_CONTROLLER 5
42 #define DLG_FLAG_REMOTE_0 8
43 #define DLG_FLAG_REMOTE_1 9
44 #define DLG_FLAG_REMOTE_2 10
45 #define DLG_FLAG_REMOTE_3 11
46 #define DLG_FLAG_REMOTE_4 12
48 #define DLG_FLAG_REMOTE_MASK 0xff00
50 #define DLG_VISIBLE 'S'
51 #define DLG_HIDDEN 'H'
52 #define DLG_ACTION 'A'
105 const char* headerPgm;
167 virtual char* getBufferData();
178 bool isInUse() {
return bitRead(flags, DLG_FLAG_INUSE);}
191 bool isMenuItemBased() {
return bitRead(flags, DLG_FLAG_MENUITEM_BASED); }
192 bool isRenderNeeded() {
return bitRead(flags, DLG_FLAG_NEEDS_RENDERING); }
193 bool isRemoteUpdateNeeded(
int remote) {
return bitRead(flags, remote + DLG_FLAG_REMOTE_0) && bitRead(flags, DLG_FLAG_CAN_SEND_REMOTE); }
194 void setRemoteUpdateNeeded(
int remote,
bool b) { bitWrite(flags, remote + DLG_FLAG_REMOTE_0, b); }
195 void setRemoteUpdateNeededAll() { flags |= DLG_FLAG_REMOTE_MASK; }
196 void clearRemoteUpdateNeededAll() { flags &= ~DLG_FLAG_REMOTE_MASK; }
197 void setRemoteAllowed(
bool allowed) {bitWrite(flags, DLG_FLAG_CAN_SEND_REMOTE, allowed); }
210 bool copyButtonText(
char* data,
int buttonNum,
int currentValue,
bool isActive);
212 bool copyButtonText(
char* data,
int buttonNum,
int currentValue) {
213 return copyButtonText(data, buttonNum, currentValue, buttonNum == currentValue);
226 void setInUse(
bool b) {bitWrite(flags, DLG_FLAG_INUSE, b);}
240 if(b && needsDrawing == MENUDRAW_COMPLETE_REDRAW)
return;
241 needsDrawing = b ? MENUDRAW_EDITOR_CHANGE : MENUDRAW_NO_CHANGE;
251 void internalShow(
bool allowRemote);
270 uint8_t buttonNumber;
284 int getButtonNumber() {
return buttonNumber; }
287 #define FIRST_USER_BUTTON_NUM 2
306 uint16_t getBackMenuItemId() {
return backItem.
getId(); }
311 void insertMenuItem(
MenuItem* item);
313 void copyHeader(
char *buffer,
int bufferSize);
315 char* getBufferData()
override {
return const_cast<char *
>(bufferItem.
getTextValue()); }
317 TextMenuItem* getBufferMenuItem() {
return &bufferItem; }
323 void resetDialogFields();
void(* DialogInitialiser)(MenuBasedDialog *)
Definition: BaseDialog.h:327
void withMenuDialogIfAvailable(DialogInitialiser dlgFn)
Definition: BaseDialog.cpp:324
void(* CompletedHandlerFn)(ButtonType buttonPressed, void *yourData)
Definition: BaseDialog.h:34
ButtonType
Definition: BaseDialog.h:22
int dialogButtonRenderFn(RuntimeMenuItem *item, uint8_t, RenderFnMode mode, char *buffer, int bufferSize)
Definition: BaseDialog.cpp:238
MenuRedrawState
Definition: BaseRenderers.h:254
Definition: BaseDialog.h:62
virtual void initialiseAndGetHeader(BaseDialog *dialog, char *buffer, size_t bufferSize)=0
virtual bool dialogButtonPressed(int buttonNum)=0
virtual void dialogDismissed(ButtonType buttonType)=0
virtual void copyCustomButtonText(int buttonNumber, char *buffer, size_t bufferSize)=0
Definition: BaseDialog.h:102
bool isInUse()
Definition: BaseDialog.h:178
void setButtons(ButtonType btn1, ButtonType btn2, int defVal=0)
Definition: BaseDialog.cpp:192
void actionPerformed(int btnNum)
Definition: BaseDialog.cpp:103
virtual void internalRender(int currentValue)=0
bool isCompressedMode()
Definition: BaseDialog.h:181
void setUserData(void *data)
Definition: BaseDialog.h:156
BaseDialog()
Definition: BaseDialog.cpp:23
void dialogRendering(unsigned int currentValue, bool userClicked)
Definition: BaseDialog.cpp:122
void showRam(const char *headerRam, bool allowRemote, CompletedHandlerFn completedHandler=NULL)
Definition: BaseDialog.cpp:37
bool copyButtonText(char *data, int buttonNum, int currentValue, bool isActive)
Definition: BaseDialog.cpp:140
void setInUse(bool b)
Definition: BaseDialog.h:226
void show(const char *headerPgm, bool allowRemote, CompletedHandlerFn completedHandler=NULL)
Definition: BaseDialog.cpp:29
void hide()
Definition: BaseDialog.cpp:80
ButtonType findActiveBtn(unsigned int currentValue)
Definition: BaseDialog.cpp:94
virtual void internalSetVisible(bool visible)
Definition: BaseDialog.cpp:68
void setNeedsDrawing(bool b)
Definition: BaseDialog.h:239
void showController(bool allowRemote, BaseDialogController *controller)
Definition: BaseDialog.cpp:46
virtual void copyIntoBuffer(const char *sz)
Definition: BaseDialog.cpp:172
bool isUsingOOController()
Definition: BaseDialog.h:175
Definition: RemoteConnector.h:187