ALERROR CUButton::SetImages (IGMediaDb *pMediaDb, DWORD dwUNID, DWORD dwMaskUNID, int x, int y, int cxWidth, int cyHeight) // SetImages // // Sets the images to use for a bitmap button. This call assumes that the different // modes of the button are on the same bitmap in a horizontal array. The order of // the images is: normal, down, hover. { ALERROR error; if (error = SetUpImage(pMediaDb, dwUNID, dwMaskUNID, x, y, cxWidth, cyHeight)) return error; if (error = SetDownImage(pMediaDb, dwUNID, dwMaskUNID, x + cxWidth, y, cxWidth, cyHeight)) return error; if (error = SetHoverImage(pMediaDb, dwUNID, dwMaskUNID, x + 2 * cxWidth, y, cxWidth, cyHeight)) return error; return NOERROR; }
bool pawsButton::Setup( iDocumentNode* node ) { // Check for toggle csRef<iDocumentAttribute> toggleAttribute = node->GetAttribute("toggle"); if ( toggleAttribute ) { csString value( toggleAttribute->GetValue() ); if ( value == "yes" ) toggle = true; else toggle = false; } // Check for keyboard shortcut for this button const char *key = node->GetAttributeValue("key"); if (key) { if (!strcasecmp(key,"Enter")) keybinding = 10; else keybinding = *key; } // Check for sound to be associated to Buttondown csRef<iDocumentAttribute> soundAttribute = node->GetAttribute( "sound" ); if ( soundAttribute ) { csString soundName = node->GetAttributeValue("sound"); SetSound(soundName); } else { csString name2; csRef<iDocumentNode> buttonLabelNode = node->GetNode( "label" ); if ( buttonLabelNode ) name2 = buttonLabelNode->GetAttributeValue("text"); name2.Downcase(); if(name2 == "ok") SetSound("gui.ok"); else if(name2 == "quit") SetSound("gui.quit"); else if(name2 == "cancel") SetSound("gui.cancel"); else SetSound("sound.standardButtonClick"); } // Check for notify widget csRef<iDocumentAttribute> notifyAttribute = node->GetAttribute( "notify" ); if ( notifyAttribute ) notify = PawsManager::GetSingleton().FindWidget(notifyAttribute->GetValue()); // Check for mouse over changeOnMouseOver = node->GetAttributeValueAsBool("changeonmouseover", false); // Get the down button image name. csRef<iDocumentNode> buttonDownImage = node->GetNode( "buttondown" ); if ( buttonDownImage ) { csString downImageName = buttonDownImage->GetAttributeValue("resource"); SetDownImage(downImageName); downTextOffsetX = buttonDownImage->GetAttributeValueAsInt("textoffsetx"); downTextOffsetY = buttonDownImage->GetAttributeValueAsInt("textoffsety"); } // Get the up button image name. csRef<iDocumentNode> buttonUpImage = node->GetNode( "buttonup" ); if ( buttonUpImage ) { csString upImageName = buttonUpImage->GetAttributeValue("resource"); SetUpImage(upImageName); upTextOffsetX = buttonUpImage->GetAttributeValueAsInt("textoffsetx"); upTextOffsetY = buttonUpImage->GetAttributeValueAsInt("textoffsety"); } // Get the down button image name. csRef<iDocumentNode> buttonGreyDownImage = node->GetNode( "buttongraydown" ); if ( buttonGreyDownImage ) { csString greyDownImageName = buttonGreyDownImage->GetAttributeValue("resource"); SetGreyUpImage(greyDownImageName); } // Get the up button image name. csRef<iDocumentNode> buttonGreyUpImage = node->GetNode( "buttongrayup" ); if ( buttonGreyUpImage ) { csString greyUpImageName = buttonGreyDownImage->GetAttributeValue("resource"); SetGreyUpImage(greyUpImageName); } // Get the "on char name flash" button image name. csRef<iDocumentNode> buttonSpecialImage = node->GetNode( "buttonspecial" ); if ( buttonSpecialImage ) { csString onSpecialImageName = buttonSpecialImage->GetAttributeValue("resource"); SetOnSpecialImage(onSpecialImageName); } // Get the button label csRef<iDocumentNode> buttonLabelNode = node->GetNode( "label" ); if ( buttonLabelNode ) { buttonLabel = PawsManager::GetSingleton().Translate(buttonLabelNode->GetAttributeValue("text")); } originalFontColour = GetFontColour(); return true; }