/* Add a shortkey to a framewindow shortkey table. */ void EvalCcRqADDMENUSHORTKEY (CrossCallInfo *pcci) /* frameptr, cmd, key; no result. */ { GtkAccelGroup* accel_group; GObject* frame; GtkWidget* menu_item; guint key; printf("EvalCcRqADDMENUSHORTKEY\n"); frame = G_OBJECT(pcci->p1); menu_item = GTK_WIDGET(pcci->p2); key = (guint) pcci->p3; printf("Creating accellerators\n"); accel_group = (GtkAccelGroup*) gtk_accel_groups_from_object(frame)->data; printf("Accel groups: %p, %p\n", accel_group, gtk_accel_groups_from_object(frame)->next); gtk_widget_activate(menu_item); gtk_widget_add_accelerator(menu_item, "activate", accel_group, key, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); MakeReturn0Cci (pcci); }
void EvalCcRqREMOVEMENUSHORTKEY (CrossCallInfo *pcci) /* frameptr, cmd; no result. */ { GtkWidget *frame; GtkWidget *box; GtkWidget *menu_item; GtkAccelGroup *accel_group; printf("EvalCcRqREMOVEMENUSHORTKEY\n"); frame = GTK_WIDGET(pcci->p1); menu_item = GTK_WIDGET(pcci->p2); accel_group = ((GtkAccelGroup*)gtk_accel_groups_from_object(G_OBJECT(frame))->data); for (;;) { GtkAccelKey *key = gtk_accel_group_find(accel_group, dummy_find_accel, NULL); if (!key) break; gtk_widget_remove_accelerator(menu_item, accel_group, key->accel_key, key->accel_mods); } MakeReturn0Cci (pcci); }
void HandleCleanRequest (CrossCallInfo * pcci) { switch (pcci->mess) { case CcRqDOMESSAGE: // idleTimerOn, sleeptime; no result. { MSG ms; int msgresult; msgresult = GetMessageQuickly ((BOOL)pcci->p1, (int)pcci->p2, &ms); if (msgresult == -1) ErrorExit ("Fatal error: CcRqDoMessage, GetMessage result is -1"); else if (msgresult == FALSE) ErrorExit ("Fatal error: CcRqDoMessage, GetMessage result is FALSE (WM_QUIT)"); else { if (!gActiveDialog || !IsDialogMessage (gActiveDialog, &ms)) { if (ghActiveClientWindow==NULL || !TranslateMDISysAccel (ghActiveClientWindow, &ms)) { if (!gAcceleratorTableIsUpToDate) { // Verify the correctness of gAcceleratorTable gAcceleratorTable = UpdateAcceleratorTable (gAcceleratorTable,ghActiveFrameWindow); } if (gAcceleratorTable==NULL || !TranslateAccelerator (ghActiveFrameWindow, gAcceleratorTable, &ms)) { { TranslateMessage (&ms); DispatchMessage (&ms); } } } } MakeReturn0Cci (pcci); } } break; default: { CrossCallProcedure action; action = FindCrossCallEntry (gCrossCallProcedureTable, pcci->mess); if (action == NULL) { // Cross call request code not installed. ErrorExit ("\'HandleCleanRequest\' got uninstalled CcRq request code from Clean: %d\n", pcci->mess); } else { // Cross call request code found. Apply it to pcci. action (pcci); } } } KickCleanThread (pcci); } /* HandleCleanRequest */
/* Destroy a menu 'physically' */ void EvalCcRqDESTROYMENU (CrossCallInfo *pcci) /* HMENU; no result. */ { printf("EvalCcRqDESTROYMENU\n"); /* * This is handled behind-the-scenes by GTK */ MakeReturn0Cci (pcci); }
/* Cross call procedure implementations. Eval<nr> corresponds with a CrossCallEntry generated by NewCrossCallEntry (nr,Eval<nr>). */ void EvalCcRqGETFONTNAMES (CrossCallInfo *pcci) // no params; no result. { HDC hdc; hdc = GetDC (ghMainWindow); EnumFontFamilies (hdc, NULL, (FONTENUMPROC) EnumFontNameProc, 0); ReleaseDC (ghMainWindow, hdc); MakeReturn0Cci (pcci); }
void EvalCcRqSETCLIPBOARDTEXT (CrossCallInfo *pcci) /* textptr; no result. */ { const gchar *text = (const gchar *) pcci->p1; gtk_clipboard_set_text (gtk_clipboard_get(GDK_NONE), text, strlen(text)); MakeReturn0Cci (pcci); }
void EvalCcRqGETFONTSIZES (CrossCallInfo *pcci) // textptr; no result. { HDC hdc; hdc = GetDC (ghMainWindow); EnumFontFamilies (hdc, (char *) pcci->p1, (FONTENUMPROC) EnumFontSizeProc, 0); ReleaseDC (ghMainWindow, hdc); rfree ((char *) pcci->p1); MakeReturn0Cci (pcci); }
void EvalCcRqREMOVEMENUITEM (CrossCallInfo *pcci) /* menu, HITEM; no result. */ { GtkWidget *menu, *menu_item; printf("EvalCcRqREMOVEMENUITEM\n"); menu = GTK_WIDGET(pcci->p1); menu_item = GTK_WIDGET(pcci->p2); gtk_menu_item_remove_submenu(GTK_MENU_ITEM(menu_item)); gtk_widget_destroy(menu_item); MakeReturn0Cci (pcci); }
void EvalCcRqITEMENABLE (CrossCallInfo *pcci) /* parent, HITEM, onoff; no result. */ { GtkWidget *menu, *menu_item; printf("EvalCcRqITEMENABLE\n"); menu = GTK_WIDGET(pcci->p1); menu_item = GTK_WIDGET(pcci->p2); printf("Menu widget: %s\n", gtk_menu_get_title(GTK_MENU(menu))); printf("EvalCcRqITEMENABLE\n"); gtk_widget_set_sensitive(menu_item, (gboolean) pcci->p3); MakeReturn0Cci (pcci); }
void EvalCcRqCHECKMENUITEM (CrossCallInfo *pcci) /* menu, HITEM, on/off; no result. */ { printf("EvalCcRqCHECKMENUITEM\n"); if (GTK_IS_MENU(pcci->p1)) { GtkWidget *menu = GTK_WIDGET(pcci->p1); GtkWidget *menu_item = GTK_WIDGET(pcci->p2); if (GTK_IS_CHECK_MENU_ITEM(menu_item)) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), (gboolean) pcci->p3); } MakeReturn0Cci (pcci); }
void EvalCcRqMODIFYMENUITEM (CrossCallInfo *pcci) /* hitem, hmenu, textptr; no result. */ { GtkWidget *menu, *menu_item, *label; gchar *title; printf("EvalCcRqMODIFYMENUITEM\n"); title = createMnemonicString((gchar *) pcci->p3); menu = GTK_WIDGET(pcci->p2); menu_item = GTK_WIDGET(pcci->p1); label = gtk_bin_get_child(GTK_BIN(menu_item)); gtk_label_set_text_with_mnemonic(GTK_LABEL(label), title); rfree(title); MakeReturn0Cci (pcci); }
void EvalCcRqMENUENABLE (CrossCallInfo *pcci) /* parent, zero based position of menu, onoff; no result. */ { GtkWidget *parent_menu, *sub_menu; printf("EvalCcRqMENUENABLE\n"); gint index = pcci->p2; if (pcci->p1 && GTK_IS_CONTAINER(pcci->p1)) { printf("We have a container. Checking the widget.\n"); parent_menu = GTK_WIDGET(pcci->p1); gtk_container_foreach(GTK_CONTAINER(parent_menu), pcci->p3 ? enable_menu_callback : disable_menu_callback, (gpointer) (&index)); } MakeReturn0Cci (pcci); }
/* Remove a menu logically */ void EvalCcRqDELETEMENU (CrossCallInfo *pcci) /* HMENU, HITEM; no result. */ { GtkWidget *menu, *menu_item; printf("EvalCcRqDELETEMENU\n"); menu = GTK_WIDGET(pcci->p1); menu_item = GTK_WIDGET(pcci->p2); gtk_container_foreach(GTK_CONTAINER(menu), find_item_callback, (gpointer) &menu_item); if (menu_item != GTK_WIDGET(pcci->p2)) { gtk_menu_item_remove_submenu(GTK_MENU_ITEM(menu_item)); gtk_widget_destroy(menu_item); } MakeReturn0Cci (pcci); }
static DWORD OsThreadFunction (DWORD param) { WNDCLASSEX wclass; int width, height; HMENU mainSystemMenu; /* register main window class */ wclass.cbSize = sizeof (WNDCLASSEX); wclass.style = CS_NOCLOSE; wclass.lpfnWndProc = (WNDPROC) MainWindowProcedure; wclass.cbClsExtra = 0; wclass.cbWndExtra = 0; wclass.hInstance = ghInst; wclass.hIcon = LoadIcon (ghInst, IDI_APPLICATION); wclass.hCursor = LoadCursor (ghInst, IDC_ARROW); wclass.hbrBackground = NULL; wclass.lpszMenuName = NULL; wclass.lpszClassName = MainWindowClassName; wclass.hIconSm = NULL; RegisterClassEx (&wclass); GetAppFileName (); width = GetSystemMetrics (SM_CXMAXIMIZED) - 2 * GetSystemMetrics (SM_CXSIZEFRAME); height = 2 * GetSystemMetrics (SM_CYSIZEFRAME) + GetSystemMetrics (SM_CYCAPTION) + GetSystemMetrics (SM_CYMENU); ghMainWindow = CreateWindow (MainWindowClassName, /* Class name */ (LPCTSTR) gAppName, /* Window title */ WS_OVERLAPPEDWINDOW, /* style flags */ 0, -5 - height, /* x, y */ width, height, /* width, height */ NULL, /* Parent window */ NULL, /* menu handle */ (HANDLE) ghInst, /* Instance that owns the window */ 0); /* Don't show the main window. This will result in one button less in the taskbar. ShowWindow (ghMainWindow, SW_SHOWNORMAL); */ /* Before creating Clean controls, the tooltip control is created as the topmost child of this window. */ gTooltip = CreateWindowEx ( WS_EX_TOPMOST, // Apply the topmost style for this window TOOLTIPS_CLASS, // Class name NULL, // Title (NULL) WS_POPUP | TTS_ALWAYSTIP, // Style *must* be WS_POPUP CW_USEDEFAULT, // Default position (x,y) CW_USEDEFAULT, CW_USEDEFAULT, // Default size (w,h) CW_USEDEFAULT, ghMainWindow, // Parent is the ghMainWindow (HMENU) NULL, // No menu (HANDLE) ghInst, // The instance NULL // No window creation data ); mainSystemMenu = GetSystemMenu (ghMainWindow,FALSE); RemoveMenu (mainSystemMenu, SC_RESTORE, MF_BYCOMMAND); RemoveMenu (mainSystemMenu, SC_MOVE, MF_BYCOMMAND); RemoveMenu (mainSystemMenu, SC_SIZE, MF_BYCOMMAND); RemoveMenu (mainSystemMenu, SC_MINIMIZE, MF_BYCOMMAND); RemoveMenu (mainSystemMenu, SC_MAXIMIZE, MF_BYCOMMAND); DrawMenuBar (ghMainWindow); KickCleanThread (MakeReturn0Cci (&gCci)); while (1) { HandleCleanRequest (&gCci); } MakeReturn0Cci (&gCci); SetEvent (gOS_DONE); return 0; } /* OsThreadFunction */
void EvalCcRqDRAWMBAR (CrossCallInfo *pcci) /* framePtr, clientPtr; no result. */ { printf("EvalCcRqDRAWMBAR\n"); MakeReturn0Cci (pcci); }