VOID Dialogs_Fields_CreatePage( VOID )
{
 // Указатель на страницу.
 PPAGE Page = Enhancer.Pages.Dialogs_fields;

 // Создаем страницу.
 CHAR Page_class_name[] = "Dialogs_Fields_WndClass";
 WinRegisterClass( Enhancer.Application, Page_class_name, (PFNWP) Dialogs_Fields_WndProc, 0, 0 );
 Page->Window = WinCreateWindow( Enhancer.Client_window, Page_class_name, NULL, 0, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, 0, NULL, NULL );

 // Задаем шрифт.
 SetCommonEnhancerFont( Page->Window );

 // Узнаем страну, в которой работает приложение.
 LONG Code_page = Enhancer.Code_page;

 // Создаем поля ввода.
 LitCreateLayout( &Page->Layout, Page->Window );

 CreateCtlButtons( Page );

 {
  LTBRICK Box_brick; LitPrepareBrick( &Box_brick );
  Box_brick.hwnd = WinCreateWindow( Page->Window, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.WinList_Container_ID, NULL, NULL );
  Box_brick.prpWidthInParent = LTM_FULL_WIDTH; Box_brick.prpHeightInParent = DLG_BLK_BRICK_HEIGHT; Box_brick.prpGap = DLG_BLK_BRICK_GAP;
  LitJoinBrick( &( Page->Layout ), &Box_brick );

  LitCompleteRow( &( Page->Layout ) );

  {
   for( INT Count = 0; Count < 5; Count ++ )
    {
     LTBRICK Space_brick; LitPrepareBrick( &Space_brick );
     Space_brick.hwnd = WinCreateWindow( Box_brick.hwnd, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, 0, NULL, NULL );
     Space_brick.prpWidthInParent = LTM_FULL_WIDTH; Space_brick.prpHeightInParent = EMPTY_LINE_HEIGHT;
     LitJoinBrick( &( Page->Layout ), &Space_brick );

     LitCompleteRow( &( Page->Layout ) );
    }
  }

  {
   FLOAT Total_height = DLG_LST_BRICK_HEIGHT + DLG_CTL_BRICK_HEIGHT;

   LTBRICK CommandBox_brick; LitPrepareBrick( &CommandBox_brick );
   CommandBox_brick.hwnd = WinCreateWindow( Box_brick.hwnd, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.ControlBox_ID, NULL, NULL );
   CommandBox_brick.prpWidthInParent = DLG_LST_BRICK_WIDTH; CommandBox_brick.prpHeightInParent = Total_height; CommandBox_brick.prpGap = DLG_BOX_BRICK_GAP;
   LitJoinBrick( &( Page->Layout ), &CommandBox_brick );

   LTBRICK AddRemove_brick; LitPrepareBrick( &AddRemove_brick );
   AddRemove_brick.hwnd = WinCreateWindow( Box_brick.hwnd, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.AddRemove_ID, NULL, NULL );
   AddRemove_brick.prpWidthInParent = ( 1 - DLG_LST_BRICK_WIDTH ); AddRemove_brick.prpHeightInParent = Total_height;
   LitJoinBrick( &( Page->Layout ), &AddRemove_brick );

   LitCompleteRow( &( Page->Layout ) );

   {
    {
     LTBRICK Rectangle_brick; LitPrepareBrick( &Rectangle_brick );
     Rectangle_brick.hwnd = WinCreateWindow( CommandBox_brick.hwnd, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, 0, NULL, NULL );
     Rectangle_brick.prpWidthInParent = BLKQT_RCT_BRICK_WIDTH; Rectangle_brick.prpHeightInParent = BLKQT_RCT_BRICK_HEIGHT;
     LitJoinBrick( &( Page->Layout ), &Rectangle_brick );

     LTBRICK Checkbox_brick; LitPrepareBrick( &Checkbox_brick );
     Checkbox_brick.hwnd = WinCreateWindow( CommandBox_brick.hwnd, WC_BUTTON, NULL, BS_CHECKBOX, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.TextOnly_button_ID, NULL, NULL );
     Checkbox_brick.prpWidthInParent = LTM_COMMON_WIDTH; Checkbox_brick.prpHeightInParent = LTM_COMMON_HEIGHT;
     SetCommonEnhancerColors( Checkbox_brick.hwnd );
     if( Code_page == RUSSIAN ) WinSetWindowText( Checkbox_brick.hwnd, StrConst_RU_Pages_Dialogs_fields_TextOnly );
     else WinSetWindowText( Checkbox_brick.hwnd, StrConst_EN_Pages_Dialogs_fields_TextOnly );
     LitJoinBrick( &( Page->Layout ), &Checkbox_brick );

     LitCompleteRow( &( Page->Layout ) );
    }

    LTBRICK Checkbox_brick; LitPrepareBrick( &Checkbox_brick );
    Checkbox_brick.hwnd = WinCreateWindow( CommandBox_brick.hwnd, WC_BUTTON, NULL, BS_CHECKBOX, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.Restore_button_ID, NULL, NULL );
    Checkbox_brick.prpWidthInParent = LTM_COMMON_WIDTH; Checkbox_brick.prpHeightInParent = LTM_COMMON_HEIGHT;
    SetCommonEnhancerColors( Checkbox_brick.hwnd );
    if( Code_page == RUSSIAN ) WinSetWindowText( Checkbox_brick.hwnd, StrConst_RU_Pages_Dialogs_fields_Restore );
    else WinSetWindowText( Checkbox_brick.hwnd, StrConst_EN_Pages_Dialogs_fields_Restore );
    LitJoinBrick( &( Page->Layout ), &Checkbox_brick );

    LitCompleteRow( &( Page->Layout ) );

    LTBRICK List_brick; LitPrepareBrick( &List_brick );
    List_brick.hwnd = WinCreateWindow( CommandBox_brick.hwnd, WC_LISTBOX, NULL, 0, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.Window_list_ID, NULL, NULL );
    List_brick.prpWidthInParent = LTM_FULL_WIDTH; List_brick.prpHeightInParent = DLG_LST_BRICK_HEIGHT;
    LitJoinBrick( &( Page->Layout ), &List_brick );

    LitCompleteRow( &( Page->Layout ) );
   }

   {
    LTBRICK Rectangle_brick; LitPrepareBrick( &Rectangle_brick );
    Rectangle_brick.hwnd = WinCreateWindow( AddRemove_brick.hwnd, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, 0, NULL, NULL );
    Rectangle_brick.prpWidthInParent = LTM_BUTTON_WIDTH; Rectangle_brick.prpHeightInParent = DLG_RCT_BRICK_HEIGHT;
    LitJoinBrick( &( Page->Layout ), &Rectangle_brick );

    LitCompleteRow( &( Page->Layout ) );

    LTBRICK Button_brick; LitPrepareBrick( &Button_brick );
    Button_brick.hwnd = WinCreateWindow( AddRemove_brick.hwnd, WC_BUTTON, NULL, BS_PUSHBUTTON, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.Window_Add_ID, NULL, NULL );
    Button_brick.prpWidthInParent = LTM_BUTTON_WIDTH; Button_brick.prpHeightInParent = LTM_BUTTON_HEIGHT;
    if( Code_page == RUSSIAN ) WinSetWindowText( Button_brick.hwnd, StrConst_RU_Buttons_Add );
    else WinSetWindowText( Button_brick.hwnd, StrConst_EN_Buttons_Add );
    LitJoinBrick( &( Page->Layout ), &Button_brick );

    LitCompleteRow( &( Page->Layout ) );

    LitPrepareBrick( &Button_brick );
    Button_brick.hwnd = WinCreateWindow( AddRemove_brick.hwnd, WC_BUTTON, NULL, BS_PUSHBUTTON, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.Window_Remove_ID, NULL, NULL );
    Button_brick.prpWidthInParent = LTM_BUTTON_WIDTH; Button_brick.prpHeightInParent = LTM_BUTTON_HEIGHT;
    if( Code_page == RUSSIAN ) WinSetWindowText( Button_brick.hwnd, StrConst_RU_Buttons_Remove );
    else WinSetWindowText( Button_brick.hwnd, StrConst_EN_Buttons_Remove );
    LitJoinBrick( &( Page->Layout ), &Button_brick );

    LitCompleteRow( &( Page->Layout ) );
   }
  }
 }

 {
  LTBRICK Checkbox_brick; LitPrepareBrick( &Checkbox_brick );
  Checkbox_brick.hwnd = WinCreateWindow( Page->Window, WC_BUTTON, NULL, BS_CHECKBOX, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Dialogs_Fields.Settings.Remember_button_ID, NULL, NULL );
  Checkbox_brick.prpWidthInParent = LTM_COMMON_WIDTH; Checkbox_brick.prpHeightInParent = LTM_COMMON_HEIGHT;
  SetCommonEnhancerColors( Checkbox_brick.hwnd );
  if( Code_page == RUSSIAN ) WinSetWindowText( Checkbox_brick.hwnd, StrConst_RU_Pages_Dialogs_fields_Remember );
  else WinSetWindowText( Checkbox_brick.hwnd, StrConst_EN_Pages_Dialogs_fields_Remember );
  LitJoinBrick( &( Page->Layout ), &Checkbox_brick );

  LitCompleteRow( &( Page->Layout ) );
 }

 if( Code_page == RUSSIAN )
  CreatePromptText( Page, StrConst_RU_Pages_Dialogs_fields_Prompt );
 else
  CreatePromptText( Page, StrConst_EN_Pages_Dialogs_fields_Prompt );

 CompleteCreation( Page );

 // Возврат.
 return;
}
VOID Drawing_Themes_CreatePage( VOID )
{
 // Указатель на страницу.
 PPAGE Page = Enhancer.Pages.Drawing_themes;

 // Создаем страницу.
 CHAR Page_class_name[] = "Drawing_Themes_WndClass";
 WinRegisterClass( Enhancer.Application, Page_class_name, (PFNWP) Drawing_Themes_WndProc, 0, 0 );
 Page->Window = WinCreateWindow( Enhancer.Client_window, Page_class_name, NULL, 0, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, 0, NULL, NULL );

 // Задаем шрифт.
 SetCommonEnhancerFont( Page->Window );

 // Узнаем страну, в которой работает приложение.
 LONG Code_page = Enhancer.Code_page;

 // Создаем поля ввода.
 LitCreateLayout( &Page->Layout, Page->Window );

 CreateCtlButtons( Page );

 {
  LTBRICK Box_brick; LitPrepareBrick( &Box_brick );
  Box_brick.hwnd = WinCreateWindow( Page->Window, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Drawing_Themes.Settings.Container_ID, NULL, NULL );
  Box_brick.prpWidthInParent = LTM_FULL_WIDTH; Box_brick.prpHeightInParent = NM_BOX_BRICK_HEIGHT;
  LitJoinBrick( &( Page->Layout ), &Box_brick );

  LitCompleteRow( &( Page->Layout ) );

  {
   LTBRICK Space_brick; LitPrepareBrick( &Space_brick );
   Space_brick.hwnd = WinCreateWindow( Box_brick.hwnd, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, 0, NULL, NULL );
   Space_brick.prpWidthInParent = LTM_FULL_WIDTH; Space_brick.prpHeightInParent = EMPTY_LINE_HEIGHT;
   LitJoinBrick( &( Page->Layout ), &Space_brick );

   LitCompleteRow( &( Page->Layout ) );
  }

  {
   LTBRICK FileBox_brick; LitPrepareBrick( &FileBox_brick );
   FileBox_brick.hwnd = WinCreateWindow( Box_brick.hwnd, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Drawing_Themes.Settings.Texture_filebox_ID, NULL, NULL );
   FileBox_brick.prpWidthInParent = LTM_FULL_WIDTH; FileBox_brick.prpHeightInParent = FILEBOX_BRICK_HEIGHT; FileBox_brick.prpGap = FILEBOX_BRICK_GAP;
   LitJoinBrick( &( Page->Layout ), &FileBox_brick );

   {
    LTBRICK Label_brick; LitPrepareBrick( &Label_brick );
    Label_brick.hwnd = WinCreateWindow( FileBox_brick.hwnd, WC_STATIC, NULL, SS_TEXT | DT_RIGHT | DT_VCENTER, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Drawing_Themes.Settings.Texture_label_ID, NULL, NULL );
    Label_brick.prpWidthInParent = FILEBOX_LABEL_WIDTH; Label_brick.prpHeightInParent = LTM_COMMON_HEIGHT;
    SetCommonEnhancerColors( Label_brick.hwnd );
    if( Code_page == RUSSIAN ) WinSetWindowText( Label_brick.hwnd, StrConst_RU_Pages_Drawing_themes_Texture_text );
    else WinSetWindowText( Label_brick.hwnd, StrConst_EN_Pages_Drawing_themes_Texture_text );
    LitJoinBrick( &( Page->Layout ), &Label_brick );

    LTBRICK Name_brick; LitPrepareBrick( &Name_brick );
    Name_brick.hwnd = WinCreateWindow( FileBox_brick.hwnd, WC_STATIC, NULL, SS_TEXT | DT_LEFT | DT_VCENTER, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Drawing_Themes.Settings.Texture_name_ID, NULL, NULL );
    Name_brick.prpWidthInParent = FILEBOX_NAME_WIDTH; Name_brick.prpHeightInParent = LTM_COMMON_HEIGHT;
    ULONG Blue_color = RGB_DARKBLUE; WinSetPresParam( Name_brick.hwnd, PP_FOREGROUNDCOLOR, sizeof( Blue_color ), (PVOID) &Blue_color );
    if( Code_page == RUSSIAN ) WinSetWindowText( Name_brick.hwnd, StrConst_RU_Pages_Drawing_themes_Texture_name );
    else WinSetWindowText( Name_brick.hwnd, StrConst_EN_Pages_Drawing_themes_Texture_name );
    LitJoinBrick( &( Page->Layout ), &Name_brick );

    LTBRICK Button_brick; LitPrepareBrick( &Button_brick );
    Button_brick.hwnd = WinCreateWindow( FileBox_brick.hwnd, WC_BUTTON, NULL, BS_PUSHBUTTON, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Drawing_Themes.Settings.Texture_button_ID, NULL, NULL );
    Button_brick.prpWidthInParent = FILEBOX_BUTTON_WIDTH; Button_brick.prpHeightInParent = LTM_BUTTON_HEIGHT;
    if( Code_page == RUSSIAN ) WinSetWindowText( Button_brick.hwnd, StrConst_RU_Pages_Drawing_themes_Texture_button );
    else WinSetWindowText( Button_brick.hwnd, StrConst_EN_Pages_Drawing_themes_Texture_button );
    LitJoinBrick( &( Page->Layout ), &Button_brick );

    LitCompleteRow( &( Page->Layout ) );
   }
  }

  {
   LTBRICK List_brick; LitPrepareBrick( &List_brick );
   List_brick.hwnd = WinCreateWindow( Box_brick.hwnd, WC_LISTBOX, NULL, 0, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Drawing_Themes.Settings.Theme_list_ID, NULL, NULL );
   List_brick.prpWidthInParent = NM_LST_BRICK_WIDTH; List_brick.prpHeightInParent = NM_LST_BRICK_HEIGHT;
   LitJoinBrick( &( Page->Layout ), &List_brick );

   LitCompleteRow( &( Page->Layout ) );
  }
 }

 {
  LTBRICK Checkbox_brick; LitPrepareBrick( &Checkbox_brick );
  Checkbox_brick.hwnd = WinCreateWindow( Page->Window, WC_BUTTON, NULL, BS_CHECKBOX, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Drawing_Themes.Settings.Theme_button_ID, NULL, NULL );
  Checkbox_brick.prpWidthInParent = LTM_COMMON_WIDTH; Checkbox_brick.prpHeightInParent = LTM_COMMON_HEIGHT;
  SetCommonEnhancerColors( Checkbox_brick.hwnd );
  if( Code_page == RUSSIAN ) WinSetWindowText( Checkbox_brick.hwnd, StrConst_RU_Pages_Drawing_themes_Draw_frames );
  else WinSetWindowText( Checkbox_brick.hwnd, StrConst_EN_Pages_Drawing_themes_Draw_frames );
  LitJoinBrick( &( Page->Layout ), &Checkbox_brick );

  LitCompleteRow( &( Page->Layout ) );
 }

 if( Code_page == RUSSIAN )
  CreatePromptText( Page, StrConst_RU_Pages_Drawing_themes_Prompt );
 else
  CreatePromptText( Page, StrConst_EN_Pages_Drawing_themes_Prompt );

 CompleteCreation( Page );

 // Заполняем список тем.
 {
  // Задаем строки.
  INT Max_strings = 6; PCHAR Strings[ 6 ]; INT Count;
  for( Count = 0; Count < Max_strings; Count ++ ) DosAllocMem( (PPVOID) &Strings[ Count ], 256, PAG_ALLOCATE );

  if( Code_page == RUSSIAN )
   {
    strcpy( Strings[ 0 ], StrConst_RU_Pages_Drawing_themes_TName_Phoenix );
    strcpy( Strings[ 1 ], StrConst_RU_Pages_Drawing_themes_TName_BlueLion );
    strcpy( Strings[ 2 ], StrConst_RU_Pages_Drawing_themes_TName_eComStation );
    strcpy( Strings[ 3 ], StrConst_RU_Pages_Drawing_themes_TName_Classic );
    strcpy( Strings[ 4 ], StrConst_RU_Pages_Drawing_themes_TName_NeonBars );
    strcpy( Strings[ 5 ], StrConst_RU_Pages_Drawing_themes_TName_WhiteSnow );
    }
  else
   {
    strcpy( Strings[ 0 ], StrConst_EN_Pages_Drawing_themes_TName_Phoenix );
    strcpy( Strings[ 1 ], StrConst_EN_Pages_Drawing_themes_TName_BlueLion );
    strcpy( Strings[ 2 ], StrConst_EN_Pages_Drawing_themes_TName_eComStation );
    strcpy( Strings[ 3 ], StrConst_EN_Pages_Drawing_themes_TName_Classic );
    strcpy( Strings[ 4 ], StrConst_EN_Pages_Drawing_themes_TName_NeonBars );
    strcpy( Strings[ 5 ], StrConst_EN_Pages_Drawing_themes_TName_WhiteSnow );
   }

  // Передаем строки окну списка.
  {
   HWND Theme_list_window = WinWindowFromID( WinWindowFromID( Page->Window, Drawing_Themes.Settings.Container_ID ), Drawing_Themes.Settings.Theme_list_ID );

   Drawing_Themes.Settings.Theme_list_is_locked = 1; WinShowWindow( Theme_list_window, 0 );
   for( Count = 0; Count < Max_strings; Count ++ ) WinSendMsg( Theme_list_window, LM_INSERTITEM, MPFROMSHORT( LIT_END ), MPFROMP( Strings[ Count ] ) );
   Drawing_Themes.Settings.Theme_list_is_locked = 0; WinShowWindow( Theme_list_window, 1 );
  }

  // Освобождаем память.
  for( Count = 0; Count < Max_strings; Count ++ ) { DosFreeMem( Strings[ Count ] ); Strings[ Count ] = NULL; }
 }

 // Возврат.
 return;
}
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     {
     static CHAR  *szButtonLabel[] = { "Smaller", "Larger" } ;
     static HWND  hwndFrame, hwndButton[2] ;
     static INT   cxClient, cyClient, cxChar, cyChar ;
     FONTMETRICS  fm ;
     HPS          hps ;
     INT          id ;
     RECTL        rcl ;

     switch (msg)
          {
          case WM_CREATE :
               hwndFrame = WinQueryWindow (hwnd, QW_PARENT) ;

               hps = WinGetPS (hwnd) ;
               GpiQueryFontMetrics (hps, sizeof fm, &fm) ;
               cxChar = fm.lAveCharWidth ;
               cyChar = fm.lMaxBaselineExt ;
               WinReleasePS (hps) ;

               for (id = 0 ; id < 2 ; id++)
                    hwndButton[id] = WinCreateWindow (
                                        hwnd,               // Parent
                                        WC_BUTTON,          // Class
                                        szButtonLabel[id],  // Text
                                        WS_VISIBLE |        // Style
                                             BS_PUSHBUTTON,
                                        0, 0,               // Position
                                        12 * cxChar,        // Width
                                        2 * cyChar,         // Height
                                        hwnd,               // Owner
                                        HWND_BOTTOM,        // Placement
                                        id,                 // ID
                                        NULL,               // Ctrl Data
                                        NULL) ;             // Pres Params
               return 0 ;

          case WM_SIZE :
               cxClient = SHORT1FROMMP (mp2) ;
               cyClient = SHORT2FROMMP (mp2) ;

               for (id = 0 ; id < 2 ; id++)
                    WinSetWindowPos (hwndButton[id], NULLHANDLE,
                              cxClient / 2 + (14 * id - 13) * cxChar,
                              (cyClient - 2 * cyChar) / 2,
                              0, 0, SWP_MOVE) ;
               return 0 ;

          case WM_COMMAND:
               WinQueryWindowRect (hwnd, &rcl) ;
               WinMapWindowPoints (hwnd, HWND_DESKTOP, (PPOINTL) &rcl, 2) ;

               switch (COMMANDMSG(&msg)->cmd)               // Child ID
                    {
                    case 0:                                 // "Smaller"
                         rcl.xLeft   += cxClient / 20 ;
                         rcl.xRight  -= cxClient / 20 ;
                         rcl.yBottom += cyClient / 20 ;
                         rcl.yTop    -= cyClient / 20 ;
                         break ;

                    case 1:                                 // "Larger"
                         rcl.xLeft   -= cxClient / 20 ;
                         rcl.xRight  += cxClient / 20 ;
                         rcl.yBottom -= cyClient / 20 ;
                         rcl.yTop    += cyClient / 20 ;
                         break ;
                    }
               WinCalcFrameRect (hwndFrame, &rcl, FALSE) ;

               WinSetWindowPos (hwndFrame, NULLHANDLE,
                                rcl.xLeft, rcl.yBottom,
                                rcl.xRight - rcl.xLeft,
                                rcl.yTop   - rcl.yBottom,
				SWP_MOVE | SWP_SIZE) ;
               return 0 ;

          case WM_ERASEBACKGROUND:
               return MRFROMSHORT (1) ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
Example #4
0
void fnSaverThread(void *p)
{
  HWND hwndOldFocus;
  HWND hwndParent = (HWND) p;
  HWND hwndOldSysModal;
  HAB hab;
  QMSG msg;
  ULONG ulStyle;

  // Set our thread to slightly more than regular to be able
  // to update the screen fine.
  DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, +5, 0);

  hab = WinInitialize(0);
  hmqSaverThreadMsgQueue = WinCreateMsgQueue(hab, 0);

  if (bOnlyPreviewMode)
  {
    PFNWP pfnOldWindowProc;
    // We should run in preview mode, so the hwndParent we have is not the
    // desktop, but a special window we have to subclass.
    pfnOldWindowProc = WinSubclassWindow(hwndParent,
                                         (PFNWP) fnSaverWindowProc);

    // Initialize window proc (simulate WM_CREATE)
    WinSendMsg(hwndParent, WM_SUBCLASS_INIT, (MPARAM) NULL, (MPARAM) NULL);
    // Also make sure that the window will be redrawn with this new
    // window proc.
    WinInvalidateRect(hwndParent, NULL, FALSE);

    iSaverThreadState = STATE_RUNNING;

#ifdef DEBUG_LOGGING
    AddLog("[fnSaverThread] : Entering message loop (Preview)\n");
#endif

    // Process messages until WM_QUIT!
    while (WinGetMsg(hab, &msg, 0, 0, 0))
      WinDispatchMsg(hab, &msg);

#ifdef DEBUG_LOGGING
    AddLog("[fnSaverThread] : Leaved message loop (Preview)\n");
#endif

    // Uinitialize window proc (simulate WM_DESTROY)
    WinSendMsg(hwndParent, WM_SUBCLASS_UNINIT, (MPARAM) NULL, (MPARAM) NULL);

    // Undo subclassing
    WinSubclassWindow(hwndParent,
                      pfnOldWindowProc);
    // Also make sure that the window will be redrawn with the old
    // window proc.
    WinInvalidateRect(hwndParent, NULL, FALSE);

    iSaverThreadState = STATE_STOPPED_OK;
  } else
  {
    // We should run in normal mode, so create a new window, topmost, and everything else...
    WinRegisterClass(hab, (PSZ) SAVERWINDOW_CLASS,
                     (PFNWP) fnSaverWindowProc,
                     CS_SIZEREDRAW | CS_CLIPCHILDREN | CS_CLIPSIBLINGS, 0);

    hwndOldFocus = WinQueryFocus(HWND_DESKTOP);

    // Create the saver output window so that it will be the child of
    // the given parent window.
    // Make window 'Always on top' because we'll be in real screensaver mode!
    ulStyle = WS_VISIBLE | WS_TOPMOST;
    hwndSaverWindow = WinCreateWindow(HWND_DESKTOP, SAVERWINDOW_CLASS, "Screen saver",
                                      ulStyle,
                                      0, 0,
                                      (int) WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN),
                                      (int) WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN),
                                      HWND_DESKTOP,
                                      HWND_TOP,
                                      0x9fff, // Some ID....
                                      NULL, NULL);
    if (!hwndSaverWindow)
    {
#ifdef DEBUG_LOGGING
      AddLog("[fnSaverThread] : Could not create window!\n");
#endif
      // Yikes, could not create window!
      iSaverThreadState = STATE_STOPPED_ERROR;
    } else
    {
      // Cool, window created!

      // Make sure nobody will be able to switch away of it!
      // We do this by making the window system-modal, and giving it the focus!
      hwndOldSysModal = WinQuerySysModalWindow(HWND_DESKTOP);
      WinSetSysModalWindow(HWND_DESKTOP, hwndSaverWindow);
      WinSetFocus(HWND_DESKTOP, hwndSaverWindow);

      iSaverThreadState = STATE_RUNNING;

#ifdef DEBUG_LOGGING
      AddLog("[fnSaverThread] : Entering message loop (Real)\n");
#endif
      // Process messages until WM_QUIT!
      while (WinGetMsg(hab, &msg, 0, 0, 0))
        WinDispatchMsg(hab, &msg);

#ifdef DEBUG_LOGGING
      AddLog("[fnSaverThread] : Leaved message loop (Real)\n");
#endif

      // Undo system modalling
      WinSetSysModalWindow(HWND_DESKTOP, hwndOldSysModal);

      // Window closed, so destroy every resource we created!
      WinDestroyWindow(hwndSaverWindow);

      // Restore focus to old window
      WinSetFocus(HWND_DESKTOP, hwndOldFocus);

#ifdef DEBUG_LOGGING
      AddLog("[fnSaverThread] : STATE_STOPPED_OK\n");
#endif

      iSaverThreadState = STATE_STOPPED_OK;
    }
  }

  WinDestroyMsgQueue(hmqSaverThreadMsgQueue);
  WinTerminate(hab);

  _endthread();
}
Example #5
0
 static void configure(HWND hwnd, const MSGCHILD *def, USHORT qtd)
 {
    int                 f;
    HWND                h;
    ICQMSGDIALOG        *cfg        = WinQueryWindowPtr(hwnd,0);

#ifdef STANDARD_GUI

    ULONG               bg          = 0x00D1D1D1;

    static const USHORT stsFields[] = { MSGID_NICK,
    			                        MSGID_NICKENTRY,
    			                        MSGID_NAME,
    			                        MSGID_NAMEENTRY
    			                      };

#endif

    DBGMessage("Creating child windows");
    DBGTracex(cfg->fr.icq);

    cfg->fr.childCount = qtd;
    cfg->fr.childList  = def;

    for(f=0;f < qtd;f++)
    {
       h = WinCreateWindow(   hwnd,                     /* Parent window             */
                              (PSZ) def->wClass,        /* Class name                */
                              (PSZ) def->wText,         /* Window text               */
                              def->wStyle|WS_VISIBLE,   /* Window style              */
                               0, 0,                    /* Position (x,y)            */
                              10,10,                    /* Size (width,height)       */
                              hwnd,                     /* Owner window              */
                              HWND_BOTTOM,              /* Sibling window            */
                              DLG_ELEMENT_ID+def->id,   /* Window id                 */
                              NULL,                     /* Control data              */
                              NULL);                    /* Pres parameters           */

       icqskin_setICQHandle(h,cfg->fr.icq);
       icqskin_setFont(h,def->font);
       icqskin_setButtonName(h,def->name);

       def++;
    }

#ifdef STANDARD_GUI
    WinSetPresParam(hwnd,PP_BACKGROUNDCOLOR,sizeof(bg),&bg);
    WinSetPresParam(hwnd,PP_DISABLEDBACKGROUNDCOLOR,sizeof(bg),&bg);

    for(f=0;f< sizeof(stsFields)/sizeof(USHORT);f++)
    {
       h = CHILD_WINDOW(hwnd,stsFields[f]);
       if(h)
       {
          WinSetPresParam(h,PP_BACKGROUNDCOLOR,sizeof(bg),&bg);
          WinSetPresParam(h,PP_DISABLEDBACKGROUNDCOLOR,sizeof(bg),&bg);
       }
    }

    h = CHILD_WINDOW(hwnd,MSGID_HISTORY);

    if(h)
    {
       bg = 0x00FFFFFF;
       WinSetPresParam(h,PP_BACKGROUNDCOLOR,sizeof(bg),&bg);
       WinSetPresParam(h,PP_DISABLEDBACKGROUNDCOLOR,sizeof(bg),&bg);
    }

#endif

    /* Set button icons */
    icqskin_setButtonIcon(CHILD_WINDOW(hwnd,MSGID_ABOUTBUTTON), ICQICON_ABOUT);
    icqskin_setButtonIcon(CHILD_WINDOW(hwnd,MSGID_INFOBUTTON),  ICQICON_USERCONFIG);
    icqskin_setButtonIcon(CHILD_WINDOW(hwnd,MSGID_USERMODE),    ICQICON_OFFLINE);

    DBGTracex(CHILD_WINDOW(hwnd,MSGID_EDITBOX));

    DBGMessage("Child creation complete");

 }
MRESULT EXPENTRY PC2_SpoolerWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    static CNRINFO      CnrInfo;            /* Container info structure */
    static PFIELDINFO   pFieldInfo;
    static PFIELDINFO   pFieldInfoFirst;

    switch(msg)
    {
    case WM_CREATE:
        /*                                                                                      *\
         * During spooler window creation, create a container class window as the child of the  *
         * client area. Initialize the columns for the details view, the spooler container      *
         * window will use. Then set the container info structure to details view with a        *
         * splitbar.
        \*                                                                                      */
    {
        ULONG           ulColumn;
        PFIELDINFO      pFieldInfoSplitbar; /* Pointer to a the FIELDINFO structure of the 4th column
                                       to set splitbar afterwards */
        FIELDINFOINSERT FieldInfoInsert;    /* Control structure for column insertation */

        /* Create the container to fill in spooler queue
           and job data in details view. */
        pHP->hwndSpoolerContainer=WinCreateWindow(hwnd, WC_CONTAINER, "",
                                  WS_VISIBLE | CCS_READONLY | CCS_MINIRECORDCORE | CCS_MULTIPLESEL,
                                  0, 0, 0, 0, hwnd, HWND_TOP, ID_PC2SPOOLERCONTAINER, NULL, NULL);
        /* Set presentation parameters saved */
        WinSetPresParam(pHP->hwndSpoolerContainer, PP_FONTNAMESIZE,
                        sizeof(pHP->ucPC2SpoolerFont), pHP->ucPC2SpoolerFont);
        /* Subclass container window to get hold of presentation
           parameter changes */
        pfnContainerWindowProc=WinSubclassWindow(pHP->hwndSpoolerContainer, SubclassedContainerWindowProc);
        /* Create fieldinfos for the columns in details view */
        pFieldInfo=(PFIELDINFO)WinSendMsg(pHP->hwndSpoolerContainer, CM_ALLOCDETAILFIELDINFO,
                                          MPFROMSHORT(sizeof(ContainerFieldInfo)/sizeof(ContainerFieldInfo[0])), NULL);
        /* Fill the columns avaiable into container */
        pFieldInfoFirst=pFieldInfo;
        pFieldInfoSplitbar=NULL;
        for(ulColumn=0; ulColumn<(sizeof(ContainerFieldInfo)/sizeof(ContainerFieldInfo[0])); ulColumn++)
        {
            /* Save 4th column to set splitbar afterwards */
            if(ulColumn==3)
                pFieldInfoSplitbar=pFieldInfo;
            pFieldInfo->flTitle=ContainerFieldInfo[ulColumn].flTitle;
            pFieldInfo->pTitleData=strdup(ContainerFieldInfo[ulColumn].pTitleData);
            pFieldInfo->flData=ContainerFieldInfo[ulColumn].flData;
            pFieldInfo->offStruct=ContainerFieldInfo[ulColumn].offStruct;
            pFieldInfo=pFieldInfo->pNextFieldInfo;
        }
        /* Fill column insertation control */
        FieldInfoInsert.cb=sizeof(FieldInfoInsert);
        /* Insert from first column */
        FieldInfoInsert.pFieldInfoOrder=(PFIELDINFO)CMA_FIRST;
        /* Update container display now */
        FieldInfoInsert.fInvalidateFieldInfo=(ULONG)TRUE;
        /* Number of columns to insert */
        FieldInfoInsert.cFieldInfoInsert=sizeof(ContainerFieldInfo)/sizeof(ContainerFieldInfo[0]);
        /* Insert column field info into container */
        WinSendMsg(pHP->hwndSpoolerContainer, CM_INSERTDETAILFIELDINFO,
                   MPFROMP(pFieldInfoFirst), MPFROMP(&FieldInfoInsert));
        /* Select details view */
        CnrInfo.flWindowAttr=CV_DETAIL | CA_DETAILSVIEWTITLES;
        /* Splitbar is set to last saved position */
        CnrInfo.xVertSplitbar=pHP->lSplitbarPosition;
        /* Splitbar occurs after the 4th column */
        CnrInfo.pFieldInfoLast=pFieldInfoSplitbar;
        /* Setup CNRINFO into container */
        WinSendMsg(pHP->hwndSpoolerContainer, CM_SETCNRINFO,
                   MPFROMP(&CnrInfo), MPFROMLONG(CMA_FLWINDOWATTR|CMA_XVERTSPLITBAR|CMA_PFIELDINFOLAST));
        RefreshSpooler();                   /* Fill spooler container from queue data */
        WinSetFocus(HWND_DESKTOP, pHP->hwndSpoolerContainer);
    }
    break;

    case WM_PAINT:
    {
        HPS     hpsClient;

        /* Get a cached presentation space */
        hpsClient=WinBeginPaint(hwnd, NULLHANDLE, NULL);
        WinEndPaint(hpsClient);
    }
    break;

    case WM_SIZE:
    case WM_MOVE:
        /*                                                                                      *\
         * During sizing (and moving) of the spooler window, ensure that the container always   *
         * fills the complete client area.                                                      *
        \*                                                                                      */
    {
        LONG    lXBorder=WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER);
        LONG    lYBorder=WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
        SWP     swpPC2Spooler;
        RECTL   rectlClient;
        SWP     swp;

        /* Get the frame area size */
        WinQueryWindowPos(pHP->hwndSpoolerFrame, &swpPC2Spooler);
        if((swpPC2Spooler.cx>pHP->DesktopSize.x) || (pHP->swpPC2Spooler.cx<0))
            pHP->swpPC2Spooler.cx=pHP->DesktopSize.x/2;
        else
            pHP->swpPC2Spooler.cx=swpPC2Spooler.cx;
        if((swpPC2Spooler.cy>pHP->DesktopSize.y) || (pHP->swpPC2Spooler.cy<0))
            pHP->swpPC2Spooler.cy=pHP->DesktopSize.y/5;
        else
            pHP->swpPC2Spooler.cy=swpPC2Spooler.cy;
        if((swpPC2Spooler.x<(0-lXBorder)) ||
                ((swpPC2Spooler.x+pHP->swpPC2Spooler.cx)>(pHP->DesktopSize.x+lXBorder)))
            pHP->swpPC2Spooler.x=0;
        else
            pHP->swpPC2Spooler.x=swpPC2Spooler.x;
        if((swpPC2Spooler.y<(0-lYBorder)) ||
                ((swpPC2Spooler.y+pHP->swpPC2Spooler.cy)>(pHP->DesktopSize.y+lYBorder)))
            pHP->swpPC2Spooler.y=0;
        else
            pHP->swpPC2Spooler.y=swpPC2Spooler.y;
        WinSetWindowPos(pHP->hwndSpoolerFrame, NULLHANDLE, pHP->swpPC2Spooler.x, pHP->swpPC2Spooler.y,
                        pHP->swpPC2Spooler.cx, pHP->swpPC2Spooler.cy, SWP_SIZE | SWP_MOVE);
        /* Size container to client area */
        WinQueryWindowRect(hwnd, &rectlClient);
        swp.fl=SWP_MOVE|SWP_SIZE|SWP_SHOW|SWP_ZORDER;
        swp.x=swp.y=0;
        swp.cx=rectlClient.xRight;
        swp.cy=rectlClient.yTop;
        swp.hwndInsertBehind=HWND_TOP;
        swp.hwnd=pHP->hwndSpoolerContainer;
        WinSetMultWindowPos(pHP->habPc2, &swp, 1);
    }
    break;

    /*                                                                                      *\
     * Syntax: WM_SHOWSPOOLER, NULL, NULL                                                   *
    \*                                                                                      */
    case WM_SHOWSPOOLER:
        /*                                                                                      *\
         * The spooler window is initially created invisible. When the user selects the         *
         * menuentry PC2 Spooler, this message is posted to set the spooler window visible.     *
        \*                                                                                      */
    {
        SWP     swp;

        swp.fl=SWP_SHOW|SWP_ACTIVATE|SWP_ZORDER;
        swp.x=pHP->swpPC2Spooler.x;
        swp.y=pHP->swpPC2Spooler.y;
        swp.cx=pHP->swpPC2Spooler.cx;
        swp.cy=pHP->swpPC2Spooler.cy;
        swp.hwndInsertBehind=HWND_TOP;
        swp.hwnd=pHP->hwndSpoolerFrame;
        WinSetMultWindowPos(pHP->habPc2, &swp, 1);
    }
    break;

    /*                                                                                      *\
     * Syntax: WM_REFRESHSPOOLER, NULL, NULL                                                *
    \*                                                                                      */
    case WM_REFRESHSPOOLER:
        /*                                                                                      *\
         * The spooler container regularily gets this message from a timer to update the        *
         * container with the current printer queue data, to have a real-time status of the     *
         * printer queue.                                                                       *
        \*                                                                                      */
        RefreshSpooler();
        break;

    case WM_CONTROL:
        /*                                                                                      *\
         * The child window of the client area sends its notification messages to its parent,   *
         * so the client window procedure can expext container notification messages.           *
        \*                                                                                      */
        switch(SHORT2FROMMP(mp1))
        {
        case CN_CONTEXTMENU:
        {
            SPOOLERRECORD   *pListSpoolerRecord;
            POINTL          ptlMouse;       /* Mouse position during creation of notification */
            USHORT          fsOptions=PU_NONE | PU_KEYBOARD | PU_MOUSEBUTTON1 |
                                      PU_HCONSTRAIN | PU_VCONSTRAIN;

            /* Query selected records in container and return them,
               or return the one below the mouse pointer if none is
               selected. */
            pListSpoolerRecord=QuerySelectedRecords((SPOOLERRECORD *)mp2);
            if(pListSpoolerRecord==NULL)
                pHP->pSpoolerObject=NULL;
            else
                pHP->pSpoolerObject=pListSpoolerRecord->pSpoolerObject;
            /* Get the mouse position */
            WinQueryMsgPos(pHP->habPc2, &ptlMouse);
            WinPopupMenu(HWND_DESKTOP, hwnd, hwndSpoolerPopupMenu,
                         ptlMouse.x, ptlMouse.y, 0, fsOptions);
        }
        break;
        }
        break;

    case WM_HELP:                           /* Help pressed */
        WinSendMsg(pHP->hwndHelp, HM_DISPLAY_HELP,
                   MPFROMSHORT(ID_PC2SPOOLERWINDOW), HM_RESOURCEID);
        break;

    case WM_COMMAND:
        /*                                                                                      *\
         * Process the messages generated by the menuentries of the spooler container popup     *
         * menu.                                                                                *
        \*                                                                                      */
        switch(SHORT1FROMMP(mp1))
        {
        case ID_SPOOLERREFRESH:             /* User requested to refresh the spooler container window
                                           with the status of the actual spooler queue */
            RefreshSpooler();
            break;

        case ID_SPOOLERHOLDJOB:             /* The user selected to hold a job */
        case ID_SPOOLERRELEASEJOB:          /* The user selected to release a job */
        case ID_SPOOLERDELETEJOB:           /* The user selected to delete a job */
        case ID_SPOOLERHOLDQUEUE:           /* The user selected to hold a queue */
        case ID_SPOOLERRELEASEQUEUE:        /* The user selected to release a queue */
            /* Perform the action on linked list of selected records */
            NotifySelectedRecords((ULONG)SHORT1FROMMP(mp1));
            break;

        case ID_SPOOLERHELP:                /* The user requested some help */
            WinPostMsg(hwnd, WM_HELP, MPFROMLONG(ID_PC2SPOOLERWINDOW), MPFROM2SHORT(CMDSRC_MENU, TRUE));
            break;
        }
        break;

    case WM_DESTROY:
        /*                                                                                      *\
         * Clear container structures and free control structures used by PC/2.                 *
        \*                                                                                      */
    {
        SPOOLERRECORD   *pSpoolerRecord;

        /* Query the actual container info structure */
        WinSendMsg(pHP->hwndSpoolerContainer, CM_QUERYCNRINFO,
                   MPFROMP(&CnrInfo), MPFROMSHORT(sizeof(CnrInfo)));
        pHP->lSplitbarPosition=CnrInfo.xVertSplitbar;
        /* Prevent unnecessary container drawing */
        WinEnableWindowUpdate(pHP->hwndSpoolerContainer, FALSE);
        /* Get first container record to delete them sequentially */
        pSpoolerRecord=(SPOOLERRECORD *)WinSendMsg(pHP->hwndSpoolerContainer, CM_QUERYRECORD,
                       NULL, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
        while(pSpoolerRecord)
        {   /* Delete and free records */
            free(pSpoolerRecord->pszQueue);
            free(pSpoolerRecord->pszQueueStatus);
            free(pSpoolerRecord->pszQueueComment);
            free(pSpoolerRecord->pszQueueDriver);
            free(pSpoolerRecord->pszJob);
            free(pSpoolerRecord->pszJobNumber);
            free(pSpoolerRecord->pszJobStatus);
            free(pSpoolerRecord->pszJobComment);
            free(pSpoolerRecord->pSpoolerObject);
            /* Delete record in container. Warning! as this function
               expects an array, but we only delete one record, we
               have to get the address of the pointer to the record. */
            WinSendMsg(pHP->hwndSpoolerContainer, CM_REMOVERECORD,
                       MPFROMP(&pSpoolerRecord), MPFROM2SHORT(1, CMA_FREE|CMA_INVALIDATE));
            /* Get next container record to delete them sequentially */
            pSpoolerRecord=(SPOOLERRECORD *)WinSendMsg(pHP->hwndSpoolerContainer, CM_QUERYRECORD,
                           NULL, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
        }
    }
    break;

    default:                                /* Default window procedure must be called */
        return((MRESULT)WinDefWindowProc(hwnd, msg, mp1, mp2));
    }
    return((MRESULT)FALSE);                 /* We have handled the message */
}
Example #7
0
HWND HIACreateHanAutomata(HWND hwndOwner,ULONG uId)
{
    return WinCreateWindow(HWND_OBJECT,WCOBJ_HIA,NULL,0,0,0,0,0,hwndOwner,
                HWND_TOP,uId,NULL,NULL);
}
BOOL clbChilds(PCLBOX pclb, PCREATESTRUCT pc) {
   ULONG fl = 0;
   clbSize(pclb);
   if (pclb->fl & WS_DISABLED) fl = WS_DISABLED;
   if (pclb->fl & WS_VISIBLE) fl |= WS_VISIBLE;
   // se stile CLBXS_CHECK crea checkbox
   if (pclb->fl & CLBXS_CHECK) {
      LONG pp[] = {12, PP_BACKGROUNDCOLOR, 4, pclb->lbkgnd};
      pclb->hchk = WinCreateWindow(pclb->hwnd, WC_BUTTON, pc->pszText,
                                   BS_AUTOCHECKBOX | fl,
                                   0, pclb->rclcpt.yBottom, 
                                   pclb->szl.cx, pclb->rclcpt.yTop -
                                   pclb->rclcpt.yBottom, pclb->hwnd,
                                   HWND_TOP, FID_CAPTION, NULL, (PVOID)pp);
      if (*pc->pszText) *pc->pszText = 0;
      fl |= WS_DISABLED;
      if (!pclb->hchk) return FALSE;
      pclb->pfbtn = WinSubclassWindow(pclb->hchk, newchkproc);
   } /* endif */
   // entryfield/dropdownbox
   if (pclb->fl & CLBXS_DROPDOWN) {       // dropdown box
      pclb->hentry = WinCreateWindow(pclb->hwnd, WC_COMBOBOX, NULL,
                                     WS_VISIBLE | fl | CBS_DROPDOWN,
                                     0, pclb->rclef.yBottom,
                                     pclb->rclef.xRight, pclb->rclef.yTop -
                                     pclb->rclef.yBottom, pclb->hwnd,
                                     HWND_TOP, FID_ENTRY, NULL, NULL);
      pclb->pfef = WinSubclassWindow(pclb->hentry, newcomboproc);
   } else {                               // entryfield
      pclb->hentry = WinCreateWindow(pclb->hwnd, WC_ENTRYFIELD, NULL,
                                     WS_VISIBLE | ES_MARGIN | ES_AUTOSCROLL |
                                     fl, 0,
                                     pclb->rclef.yBottom,
                                     pclb->rclef.xRight, pclb->rclef.yTop -
                                     pclb->rclef.yBottom, pclb->hwnd,
                                     HWND_TOP, FID_ENTRY, NULL, NULL);
   } /* endif */
   // bottone add
   pclb->hadd = WinCreateWindow(pclb->hwnd, WC_BUTTON, NULL,
                                WS_VISIBLE | WS_DISABLED | fl | BS_PUSHBUTTON |
                                BS_USERBUTTON | BS_NOCURSORSELECT,
                                pclb->ptladd.x, pclb->ptladd.y, 
                                pclb->csdbtn, pclb->csdbtn, pclb->hwnd,
                                HWND_TOP, FID_ADD, NULL, NULL);
   pclb->hrem = WinCreateWindow(pclb->hwnd, WC_BUTTON, NULL,
                                WS_VISIBLE | WS_DISABLED | fl | BS_PUSHBUTTON |
                                BS_USERBUTTON | BS_NOCURSORSELECT,
                                pclb->ptlrem.x, pclb->ptlrem.y, 
                                pclb->csdbtn, pclb->csdbtn, pclb->hwnd,
                                HWND_TOP, FID_REMOVE, NULL, NULL);
   pclb->hfind = WinCreateWindow(pclb->hwnd, WC_BUTTON, NULL,
                                 WS_VISIBLE | fl | BS_PUSHBUTTON |
                                 BS_USERBUTTON | BS_NOCURSORSELECT,
                                 pclb->ptlfnd.x, pclb->ptlfnd.y, 
                                 pclb->csdbtn, pclb->csdbtn, pclb->hwnd,
                                 HWND_TOP, FID_FIND, NULL, NULL);
   // listbox
   if (pclb->fl & CLBXS_HSCROLL) fl |= LS_HORZSCROLL;
   if (pclb->fl & CLBXS_MULTISEL) fl |= LS_MULTIPLESEL;
   if (pclb->fl & CLBXS_EXTENDSEL) fl |= LS_EXTENDEDSEL;
   if (pclb->fl & CLBXS_OWNERDRAW) fl |= LS_OWNERDRAW;
   pclb->hlbx = WinCreateWindow(pclb->hwnd, WC_LISTBOX, NULL,
                                WS_VISIBLE | LS_NOADJUSTPOS | fl,
                                0, pclb->rcllbx.yBottom, 
                                pclb->szl.cx, pclb->rcllbx.yTop -
                                pclb->rcllbx.yBottom, pclb->hwnd,
                                HWND_TOP, FID_LIST, NULL, NULL);
   if (!pclb->pfbtn) // se non si Š ottenuto con il subclassing
      pclb->pfbtn = (PFNWP)WinQueryWindowPtr(pclb->hadd, QWP_PFNWP);                             
   pclb->pflbx = WinSubclassWindow(pclb->hlbx, clblboxproc);
   if (!pclb->pfef)
      pclb->pfef = (PFNWP)WinQueryWindowPtr(pclb->hentry, QWP_PFNWP);
   // setta massimo numero caratteri ammessi nell'entryfield
   if (pclb->cchef)
      pclb->pfef(pclb->hentry, EM_SETTEXTLIMIT, (MPARAM)pclb->cchef, MPVOID);
   else
      pclb->cchef = 32;
   return (BOOL)(pclb->hentry && pclb->hadd && pclb->hrem &&
                 pclb->hfind && pclb->hlbx && pclb->pfbtn &&
                 pclb->pflbx && pclb->pfef);
}
BOOL CreateNotebookWindow( HWND hwndFrame )
{
    BOOL fSuccess = TRUE;

    // Make the notebook's id FID_CLIENT so we don't need a client window. This
    // will make the notebook automatically size with the frame window and
    // eliminate the need for a client window.

    hwndBook = WinCreateWindow( hwndFrame, WC_NOTEBOOK, NULL,
                BKS_BACKPAGESBR | BKS_MAJORTABRIGHT | BKS_ROUNDEDTABS |
                BKS_STATUSTEXTCENTER | BKS_SPIRALBIND | WS_VISIBLE,
                0, 0, 0, 0, hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL );

    if( hwndBook )
    {
        int          i, cxTab = 0, cyTab = 0, cxPage = 0, cyPage = 0;
        FONTMETRICS  fm;
        HPS          hps = WinGetPS( hwndBook );

        if( GpiQueryFontMetrics( hps, sizeof fm, &fm ) )
        {
            cyTab = fm.lMaxBaselineExt;

            // Set the page background color to grey so it is the same as
            // a dialog box.

            if( !WinSendMsg( hwndBook, BKM_SETNOTEBOOKCOLORS,
                             MPFROMLONG( SYSCLR_FIELDBACKGROUND ),
                             MPFROMSHORT( BKA_BACKGROUNDPAGECOLORINDEX ) ) )
                Msg( "BKM_SETNOTEBOOKCOLRS (BACKPAGE) RC(%X)",
                     HWNDERR( hwndBook ) );

            // Set the tab background color to grey so it is the same as
            // the page background. Note that the page packground also
            // dictates the color of the foreground tab (the one attached
            // to the top page). We want to make the background of all the
            // tabs to be the same color.

            if( !WinSendMsg( hwndBook, BKM_SETNOTEBOOKCOLORS,
                             MPFROMLONG( SYSCLR_FIELDBACKGROUND ),
                             MPFROMSHORT( BKA_BACKGROUNDMAJORCOLORINDEX ) ) )
                Msg( "BKM_SETNOTEBOOKCOLRS (BACKTAB) RC(%X)",
                     HWNDERR( hwndBook ) );

            // Insert all the pages into the notebook and configure them.
            // The dialog boxes will also be loaded now. Also, the width and
            // height of the biggest dialog will be passed back as well as the
            // width of the widest tab text.

            for( i = 0; i < PAGE_COUNT && fSuccess; i++ )
                fSuccess = SetUpPage( hps, &PgConsts[ i ], &cxTab, &cxPage,
                                      &cyPage );

            if( fSuccess )
            {
                // Set the tab height and width based on the biggest bitmap.

                WinSendMsg( hwndBook, BKM_SETDIMENSIONS,
                            MPFROM2SHORT( cxTab + TAB_CX_MARGIN,
                                          cyTab + TAB_CY_MARGIN ),
                            MPFROMSHORT( BKA_MAJORTAB ) );

                // Set the minor tab height/width to zero so we get rid of the
                // bottom part of the notebook.

                WinSendMsg( hwndBook, BKM_SETDIMENSIONS,
                            MPFROM2SHORT( 0, 0 ), MPFROMSHORT( BKA_MINORTAB ) );

                fSuccess = SetFramePos( hwndFrame, cxPage, cyPage );
                if( !fSuccess )
                    WinDestroyWindow( hwndBook );
            }
            else
                WinDestroyWindow( hwndBook );
        }
        else
        {
            fSuccess = FALSE;
            WinDestroyWindow( hwndBook );
            Msg( "CreateNBWindow GpiQuery..Metrics RC(%X)", HWNDERR(hwndBook) );
        }

        WinReleasePS( hps );
    }
    else
    {
        fSuccess = FALSE;
        Msg( "CreateNotebookWindow WinCreateWindow RC(%X)",HWNDERR(hwndFrame));
    }

    return fSuccess;
}
Example #10
0
void StartSwapMon (ULONG id) {

  ULONG       x = swpClock.x,y = swpClock.y;
  static BOOL first = TRUE;

  if(first) {
    swpSwap.x = xScreen - (xScreen / 4);
    swpHard.x = xScreen / 3;
    swpCPU.x = xScreen - (xScreen / 3);
    swpClip.x = (xScreen / 2) - 24;
    swpMem.x = xScreen / 4;
    swpTask.x = (xScreen / 2) + 24;
    {
      SWP swp;

      if(WinGetMaxPosition(hwndConfig,&swp)) {
        if(swp.y < 0)
          swp.y = 0;
        swpHard.y = swpSwap.y = swpClock.y = swpCPU.y = swpClip.y =
          swpMem.y = swpTask.y = swp.y;
      }
    }
    LoadSWP("ClockSwp",
            &swpClock);
    LoadSWP("SwapSwp",
            &swpSwap);
    LoadSWP("HardSwp",
            &swpHard);
    LoadSWP("CPUSwp",
            &swpCPU);
    LoadSWP("ClipSwp",
            &swpClip);
    LoadSWP("MemSwp",
            &swpMem);
    LoadSWP("TaskSwp",
            &swpTask);
    first = FALSE;
  }

  switch(id) {
    case SWAP_FRAME:
      x = swpSwap.x;
      y = swpSwap.y;
      break;
    case HARD_FRAME:
      x = swpHard.x;
      y = swpHard.y;
      break;
    case CPU_FRAME:
      x = swpCPU.x;
      y = swpCPU.y;
      break;
    case CLP_FRAME:
      if(!ClipHwnd)
        return;
      x = swpClip.x;
      y = swpClip.y;
      break;
    case MEM_FRAME:
      x = swpMem.x;
      y = swpMem.y;
      break;
    case TSK_FRAME:
      x = swpTask.x;
      y = swpTask.y;
      break;
  }
  if(WinCreateWindow(HWND_DESKTOP,
                     monwinclass,
                     (PSZ)NULL,
                     WS_CLIPSIBLINGS |
                     SS_TEXT | DT_CENTER | DT_VCENTER,
                     x,
                     y,
                     0,
                     0,
                     HWND_DESKTOP,
                     HWND_TOP,
                     id,
                     MPVOID,
                     MPVOID)) {
    switch(id) {
      case CPU_FRAME:
        if(!StartCPUThreads())
          WinDestroyWindow(CPUHwnd);
        break;
    }
  }
  else
    WarbleBeep();
}
MRESULT EXPENTRY ClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
	static HWND hwndFrame, hwndButton[10];
	static INT  cxClient, cyClient, cyChar;
	static LONG ButtonWidth, ButtonHeight;
	static CLR  buttonColour;
	CHAR        szBuffer[32];
	FONTMETRICS fm;
	HAB         hab;
	HPS         hps;
	INT         id;
	RECTL       rcl;

	switch(msg) {
		case WM_CREATE:
			hab = WinQueryAnchorBlock(hwnd);
			hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
			hps = WinGetPS(hwnd);
			GpiQueryFontMetrics(hps, sizeof(fm),&fm);
			cyChar = fm.lMaxBaselineExt;
			WinReleasePS(hps);
			buttonColour.Index = 0x00CCCCCC;

// Buttons should be big enough to hold the pointer, with a 4 pixel border
			ButtonWidth = WinQuerySysValue(HWND_DESKTOP, SV_CXPOINTER) + 4;
			ButtonHeight = WinQuerySysValue(HWND_DESKTOP, SV_CYPOINTER) + 4;
			hwndButton[0] = WinCreateWindow(hwnd, SHADEDBTNCLASS, "100", WS_VISIBLE | GBT_NORIGHTLINE | GBT_GRAPHIC, 0, 0, ButtonWidth, ButtonHeight, hwnd, HWND_BOTTOM, 0, NULL, NULL);
			hwndButton[1] = WinCreateWindow(hwnd, SHADEDBTNCLASS, "101", WS_VISIBLE | GBT_NOLEFTLINE | GBT_GRAPHIC, 0, 0, ButtonWidth, ButtonHeight, hwnd, HWND_BOTTOM, 1, NULL, NULL);

// This is the status bar
			hwndButton[2] = WinCreateWindow(hwnd, SHADEDBTNCLASS, "Status Bar", WS_VISIBLE | GBT_NOPUSH, 0, 0, 0, cyChar * 5 / 4, hwnd, HWND_BOTTOM, 2, NULL, NULL);
			sprintf(szBuffer, "Red: %d Green: %d Blue: %d", buttonColour.rgb.red, buttonColour.rgb.green, buttonColour.rgb.blue);
			WinSetWindowText(hwndButton[2], szBuffer);

// Buttons to change the colour of the about button
			hwndButton[3] = WinCreateWindow(hwnd, SHADEDBTNCLASS, "<", WS_VISIBLE | GBT_NORIGHTLINE, 0, 0, ButtonWidth, cyChar * 5 / 4, hwnd, HWND_BOTTOM, 3, NULL, NULL);
			hwndButton[4] = WinCreateWindow(hwnd, SHADEDBTNCLASS, ">", WS_VISIBLE | GBT_NOLEFTLINE, 0, 0, ButtonWidth, cyChar * 5 / 4, hwnd, HWND_BOTTOM, 4, NULL, NULL);
			hwndButton[5] = WinCreateWindow(hwnd, SHADEDBTNCLASS, "<", WS_VISIBLE | GBT_NORIGHTLINE, 0, 0, ButtonWidth, cyChar * 5 / 4, hwnd, HWND_BOTTOM, 5, NULL, NULL);
			hwndButton[6] = WinCreateWindow(hwnd, SHADEDBTNCLASS, ">", WS_VISIBLE | GBT_NOLEFTLINE, 0, 0, ButtonWidth, cyChar * 5 / 4, hwnd, HWND_BOTTOM, 6, NULL, NULL);
			hwndButton[7] = WinCreateWindow(hwnd, SHADEDBTNCLASS, "<", WS_VISIBLE | GBT_NORIGHTLINE, 0, 0, ButtonWidth, cyChar * 5 / 4, hwnd, HWND_BOTTOM, 7, NULL, NULL);
			hwndButton[8] = WinCreateWindow(hwnd, SHADEDBTNCLASS, ">", WS_VISIBLE | GBT_NOLEFTLINE, 0, 0, ButtonWidth, cyChar * 5 / 4, hwnd, HWND_BOTTOM, 8, NULL, NULL);
// info about this program
			hwndButton[9] = WinCreateWindow(hwnd, SHADEDBTNCLASS, "About", WS_VISIBLE | GBT_RIGHTROUND | GBT_LEFTROUND, 0, 0, 2 * ButtonWidth, cyChar * 5 / 4, hwnd, HWND_BOTTOM, 9, NULL, NULL);

// change the colour of the buttons
			WinSendMsg(hwndButton[3], GBM_SETCOLOR, MPFROMLONG(0x00FFCCCC), NULL);
			WinSendMsg(hwndButton[4], GBM_SETCOLOR, MPFROMLONG(0x00FFCCCC), NULL);
			WinSendMsg(hwndButton[5], GBM_SETCOLOR, MPFROMLONG(0x00CCFFCC), NULL);
			WinSendMsg(hwndButton[6], GBM_SETCOLOR, MPFROMLONG(0x00CCFFCC), NULL);
			WinSendMsg(hwndButton[7], GBM_SETCOLOR, MPFROMLONG(0x00CCCCFF), NULL);
			WinSendMsg(hwndButton[8], GBM_SETCOLOR, MPFROMLONG(0x00CCCCFF), NULL);
			WinSendMsg(hwndButton[9], GBM_SETCOLOR, MPFROMLONG(buttonColour.Index), NULL);
			return 0;
		case WM_SIZE:
			hps = WinGetPS(hwnd);
			GpiQueryFontMetrics(hps, sizeof(fm),&fm);
			cyChar = fm.lMaxBaselineExt;
			WinReleasePS(hps);
			cxClient = SHORT1FROMMP(mp2);
			cyClient = SHORT2FROMMP(mp2);
// Center the buttons
			for(id = 0; id < 2; id++)
				WinSetWindowPos(hwndButton[id], NULLHANDLE, (cxClient >> 1) + ButtonWidth * (id - 1), (cyClient - ButtonHeight) >> 1, 0, 0, SWP_MOVE);
			for(id = 3; id < 9; id++)
				WinSetWindowPos(hwndButton[id], NULLHANDLE, (cxClient >> 1) + ButtonWidth * (-(id % 2)), ((cyClient + ButtonHeight) >> 1) + (3 - (id-1) / 2) * cyChar * 5 / 4, 0, 0, SWP_MOVE);
			WinSetWindowPos(hwndButton[9], NULLHANDLE, (cxClient >> 1) - ButtonWidth, ((cyClient - ButtonHeight) >> 1) - cyChar * 15 / 8, 0, 0, SWP_MOVE);
// make the status bar span the width of the window
			WinSetWindowPos(hwndButton[2], NULLHANDLE, 0, 0, cxClient, cyChar * 5 / 4, SWP_SIZE);

// Enable "Smaller" button if window is large enough for the buttons
			if (!WinIsWindowEnabled(hwndButton[0]) && ((9 * cxClient / 10) >= (2 * ButtonWidth)) && ((9  * cyClient / 10) >= (ButtonHeight + cyChar * 15 / 2)))
				WinEnableWindow(hwndButton[0], TRUE);
// Disable "Smaller" button if window is too small for the buttons
			if (WinIsWindowEnabled(hwndButton[0]) && (((9 * cxClient / 10) < (2 * ButtonWidth)) || ((9  * cyClient / 10) < (ButtonHeight + cyChar * 15 / 2))))
				WinEnableWindow(hwndButton[0], FALSE);
			return 0;
		case WM_COMMAND:
			WinQueryWindowRect(hwnd, &rcl);
			WinMapWindowPoints(hwnd, HWND_DESKTOP, (PPOINTL) &rcl, 2);

			switch(COMMANDMSG(&msg)->cmd) {
				case 0: // "Smaller"
					rcl.xLeft   += cxClient / 20;
					rcl.xRight  -= cxClient / 20;
					rcl.yBottom += cyClient / 20;
					rcl.yTop    -= cyClient / 20;
					break;
				case 1: // "Larger"
					rcl.xLeft   -= cxClient / 20;
					rcl.xRight  += cxClient / 20;
					rcl.yBottom -= cyClient / 20;
					rcl.yTop    += cyClient / 20;
					break;
				case 3: // change red
					buttonColour.rgb.red--;
					if (buttonColour.rgb.red == 0)
						WinEnableWindow(hwndButton[3], FALSE);
					if (!WinIsWindowEnabled(hwndButton[4]))
						WinEnableWindow(hwndButton[4], TRUE);
					break;
				case 4:
					buttonColour.rgb.red++;
					if (buttonColour.rgb.red == 255)
						WinEnableWindow(hwndButton[4], FALSE);
					if (!WinIsWindowEnabled(hwndButton[3]))
						WinEnableWindow(hwndButton[3], TRUE);
					break;
				case 5: // change green
					buttonColour.rgb.green--;
					if (buttonColour.rgb.green == 0)
						WinEnableWindow(hwndButton[5], FALSE);
					if (!WinIsWindowEnabled(hwndButton[6]))
						WinEnableWindow(hwndButton[6], TRUE);
					break;
				case 6:
					buttonColour.rgb.green++;
					if (buttonColour.rgb.green == 255)
						WinEnableWindow(hwndButton[6], FALSE);
					if (!WinIsWindowEnabled(hwndButton[5]))
						WinEnableWindow(hwndButton[5], TRUE);
					break;
				case 7:// change blue
					buttonColour.rgb.blue--;
					if (buttonColour.rgb.blue == 0)
						WinEnableWindow(hwndButton[7], FALSE);
					if (!WinIsWindowEnabled(hwndButton[8]))
						WinEnableWindow(hwndButton[8], TRUE);
					break;
				case 8:
					buttonColour.rgb.blue++;
					if (buttonColour.rgb.blue == 255)
						WinEnableWindow(hwndButton[8], FALSE);
					if (!WinIsWindowEnabled(hwndButton[7]))
						WinEnableWindow(hwndButton[7], TRUE);
					break;
				case 9:
					WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, NULLHANDLE, IDD_ABOUT, NULL);
					return 0;
			}
			sprintf(szBuffer, "Red: %d Green: %d Blue: %d", buttonColour.rgb.red, buttonColour.rgb.green, buttonColour.rgb.blue);
			WinSetWindowText(hwndButton[2], szBuffer);
			WinCalcFrameRect(hwndFrame, &rcl, FALSE);
			WinSetWindowPos(hwndFrame, NULLHANDLE, rcl.xLeft, rcl.yBottom, rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, SWP_MOVE | SWP_SIZE);
			WinPostMsg(hwndButton[9], GBM_SETCOLOR, MPFROMLONG(buttonColour.Index), NULL);
			return 0;
		case WM_ERASEBACKGROUND:
			WinFillRect((HPS)LONGFROMMP(mp1), PVOIDFROMMP(mp2), CLR_PALEGRAY);
			return 0;
	}
	return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Example #12
0
/*
	SAVER_PROC
	This is the entry point into the saver module that is called by
	the ScreenSaver program.
	There should be no reason to alter the code.
	Depending on the requested function, the following tasks
	are performed:
	* call the configuration dialog of the saver module
	* copy the name of the saver module into the supplied buffer
	* tell if the saver module is enabled
	* set the "enabled" state of the saver module
	* start the saver
	* stop the saver
	Note that before any processing is done, module configuration data is
	loaded from the INI-files.
*/
void	EXPENTRY SAVER_PROC(int function, HAB _hab, HWND hwndOwner, char *appname, void *buffer)
{
	hab = _hab;
	application_name = appname;
	// load all configuration data from INI-file
	load_configuration_data();
	switch(function){
	case FUNCTION_CONFIGURE:
		// call the configuration dialog
		WinDlgBox(HWND_DESKTOP, hwndOwner, ConfigureDlgProc,
		  hmodDLL, IDD_CONFIGURE, application_name);
		return;
	case FUNCTION_STARTSAVER:
		// start the saver
		// get "low priority" state from supplied buffer (BOOL *)
		low_priority = *((BOOL *)buffer);
		// query size of screen
		screenSizeX = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
		screenSizeY = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
		// register window class for the saver window
		WinRegisterClass(hab, (PSZ)modulename,
		  (PFNWP)SaverWindowProc, 0, 0);
		// create the saver window
		hwndSaver = WinCreateWindow(HWND_DESKTOP, (PSZ)modulename,
		  (PSZ)NULL, WS_VISIBLE, 0, 0, screenSizeX, screenSizeY,
		  HWND_DESKTOP, HWND_TOP, 0, NULL, NULL);
		return;
	case FUNCTION_STOPSAVER:
		// stop the saver
		if(low_priority){
			stop_priority_thread = TRUE;
			DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, 0, tidPriority);
			DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, 0, tidDraw);
			DosWaitThread(&tidPriority, DCWW_WAIT);
//			  DosKillThread(tidPriority);	***** kills thread 1 under OS/2 2.11
		}
		// tell drawing-thread to stop
		stop_draw_thread = TRUE;
		if(DosWaitThread(&tidDraw, DCWW_NOWAIT) == ERROR_THREAD_NOT_TERMINATED){
			// if priority of drawing-thread was set to idle time
			// priority, set it back to normal value
			DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, PRTYD_MAXIMUM, tidDraw);
			// wait until drawing-thread has ended
			DosWaitThread(&tidDraw, DCWW_WAIT);
		}

		if(hwndSaver != NULLHANDLE){
			// move saver window to front
			WinSetWindowPos(hwndSaver, HWND_TOP,
			  0, 0, 0, 0, SWP_ZORDER);
			// destroy saver window
			WinDestroyWindow(hwndSaver);
			hwndSaver = NULLHANDLE;
		}
		return;
	case FUNCTION_QUERYNAME:
		// copy module name to supplied buffer (CHAR *)
		strcpy(buffer, modulename);
		return;
	case FUNCTION_QUERYENABLED:
		// copy "enabled" state to supplied buffer (BOOL *)
		*((BOOL *)buffer) = configuration_data.enabled;
		return;
	case FUNCTION_SETENABLED:
		// get new "enabled" state from supplied buffer (BOOL *)
		configuration_data.enabled = *((BOOL *)buffer);
		PrfWriteProfileData(HINI_USER, (PSZ)application_name, (PSZ)modulename, (PSZ)&configuration_data, sizeof(configuration_data));
		return;
	}

	// illegal function request
	WinAlarm(HWND_DESKTOP, WA_ERROR);
	return;
}
BOOL    kstCreate(HWND hwndFrame)
{
    HWND    hwndTitle = WinWindowFromID(hwndFrame, FID_TITLEBAR) ;
    ULONG   flStyle ;

#ifdef DEBUG
    TRACE("kstCreate\n") ;
#endif

    /*
     * notify to Frame Window
     */

    kstCtl.hwndEv = hwndFrame ;
    kstAlt.hwndEv = hwndFrame ;

    /*
     * Disable title-bar to paint over siblings
     */

    flStyle = WinQueryWindowULong(hwndTitle, QWL_STYLE) ;
    flStyle |= WS_CLIPCHILDREN ;
    WinSetWindowULong(hwndTitle, QWL_STYLE, flStyle) ;

    /*
     * Create Modal Key State Windows
     */

    WinRegisterClass(WinQueryAnchorBlock(hwndFrame), kstName, kstProc,
            (CS_CLIPSIBLINGS | CS_SYNCPAINT), sizeof(PVOID)) ;

    hwndStateCtl = WinCreateWindow(
            hwndTitle,
            kstName,
            NULL,
            0,
            0, 0, 0, 0,
            hwndFrame,
            HWND_TOP,
            IDW_CTLST,
            &kstCtl,
            NULL) ;
    hwndStateAlt = WinCreateWindow(
            hwndTitle,
            kstName,
            NULL,
            0,
            0, 0, 0, 0,
            hwndFrame,
            HWND_TOP,
            IDW_ALTST,
            &kstAlt,
            NULL) ;

    if (hwndStateCtl == NULLHANDLE || hwndStateAlt == NULLHANDLE) {

#ifdef DEBUG
        TRACE("kstCreate - failed %08x, %08x\n", hwndStateCtl, hwndStateAlt) ;
#endif

        kstDestroy() ;
        return FALSE ;
    }
    return TRUE ;
}
Example #14
0
SHORT TOOLBAR :: AddButton (USHORT id, USHORT usBitmapID, SHORT sPos, PSZ psz,
                            BOOL fHelp)
{
    // room left for another button?
    if (c >= TOOLBARBUTTONSMAX)
        return -1;

    CHAR   ach[11];
    sprintf (ach, "#%u", usBitmapID);

    USHORT   x = X_TBBUTTONS, y = Y_TBBUTTONS;
    USHORT   cx = CX_TBBUTTONS, cy = CY_TBBUTTONS;

    if (id == TBID_SEPERATOR)
        cx = CX_TBSEPERATOR;

    if ((sPos > c) || (sPos == TBPOS_LAST))
        sPos = c;
    else if (sPos == TBPOS_FIRST)
        sPos = 0;

    // shift all buttons (window and ID in id-array) to the "right"
    SWP   swp;
    HWND  hwndButton;

    for (SHORT i = c-1; i >= sPos; i--)
    {
        hwndButton = WinWindowFromID (hwnd, aid[i]);

        WinQueryWindowPos (hwndButton, &swp);
        WinSetWindowPos (hwndButton, 0L, swp.x+cx,swp.y, 0,0, SWP_MOVE);
        aid[i+1] = aid[i];
    }

    // get x-position (in pixels) for button
    for (SHORT i = 0; i < sPos; i++)
    {
        if (aid[i] != TBID_SEPERATOR)
        {
            hwndButton = WinWindowFromID (hwnd, aid[i]);
            WinQueryWindowPos (hwndButton, &swp);
            x += swp.cx;
        }
        else
            x += CX_TBSEPERATOR;
    }

    // insert button id in array
    aid[sPos] = id;
    apsz[sPos] = psz;
    c ++;

    if (id != TBID_SEPERATOR)
    {
        // create button control
        //        HWND   hwndButton =
        if (! fHelp)
            WinCreateWindow (hwnd, WC_BUTTON, ach,
                             WS_VISIBLE | WS_TABSTOP | BS_NOPOINTERFOCUS |
                             BS_PUSHBUTTON | BS_BITMAP,
                             x,y, cx,cy, hwnd, HWND_TOP, id, NULL, NULL);
        else
            WinCreateWindow (hwnd, WC_BUTTON, ach,
                             WS_VISIBLE | WS_TABSTOP | BS_NOPOINTERFOCUS |
                             BS_PUSHBUTTON | BS_BITMAP | BS_HELP,
                             x,y, cx,cy, hwnd, HWND_TOP, id, NULL, NULL);
    }
    return sPos;
}
Example #15
0
bool GUIXCreateWindow( gui_window *wnd, gui_create_info *info,
                       gui_window *parent )
{
    DWORD               style;
    HMENU               hmenu;
    gui_coord           pos;
    gui_coord           size;
    HWND                parent_hwnd;
    LPSTR               class_name;
    HWND                hwnd;
    wmcreate_info       wmcreateinfo;
    HWND                frame_hwnd;
    HWND                client_hwnd;
#ifdef __OS2_PM__
    ULONG               frame_flags;
    ULONG               flags;
    ULONG               show_flags;
    WPI_RECT            rect;
    WPI_RECT            parent_client;
#else
    DWORD               exstyle;
#endif

#ifdef __OS2_PM__
// Get rid of the changable font style for PM GUI app's
    info->style &= ~GUI_CHANGEABLE_FONT;
#endif

    wnd->root_pinfo.force_count = NUMBER_OF_FORCED_REPAINTS;
    wnd->hwnd_pinfo.force_count = NUMBER_OF_FORCED_REPAINTS;

    wnd->parent = parent;
    style = COMMON_STYLES;
    if( parent == NULL ) {
        parent_hwnd = HWND_DESKTOP;
        if( !( info->style & GUI_POPUP ) ) {
            wnd->flags |= IS_ROOT;
        }
    } else {
        parent_hwnd = parent->hwnd;
        if( !( info->style & GUI_POPUP ) ) {
            style |= CHILD_STYLE;
        }
    }
    hmenu = NULLHANDLE;
    if( !GUISetupStruct( wnd, info, &pos, &size, parent_hwnd, &hmenu ) ) {
        return( FALSE );
    }
    if( !(wnd->style & GUI_NOFRAME) ) {
        if( info->text ) {
            style |= WS_CAPTION;
            wnd->flags |= HAS_CAPTION;
        } else {
            style |= WS_BORDER;
        }
    }
    if( info->style & GUI_RESIZEABLE ) {
        style |= WS_THICKFRAME;
    }
    if( info->scroll & GUI_HSCROLL ) {
        style |= WS_HSCROLL;
    }
    if( info->scroll & GUI_VSCROLL ) {
        style |= WS_VSCROLL;
    }
    if( wnd->flags & HAS_CAPTION ) {
        if( info->style & GUI_MAXIMIZE ) {
            style |= WS_MAXIMIZEBOX;
        }
        if( info->style & GUI_MINIMIZE ) {
            style |= WS_MINIMIZEBOX;
        }
        if( info->style & GUI_SYSTEM_MENU ) {
            style |= WS_SYSMENU;
        }
    } else {
        wnd->style &= ~(GUI_MAXIMIZE|GUI_MINIMIZE|GUI_SYSTEM_MENU);
        info->style &= ~(GUI_MAXIMIZE|GUI_MINIMIZE|GUI_SYSTEM_MENU);
    }
    if( info->style & GUI_POPUP ) {
        style |= WS_POPUP;
    }
    if( info->style & GUI_DIALOG_LOOK ) {
        style |= GUI_DIALOG_STYLE;
        class_name = GUIDialogClass;
    } else {
        class_name = GUIClass;
    }

    wnd->font = GUIGetSystemFont();
    GUIInitHint( wnd, info->num_menus, info->menu, MENU_HINT );
    GUISetGUIHint( wnd );
    wmcreateinfo.size = sizeof(wmcreate_info);
    wmcreateinfo.wnd  = wnd;
    wmcreateinfo.info = info;
    hwnd        = NULLHANDLE;
    frame_hwnd  = NULLHANDLE;
    client_hwnd = NULLHANDLE;
#ifdef __OS2_PM__
    /* frame */
    flags = FCF_TASKLIST | FCF_NOBYTEALIGN;
    frame_flags = 0;
    if( wnd->flags & HAS_CAPTION ) {
        flags |= FCF_TITLEBAR;
        if( info->style & GUI_SYSTEM_MENU ) {
            flags |= FCF_SYSMENU;
        }
        if( info->style & GUI_MAXIMIZE ) {
            flags |= FCF_MAXBUTTON;
        }
        if( info->style & GUI_MINIMIZE ) {
            flags |= FCF_MINBUTTON;
        }
        flags |= FCF_BORDER;
    } else {
        if( !(wnd->style & GUI_NOFRAME) ) {
            flags |= FCF_BORDER;
            frame_flags |= FS_BORDER;
        }
        wnd->style &= ~(GUI_MAXIMIZE|GUI_MINIMIZE|GUI_SYSTEM_MENU);
        info->style &= ~(GUI_MAXIMIZE|GUI_MINIMIZE|GUI_SYSTEM_MENU);
    }
    if( info->style & GUI_RESIZEABLE ) {
        flags |= FCF_SIZEBORDER;
    }
    if( parent_hwnd == HWND_DESKTOP ) {
        if( info->num_menus > 0 ) {
            //flags |= FCF_MENU;
        }
    }
    if( info->scroll & GUI_HSCROLL ) {
        flags |= FCF_HORZSCROLL;
    }
    if( info->scroll & GUI_VSCROLL ) {
        flags |= FCF_VERTSCROLL;
    }
    if( info->style & GUI_DIALOG_LOOK ) {
        flags |= FCF_DLGBORDER;
    }
    if( info->style & GUI_POPUP ) {
        flags |= FCF_NOMOVEWITHOWNER;
    }
    frame_hwnd = WinCreateStdWindow( parent_hwnd, frame_flags | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, &flags,
                                     NULL, info->text,
                                     0, (HMODULE)0, 0, NULL );
    if( frame_hwnd != NULLHANDLE ) {
        oldFrameProc = _wpi_subclasswindow( frame_hwnd, (WPI_PROC)GUIFrameProc );
        _wpi_setmenu( frame_hwnd, hmenu );
        _wpi_getclientrect( parent_hwnd, &parent_client );
        show_flags = SWP_SIZE | SWP_MOVE;
        WinSetWindowPos( frame_hwnd, HWND_TOP, pos.x, pos.y, size.x, size.y, show_flags );
        hwnd = frame_hwnd;
        if( parent_hwnd == HWND_DESKTOP ) {
            wnd->root_frame = frame_hwnd;
        } else {
            wnd->hwnd_frame = frame_hwnd;
        }
        _wpi_getclientrect( frame_hwnd, &rect );
        client_hwnd = WinCreateWindow( frame_hwnd, class_name, NULL,
                                       WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                                       rect.xLeft, rect.yBottom,
                                       rect.xRight-rect.xLeft,
                                       rect.yTop-rect.yBottom,
                                       frame_hwnd, HWND_TOP, FID_CLIENT,
                                       &wmcreateinfo, NULL );
        if( client_hwnd == NULLHANDLE ) {
            WinDestroyWindow( frame_hwnd );
            frame_hwnd = NULLHANDLE;
            hwnd = NULLHANDLE;
        }
    }
#else
    exstyle = WS_EX_NOPARENTNOTIFY;
#ifdef __NT__
    if( info->style & GUI_3D_BORDER ) {
        exstyle |= WS_EX_CLIENTEDGE;
        style &= ~WS_BORDER;
    }
#endif
    hwnd = _wpi_createwindow_ex( exstyle, class_name, info->text, style, 0, 0, pos.x,
                                 pos.y, size.x, size.y, parent_hwnd, hmenu, GUIMainHInst,
                                 &wmcreateinfo, &frame_hwnd );
#endif
    if( hwnd == NULLHANDLE ) {
        return( FALSE );
    }

    GUISetIcon( wnd, info->icon );

    if( info->style & (GUI_INIT_MAXIMIZED|GUI_INIT_MINIMIZED) ) {
        GUISetRedraw( wnd, FALSE );
        if( info->style & GUI_INIT_MAXIMIZED ) {
            GUIMaximizeWindow( wnd );
        } else if( info->style & GUI_INIT_MINIMIZED ) {
            GUIMinimizeWindow( wnd );
        }
        GUISetRedraw( wnd, TRUE );
        if( wnd->style & GUI_INIT_INVISIBLE ) {
            _wpi_showwindow( hwnd, SW_HIDE );
        }
    }

    if( !(wnd->style & GUI_INIT_INVISIBLE ) ) {
        GUIShowWindowNA( wnd );
    }

    return( wnd != NULL );
}