#include <palmenu.h>
Inheritance diagram for OpPalettePopupCommand:
Public Member Functions | |
virtual void | Do (OpDescriptor *pOpDesc) |
Handles the menu selection. | |
Static Public Member Functions | |
static BOOL | Init (BitmapExportPaletteControl *, BmapPrevDlg *) |
static OpState | GetCommandState (String_256 *ShadeReason, OpDescriptor *pOpDesc) |
Static Protected Member Functions | |
static BOOL | InitPolymorphicCommand (TCHAR *OpToken, UINT32 MenuTextID) |
This function registers a menu operation. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpPalettePopupCommand) | |
Static Private Attributes | |
static BitmapExportPaletteControl * | m_pPaletteControl = 0 |
static BmapPrevDlg * | m_pBmapPrevDlg = 0 |
Definition at line 146 of file palmenu.h.
|
|
|
|
Definition at line 242 of file palmenu.cpp. 00243 { 00244 OpState OpSt; 00245 OpSt.Greyed = FALSE; 00246 00247 // Get the properties of the colour under consideration 00248 BOOL bLocked = m_pPaletteControl->GetSelectedColourLocked(); 00249 BOOL bDeleted = m_pPaletteControl->GetSelectedColourDeleted(); 00250 BOOL bWebSafe = m_pPaletteControl->GetSelectedColourWebSafe(); 00251 BOOL bTransparentBackground = BmapPrevDlg::m_pExportOptions->IsBackgroundTransparent(); 00252 BOOL bTransparent = m_pPaletteControl->GetSelectedColourTransparent(); 00253 BOOL bSupportsTransp = BmapPrevDlg::m_pExportOptions->GetSupportsTransparency(); 00254 00255 // Locked menu item 00256 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_LOCKED ) ) 00257 { 00258 if (bDeleted) 00259 OpSt.Greyed = TRUE; 00260 else if (bLocked) 00261 OpSt.Ticked = TRUE; 00262 } 00263 00264 // WebSafe menu item 00265 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_WEB_SAFE ) ) 00266 { 00267 if (bTransparent || bDeleted || bWebSafe) 00268 OpSt.Greyed = TRUE; 00269 } 00270 00271 // Background transparent menu item 00272 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_TRANSPARENT_BACKGROUND ) ) 00273 { 00274 if (bDeleted || !bSupportsTransp) 00275 OpSt.Greyed = TRUE; 00276 else if (bTransparentBackground) 00277 OpSt.Ticked = TRUE; 00278 } 00279 00280 // Transparent menu item 00281 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_TRANSPARENT ) ) 00282 { 00283 if (bDeleted || !bSupportsTransp) 00284 OpSt.Greyed = TRUE; 00285 else if (bTransparent) 00286 OpSt.Ticked = TRUE; 00287 } 00288 00289 // Delete menu item 00290 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_DELETE ) ) 00291 { 00292 if(bDeleted) 00293 OpSt.RemoveFromMenu = TRUE; 00294 } 00295 00296 // Restore menu item 00297 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_RESTORE ) ) 00298 { 00299 if(!bDeleted) 00300 OpSt.RemoveFromMenu = TRUE; 00301 } 00302 00303 // The 'Sort by...' menu items. 00304 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_SORT_BY_USE ) ) 00305 if (m_pPaletteControl->GetCurrentSortType() == BitmapExportPaletteInterface::SORT_USE) 00306 OpSt.Ticked = TRUE; 00307 00308 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_SORT_BY_LUMINANCE ) ) 00309 if (m_pPaletteControl->GetCurrentSortType() == BitmapExportPaletteInterface::SORT_LUMINANCE) 00310 OpSt.Ticked = TRUE; 00311 00312 if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_SORT_BY_HUE ) ) 00313 if (m_pPaletteControl->GetCurrentSortType() == BitmapExportPaletteInterface::SORT_HUE) 00314 OpSt.Ticked = TRUE; 00315 00316 // Tick it if the 'System Colours' button is pressed in 00317 // if( ( pOpDesc->Token == String_256( OPTOKEN_PALETTE_SYSTEM_COLOURS ) )) 00318 // if (BmapPrevDlg::IsU 00319 // ( m_pDialog->IsSystemColours() ) ) 00320 // OpSt.Ticked = TRUE; 00321 00322 return OpSt; 00323 }
|
|
Definition at line 210 of file palmenu.cpp. 00211 { 00212 m_pPaletteControl = pPaletteControl; 00213 m_pBmapPrevDlg = pBmapPrevDlg; 00214 00215 InitPolymorphicCommand( OPTOKEN_PALETTE_LOCKED, _R(IDS_MENU_LOCKED) ); 00216 InitPolymorphicCommand( OPTOKEN_PALETTE_WEB_SAFE, _R(IDS_MENU_WEB_SAFE) ); 00217 InitPolymorphicCommand( OPTOKEN_PALETTE_TRANSPARENT_BACKGROUND, _R(IDS_MENU_TRANSPARENT_BACK) ); 00218 InitPolymorphicCommand( OPTOKEN_PALETTE_TRANSPARENT, _R(IDS_MENU_TRANSPARENT) ); 00219 00220 InitPolymorphicCommand( OPTOKEN_PALETTE_RESTORE, _R(IDS_MENU_RESTORE) ); 00221 InitPolymorphicCommand( OPTOKEN_PALETTE_DELETE, _R(IDS_MENU_DELETE) ); 00222 00223 InitPolymorphicCommand( OPTOKEN_PALETTE_SYSTEM_COLOURS, _R(IDS_MENU_SYSTEM_COLOURS) ); 00224 00225 InitPolymorphicCommand( OPTOKEN_PALETTE_SORT_BY_USE, _R(IDS_MENU_SORT_BY_USE) ); 00226 InitPolymorphicCommand( OPTOKEN_PALETTE_SORT_BY_LUMINANCE, _R(IDS_MENU_SORT_BY_LUMINANCE) ); 00227 InitPolymorphicCommand( OPTOKEN_PALETTE_SORT_BY_HUE, _R(IDS_MENU_SORT_BY_HUE) ); 00228 00229 return TRUE; 00230 }
|
|
This function registers a menu operation.
Definition at line 180 of file palmenu.cpp. 00181 { 00182 return(RegisterOpDescriptor(0, // Tool ID 00183 MenuTextID, // String resource ID 00184 CC_RUNTIME_CLASS(OpPalettePopupCommand),// Runtime class 00185 OpToken, // Token string 00186 OpPalettePopupCommand::GetCommandState, // GetState function 00187 0, // help ID 00188 0, // bubble help 00189 0, // resource ID 00190 0, // control ID 00191 SYSTEMBAR_ILLEGAL, // Bar ID 00192 FALSE, // Receive system messages 00193 FALSE, // Smart duplicate operation 00194 TRUE, // Clean operation 00195 NULL, // No vertical counterpart 00196 0, // String for one copy only error 00197 DONT_GREY_WHEN_SELECT_INSIDE // Auto state flags 00198 )); 00199 }
|
|
|
|
|