| 886 | #define FLASH_SWITCH 1.0f |
| 887 | extern tceffect TCEffects[MAX_TCEFFECTS]; |
| 888 | void RenderButton(tceffect *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 889 | if (!ok_to_render) |
| 890 | return; |
| 891 | ASSERT(tce->type == EFX_BUTTON); |
| 892 | tTCEvent evt; |
| 893 | bool time_to_flash = false; |
| 894 | bool glow = false; |
| 895 | while (PopEvent(tce, &evt)) { |
| 896 | switch (evt.id) { |
| 897 | case TEVT_GAINFOCUS: { |
| 898 | int num = tce - TCEffects; |
| 899 | // mprintf(0,"Button: Recv'd GAIN FOCUS Event (%d)\n",num); |
| 900 | } break; |
| 901 | case TEVT_LOSTFOCUS: { |
| 902 | int num = tce - TCEffects; |
| 903 | // mprintf(0,"Button: Recv'd LOST FOCUS Event (%d)\n",num); |
| 904 | } break; |
| 905 | case TEVT_MOUSEOVER: { |
| 906 | if (tce->flags & OBF_GLOW) { |
| 907 | if (tce->flags & OBF_MOUSEOVERFOCUS) { |
| 908 | // for effects with this flag set, only glow if we have focus |
| 909 | if (tce->tab_stop && tce->has_focus) { |
| 910 | time_to_flash = true; |
| 911 | glow = true; |
| 912 | } |
| 913 | } else { |
| 914 | time_to_flash = true; |
| 915 | glow = true; |
| 916 | } |
| 917 | } |
| 918 | } break; |
| 919 | case TEVT_MOUSEENTER: { |
| 920 | if (tce->flags & OBF_MOUSEOVERFOCUS) { |
| 921 | // check to see if we have focus, if not, and we are a tab, set focus |
| 922 | if (tce->tab_stop && !tce->has_focus) { |
| 923 | // set the focus on us! |
| 924 | TelComSetFocusOnEffect(tce - TCEffects); |
| 925 | } |
| 926 | } |
| 927 | } break; |
| 928 | case TEVT_MOUSECLICK: |
| 929 | case TEVT_MOUSEDOWN: |
| 930 | case TEVT_MOUSEUP: { |
| 931 | // send out the event to the appropriate system/effect |
| 932 | switch (tce->buttoninfo.button_type) { |
| 933 | case BUTT_UPARROW: { |
| 934 | // mprintf(0,"Button: Telling Text to Scroll Up\n"); |
| 935 | int efxnum = GetEfxNumFromID(tce->buttoninfo.parent, tce->screen); |
| 936 | if (efxnum != -1) { |
| 937 | SendEventToEffect(efxnum, TEVT_SCROLLUP); |
| 938 | } |
| 939 | } break; |
| 940 | case BUTT_DOWNARROW: { |
| 941 | // mprintf(0,"Button: Telling Text to Scroll Down\n"); |
| 942 | int efxnum = GetEfxNumFromID(tce->buttoninfo.parent, tce->screen); |
| 943 | if (efxnum != -1) { |
| 944 | SendEventToEffect(efxnum, TEVT_SCROLLDOWN); |
| 945 | } |
no test coverage detected