DocumentFontDropDown Class Reference

DocumentFontDropDown class itself. This uses the FontDropDown class to provide a font drop down but overides some of the functionality so that it works out the fonts in the current document rather than the fonts avalaible in the system. More...

#include <fontdrop.h>

Inheritance diagram for DocumentFontDropDown:

FontDropDown DropDown ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 DocumentFontDropDown ()
 Default constructor for DocumentFontDropDown Class...
virtual ~DocumentFontDropDown ()
 Default destructor for DocumentFontDropDown Class...
BOOL FillInFontList (Document *WorkDoc)
 "Fills in" the attached control with appropriate entries for the current DocumentFontDropDown settings. To do this it reads the current fonts from the specified document. If the document is NULL then it will show a blank list. If no document fonts are in use then it will also show a blank list and fill in the top entry with a suitable message.

Detailed Description

DocumentFontDropDown class itself. This uses the FontDropDown class to provide a font drop down but overides some of the functionality so that it works out the fonts in the current document rather than the fonts avalaible in the system.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/11/95

Definition at line 247 of file fontdrop.h.


Constructor & Destructor Documentation

DocumentFontDropDown::DocumentFontDropDown  ) 
 

Default constructor for DocumentFontDropDown Class...

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> Date: 13/11/95

Definition at line 759 of file fontdrop.cpp.

00760 {
00761     TheTopItem.FontName = _R(IDS_NO_FONTSINDOC);
00762     TheTopItem.Type = FC_UNDEFINED;
00763 }

DocumentFontDropDown::~DocumentFontDropDown  )  [virtual]
 

Default destructor for DocumentFontDropDown Class...

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> Date: 13/11/95

Definition at line 776 of file fontdrop.cpp.

00777 {
00778     KillList();
00779 }


Member Function Documentation

BOOL DocumentFontDropDown::FillInFontList Document WorkDoc  ) 
 

"Fills in" the attached control with appropriate entries for the current DocumentFontDropDown settings. To do this it reads the current fonts from the specified document. If the document is NULL then it will show a blank list. If no document fonts are in use then it will also show a blank list and fill in the top entry with a suitable message.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> Date: 13/11/95
Parameters:
WorkDoc pointer to the document to extact the font list from, NULL if none [INPUTS] which means show blank list
Returns:
TRUE if it filled in the list successfully
See also:
FontDropDown::DecodeSelection; FontDropDown::AddSpecialEntry

Definition at line 804 of file fontdrop.cpp.

00805 {
00806     ERROR2IF(ParentDlg == NULL, FALSE, "FontDropDown not properly initialised");
00807 
00808     BeginSlowJob();
00809 
00810     SetListRedraw(FALSE);   // Disable redraw while updating
00811     KillList();             // Delete combobox contents and empty the fonts list
00812     //ClearList();          // Delete combobox contents
00813 
00814     // Setup the static class pointer variable so we can add things to this dropdown...
00815     CurrentFontDropDown = (void *)this;
00816 
00817     //if(Fonts.GetCount() == 0)
00818     //{
00819     if (WorkDoc == NULL)
00820     {
00821         // Fill in one item in the list which is no document fonts being used
00822         String_8 DashString(_R(IDS_K_FINFODLG_DASH));
00823         TheTopItem.FontName = DashString;
00824         TheTopItem.Type = FC_UNDEFINED;
00825         //AddFontToList((TCHAR*)&TheTopItem.FontName, TheTopItem.Type);
00826     }
00827     else
00828     {
00829         // Build the font list for the specified document
00830         // This will NOT be alphabetical
00831         FontList DocFonts;
00832         DocFonts.Build(WorkDoc);
00833 
00834         FontListItem* FontItem = DocFonts.GetFirstItem();
00835         if (FontItem == NULL)
00836         {
00837             // Fill in one item in the list which is no document fonts being used
00838             TheTopItem.FontName = _R(IDS_NO_FONTSINDOC);
00839             TheTopItem.Type = FC_UNDEFINED;
00840             //AddFontToList((TCHAR*)&TheTopItem.FontName, TheTopItem.Type);
00841         }
00842         else
00843         {
00844             //BOOL FirstInList = TRUE;
00845             
00846             // fill up the list
00847             while (FontItem != NULL)
00848             {
00849                 // get the name
00850                 String_64 Name = FontItem->GetFontName();
00851                 
00852                 WORD Handle = FONTMANAGER->GetFontHandle(&Name);
00853 
00854                 // check the style
00855                 INT32 Style = FontItem->GetFontStyle();
00856                 if(Style & 1)
00857                     Name += _T(" -Bold");
00858                 if(Style & 2)
00859                     Name += _T(" -Italic");
00860                 
00861                 if(Handle > 0)
00862                 {
00863                     if (FONTMANAGER->IsFontReplaced(Handle))
00864                         Name += _T(" *");
00865                 }
00866                 FontClass Type = FontItem->GetFontClass();
00867 
00868                 AddFontToList(Name, Type);
00869                 
00870                 FontItem = DocFonts.GetNextItem(FontItem);
00871 
00872                 ContinueSlowJob();
00873             }
00874         }
00875     }
00876     //}
00877 
00878     // Work out the top item, if any, on the alphabetically sorted list
00879     // ready for putting in the top combo box item
00880     FontDropItem *pTopItem = (FontDropItem *)Fonts.GetHead();
00881     if (pTopItem != NULL)
00882     {
00883         // Fill in the top item in the list
00884         TheTopItem.FontName = pTopItem->FontName;
00885         TheTopItem.Type = pTopItem->Type;
00886     }
00887 
00888     ListItem *Item = Fonts.GetHead();
00889 
00890     while (Item != NULL)
00891     {
00892         // Add the font in the list to the combo box
00893         AddItem((void *) Item);
00894 
00895         // Try the next item
00896         Item = Fonts.GetNext(Item);
00897     }
00898 
00899     // Re-enable redraw
00900     SetListRedraw(TRUE);
00901 
00902     // We have no concept of a selected font
00903     SetSelectedIndex(-1);
00904 
00905     EndSlowJob();
00906 
00907     return(TRUE);
00908 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:47 2007 for Camelot by  doxygen 1.4.4