// BUTTONS // ======= // You can make up to 160 buttons appear on the host or guests (ID = 0 to 159) // You can make a further 80 buttons appear on the local computer (160 to 239) // To delete one button or clear all buttons, send this packet : struct IS_BFN // Button FunctioN - delete buttons / receive button requests { byte Size; // 8 byte Type; // ISP_BFN byte ReqI; // 0 byte SubT; // subtype, from BFN_ enumeration (see below) byte UCID; // connection to send to or from (0 = local / 255 = all) byte ClickID; // ID of button to delete (if SubT is BFN_DEL_BTN) byte Sp2; byte Sp3; }; enum // the fourth byte of IS_BFN packets is one of these { BFN_DEL_BTN, // 0 - instruction : delete one button (must set ClickID) BFN_1, // 1 BFN_DEL_LOCAL, // 2 - instruction : delete all local buttons BFN_DEL_HOST, // 3 - instruction : delete all host buttons BFN_USER_DEL_L, // 4 - info : user pressed SHIFT + B - removed all local buttons BFN_USER_DEL_H, // 5 - info : user pressed SHIFT + I - removed all host buttons BFN_REQ_LOCAL, // 6 - user request : user pressed SHIFT + B - request for local buttons BFN_REQ_HOST, // 7 - user request : user pressed SHIFT + I - request for host buttons }; // NOTE : the BFN_REQ_LOCAL request is for the user to bring up buttons by pressing SHIFT + B // NOTE : the BFN_REQ_HOST request is for the user to bring up buttons by pressing SHIFT + I // To send a button to LFS, send this variable sized packet struct IS_BTN // BuTtoN - button header - followed by 0 to 240 characters { byte Size; // 12 + TEXT_SIZE (a multiple of 4) byte Type; // ISP_BTN byte ReqI; // non-zero (returned in IS_BCL and IS_BTT packets) byte UCID; // connection to display the button (0 = local / 255 = all) byte ClickID; // button ID (host : 0 to 159 / local : 160 to 239) byte Instance; // used internally by InSim byte BStyle; // button style flags - see below byte TypeIn; // max chars to type in - see below byte L; // left : 0 - 200 byte T; // top : 0 - 200 byte W; // width : 0 - 200 byte H; // height : 0 - 200 // char Text[TEXT_SIZE]; // up to 240 characters of text }; // ClickID byte : buttons from the host and local buttons are kept separate. // If you are writing a host program to show buttons on host or guests. use // the range 0 to 159. If you are writing a strictly local InSim program you // must use the values 160 to 239 so that your program can be used online. // This allows local InSim buttons at the same time as host buttons. // Local InSim programmers should try to avoid overlapping host buttons. // TypeIn byte : the user can click this button to type in text // lowest 7 bits - maximum number of chars to type in (0 to 95) // highest bit (128) can be set to initialise dialog with the button's text // BStyle byte : style flags for the button #define ISB_C1 1 // you can choose a standard #define ISB_C2 2 // interface colour using #define ISB_C4 4 // these 3 lowest bits - see below #define ISB_CLICK 8 // click this button to send IS_BTC #define ISB_LIGHT 16 // light button #define ISB_DARK 32 // dark button #define ISB_LEFT 64 // align text to left #define ISB_RIGHT 128 // align text to right // colour 0 : light grey (not user editable) // colour 1 : title colour (default:yellow) // colour 2 : unselected text (default:black) // colour 3 : selected text (default:white) // colour 4 : ok (default:green) // colour 5 : cancel (default:red) // colour 6 : text string (default:pale blue) // colour 7 : unavailable (default:grey) // NOTE : if width or height are zero, this would normally be an invalid button. But in that case if // there is an existing button with the same ClickID, all the packet contents are ignored except the // Text field. This can be useful for updating the text in a button without knowing its position. // For example, you might reply to an IS_BTT using an IS_BTN with zero W and H to update the text. // Replies : If the user clicks on a clickable button, this packet will be sent : struct IS_BTC // BuTton Click - sent back when user clicks a button { byte Size; // 8 byte Type; // ISP_BTC byte ReqI; // ReqI as received in the IS_BTN byte UCID; // connection that clicked the button (zero if local) byte ClickID; // button identifier originally sent in the IBtn byte Instance; // used internally by InSim byte CFlags; // button click flags - see below byte Sp3; }; // CFlags byte : click flags #define ISB_LMB 1 // left click #define ISB_RMB 2 // right click #define ISB_CTRL 4 // ctrl + click #define ISB_SHIFT 8 // shift + click // If the TypeIn byte is set in IS_BTN the user can type text into the button // In that case no IS_BTC is sent - an IS_BTT is sent when the user presses ENTER struct IS_BTT // BuTton Type - sent back when user types into a text entry button { byte Size; // 68 byte Type; // ISP_BTT byte ReqI; // ReqI as received in the IS_BTN byte UCID; // connection that typed into the button (zero if local) byte ClickID; // button identifier originally sent in the IBtn byte Instance; // used internally by InSim byte TypeIn; // from original button specification byte Sp2; char Text[96]; // typed text, zero to MaxType specified in IBtn };