home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / krcls012.zip / KrClass / source / krmenu.cpp < prev    next >
Text File  |  1997-02-11  |  1KB  |  37 lines

  1. // Kroni's Classes: Objects for standard OS/2 menues
  2. // (c) 1997 Wolfgang Kronberg
  3. // file: krmenu.cpp
  4.  
  5.  
  6. #define INCL_WINSHELLDATA
  7. #include <os2.h>
  8.  
  9. #include "krmenu.hpp"
  10.  
  11. #include <ifont.hpp>
  12. #include <istring.hpp>
  13.  
  14.  
  15. KrMenuBar::KrMenuBar (IFrameWindow *owner, const Style & style)
  16.   : IMenuBar (owner, style)
  17. {
  18.   char buffer [100];
  19.  
  20.   PrfQueryProfileString (                        // Get the system font for menus
  21.     HINI_USERPROFILE,                            // Search os2.ini
  22.     "PM_SystemFonts",                            // Get this application...
  23.     "Menus",                                     // ...with this key
  24.     0,                                           // There's no default since this must always exist
  25.     buffer, sizeof(buffer)                       // The buffer for the output of the function
  26.   );
  27.  
  28.   IString tempStr (buffer);
  29.   int pointPos = tempStr.indexOf ('.');          // Extract point position from "size.name"
  30.   IString name = tempStr.subString(pointPos+1);  // Extract name
  31.   tempStr = tempStr.subString(1,pointPos);       // Extract point size
  32.  
  33.   setFont (IFont (name, tempStr.asInt()) );      // Now set the font.
  34.  
  35. };
  36.  
  37.