void ShowControl(Word objID, Boolean enable) { if ( !enable || IsAI( stor.currplayer ) ) { CtlHideControl( GetObjectPtr(objID) ); } else { CtlShowControl( GetObjectPtr(objID) ); } }
static void ShowControl(Word objID, Boolean enable) { if ( enable ) { CtlShowControl( GetObjectPtr(objID) ); } else { CtlHideControl( GetObjectPtr(objID) ); } }
/***************************************************************************** * Function: GadgetDrawHintErase * * Description: Erase the area where the hintbox goes *****************************************************************************/ void GadgetDrawHintErase(void) { RectangleType bounds; UInt16 gadgetIndex; ControlType *ctl; if (! gForm) return; gadgetIndex = FrmGetObjectIndex(gForm, gHintGadgetID); FrmGetObjectBounds(gForm, gadgetIndex, &bounds); WinEraseRectangle(&bounds, 0); ctl=GetObjectPtr(BUTTON_edit); CtlHideControl(ctl); ctl=GetObjectPtr(BUTTON_beam); CtlHideControl(ctl); }
static void show_box_color(Boolean show) { FormPtr frm; ControlPtr checkbox; frm = FrmGetActiveForm(); checkbox = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, check_prf_14)); #ifdef I_AM_COLOR if (found_color && show) CtlShowControl(checkbox); else #endif CtlHideControl(checkbox); }
static void ExamsTableInit(void) { TableType *table=GetObjectPtr(TABLE_exams); UInt16 i, j; MemHandle m; UInt16 index=0; gExamsSelRow = 0; for (i=0; i < TblGetNumberOfRows(table); ++i) { TblSetItemStyle(table, i, EXCOL_DONE, checkboxTableItem); TblSetItemStyle(table, i, EXCOL_COURSE, customTableItem); TblSetItemStyle(table, i, EXCOL_NOTE, customTableItem); TblSetItemStyle(table, i, EXCOL_DATE, customTableItem); TblSetItemStyle(table, i, EXCOL_TIME, customTableItem); TblSetItemStyle(table, i, EXCOL_SELI, customTableItem); } TblSetColumnSpacing(table, EXCOL_DONE, 2); TblSetColumnSpacing(table, EXCOL_COURSE, 1); TblSetColumnSpacing(table, EXCOL_NOTE, 3); TblSetColumnSpacing(table, EXCOL_DATE, 1); TblSetColumnSpacing(table, EXCOL_TIME, 3); TblSetColumnUsable(table, EXCOL_DONE, true); TblSetColumnUsable(table, EXCOL_COURSE, true); TblSetColumnUsable(table, EXCOL_NOTE, true); TblSetColumnUsable(table, EXCOL_DATE, true); TblSetColumnUsable(table, EXCOL_TIME, true); TblSetColumnUsable(table, EXCOL_SELI, true); for (i=0; i < TblGetNumberOfRows(table); ++i) { TblSetRowUsable(table, i, false); } TblSetCustomDrawProcedure(table, EXCOL_COURSE, TableDrawData); TblSetCustomDrawProcedure(table, EXCOL_NOTE, TableDrawData); TblSetCustomDrawProcedure(table, EXCOL_DATE, TableDrawData); TblSetCustomDrawProcedure(table, EXCOL_TIME, TableDrawData); TblSetCustomDrawProcedure(table, EXCOL_SELI, TableDrawSelection); i = 0; j = 0; while ((i < EX_MAX_ROWS) && (m = DmQueryNextInCategory(DatabaseGetRefN(DB_MAIN), &index, DatabaseGetCat()))) { UInt32 uid=0; ExamDBRecord *ex; DmRecordInfo(DatabaseGetRefN(DB_MAIN), index, NULL, &uid, NULL); ex = MemHandleLock(m); if (ex->type == TYPE_EXAM) { // We have an exam, insert if above current offset if (j >= gExamsOffset) { UInt16 done = ex->flags & EX_FLAG_DONE; TblInsertRow(table, i); TblSetRowID(table, i, index); TblSetRowData(table, i, uid); if (uid == gExamsLastSelRowUID) gExamsSelRow = i; TblSetRowUsable(table, i, true); TblMarkRowInvalid(table, i); TblSetItemInt(table, i, EXCOL_DONE, done); i += 1; } j += 1; } MemHandleUnlock(m); index += 1; } // Check if there are displayed exams. If there are not, hide the // buttons for edit/delete/beam, otherwise show if (i > 0) { CtlShowControl(GetObjectPtr(BUTTON_ex_edit)); CtlShowControl(GetObjectPtr(BUTTON_ex_del)); CtlShowControl(GetObjectPtr(BUTTON_ex_beam)); CtlShowControl(GetObjectPtr(BUTTON_ex_note)); } else { CtlHideControl(GetObjectPtr(BUTTON_ex_edit)); CtlHideControl(GetObjectPtr(BUTTON_ex_del)); CtlHideControl(GetObjectPtr(BUTTON_ex_beam)); CtlHideControl(GetObjectPtr(BUTTON_ex_note)); } // decide and (show/hide) whether to have enabled or disabled down button // There must be another record, otherwise our course we assigned this exam to would // not exist, that should never happen. But to cover my future mistakes // index has been increased one in the loop. if ( (m = DmQueryNextInCategory(DatabaseGetRefN(DB_MAIN), &index, DatabaseGetCat())) != NULL) { // We have more records, are there exams? Char *s; s = MemHandleLock(m); // Since the DB is sorted we do not need to search for exams but just check the next // record. If it is not an exam record there won't be any later! if (s[0] == TYPE_EXAM) { CtlHideControl(GetObjectPtr(REPEAT_ex_down_dis)); CtlShowControl(GetObjectPtr(REPEAT_ex_down)); } else { CtlHideControl(GetObjectPtr(REPEAT_ex_down)); CtlShowControl(GetObjectPtr(REPEAT_ex_down_dis)); } MemHandleUnlock(m); } else { CtlHideControl(GetObjectPtr(REPEAT_ex_down)); CtlShowControl(GetObjectPtr(REPEAT_ex_down_dis)); } // decide (and show/hide) whether to have enabled or disabled up button if (gExamsOffset > 0) { CtlHideControl(GetObjectPtr(REPEAT_ex_up_dis)); CtlShowControl(GetObjectPtr(REPEAT_ex_up)); } else { CtlHideControl(GetObjectPtr(REPEAT_ex_up)); CtlShowControl(GetObjectPtr(REPEAT_ex_up_dis)); } }