void CInformationPanel::OnCommand(HWND hwnd,int id,HWND hwndCtl,UINT codeNotify) { switch (id) { case CM_PROGRAMINFOPREV: case CM_PROGRAMINFONEXT: { bool fNext=id==CM_PROGRAMINFONEXT; CProgramInfoItem *pItem= static_cast<CProgramInfoItem*>(GetItem(ITEM_PROGRAMINFO)); if (fNext!=pItem->IsNext()) { pItem->SetNext(fNext); RedrawButton(BUTTON_PROGRAMINFOPREV); RedrawButton(BUTTON_PROGRAMINFONEXT); } } return; default: if (id>=CM_INFORMATIONPANEL_ITEM_FIRST && id<CM_INFORMATIONPANEL_ITEM_FIRST+NUM_ITEMS) { int Item=id-CM_INFORMATIONPANEL_ITEM_FIRST; SetItemVisible(Item,!IsItemVisible(Item)); return; } } }
//***************************************************************************************** BOOL CBCGPToolBoxPage::SetSelected (int nItem) { ASSERT_VALID (this); if (nItem >= m_arButtons.GetSize ()) { ASSERT (FALSE); return FALSE; } if (m_nCheckedButton >= 0) { if (nItem == m_nCheckedButton) { return TRUE; } m_arButtons [m_nCheckedButton]->SetCheck (FALSE); RedrawButton (m_nCheckedButton); } if (nItem >= 0) { m_arButtons [nItem]->SetCheck (TRUE); RedrawButton (nItem); } m_nCheckedButton = nItem; return TRUE; }
void CInformationPanel::SetHotButton(ItemButtonNumber Button) { if (Button!=m_HotButton) { if (m_HotButton.IsValid()) RedrawButton(m_HotButton); m_HotButton=Button; if (m_HotButton.IsValid()) RedrawButton(m_HotButton); } }
void CInformationPanel::SetHotButton(int Button) { if (Button!=m_HotButton) { if (m_HotButton>=0) RedrawButton(m_HotButton); m_HotButton=Button; if (m_HotButton>=0) RedrawButton(m_HotButton); } }
//************************************************************************** void CBCGPToolBoxPage::OnContextMenu(CWnd* pWnd, CPoint point) { ASSERT_VALID (this); CPoint ptClient = point; ScreenToClient (&ptClient); const int nHit = HitTest (ptClient); ReleaseCapture (); m_nHighlightedButton = -1; if (m_nCheckedButton >= 0) { m_arButtons [m_nCheckedButton]->SetCheck (FALSE); RedrawButton (m_nCheckedButton); } m_nCheckedButton = nHit; if (m_nCheckedButton >= 0) { m_arButtons [m_nCheckedButton]->SetCheck (TRUE); RedrawButton (m_nCheckedButton); } if (m_pToolBox != NULL) { ASSERT_VALID (m_pToolBox); if (m_pToolBox->OnShowToolboxMenu (point, this, nHit)) { return; } } else if (m_pToolBoxEx != NULL) { #ifndef BCGP_EXCLUDE_TASK_PANE ASSERT_VALID (m_pToolBoxEx); if (m_pToolBoxEx->OnShowToolboxMenu (point, this, nHit)) { return; } #endif } CBCGPControlBar::OnContextMenu (pWnd, point); }
void CElcSkinFrameBase::EnableCustomButton(UINT nId, BOOL bEnable) { int nItem = FindButton(nId + ESNWT_CUSTOM_BASE); if (nItem != -1) { m_arrButton[nItem].bEnable = bEnable; RedrawButton(m_arrButton[nItem].pButton); } }
BOOL CElcSkinFrameBase::NcMouseMove(UINT nHitTest, CPoint point) { GetOppositePoint(point); BOOL bChanged = FALSE; int nIndex = 0; int nCount = 0; if (nHitTest == HTMENU) { nIndex = PtInMenuItem(point); if (nIndex != -1) { if (m_nActiveItem != nIndex) { m_nActiveItem = nIndex; RedrawMenuBar(); } return TRUE; } if (m_nActiveItem != -1 && !m_bMenuActivated) { m_nActiveItem = -1; RedrawMenuBar(); } } nCount = (int)m_arrButton.size(); for (nIndex = 0; nIndex < nCount; nIndex ++) { CRect rc = CalcPos(m_arrButton[nIndex].pButton); if (rc.PtInRect(point)) { if (m_nActiveButton != nIndex) { m_nActiveButton = nIndex; RedrawButton(m_arrButton[nIndex].pButton); } return TRUE; } } if (m_nActiveButton != -1) { nIndex = m_nActiveButton; m_nActiveButton = -1; RedrawButton(m_arrButton[nIndex].pButton); } return FALSE; }
//********************************************************************************* BOOL CBCGPToolBoxPage::OnClickButton(int nButtonIndex) { if (nButtonIndex < 0 || nButtonIndex >= (int)m_arButtons.GetSize()) { return FALSE; } if (m_nCheckedButton >= 0) { m_arButtons [m_nCheckedButton]->SetCheck(FALSE); RedrawButton (m_nCheckedButton); } m_nCheckedButton = nButtonIndex; if (m_nCheckedButton < 0) { return FALSE; } m_arButtons [m_nCheckedButton]->SetCheck (TRUE); RedrawButton (m_nCheckedButton); if (m_pToolBox != NULL) { ASSERT_VALID (m_pToolBox); int nPage = m_pToolBox->GetPageNumber (this); m_pToolBox->OnClickTool (nPage, m_nCheckedButton); } if (m_pToolBoxEx != NULL) { #ifndef BCGP_EXCLUDE_TASK_PANE ASSERT_VALID (m_pToolBoxEx); int nPage = m_pToolBoxEx->GetPageNumber (this); m_pToolBoxEx->OnClickTool (nPage, m_nCheckedButton); #endif } return TRUE; }
void CElcSkinFrameBase::RedrawButton(int type) { for (CFrameButtonArray::iterator it = m_arrButton.begin(); it != m_arrButton.end(); it ++) { if (it->type == type) { RedrawButton(it->pButton); break; } } }
bool CInformationPanel::ResetItem(int Item) { CItem *pItem=GetItem(Item); if (pItem==NULL) return false; pItem->Reset(); if (Item==ITEM_PROGRAMINFO) { m_ProgramInfoLinkList.clear(); m_fProgramInfoCursorOverLink=false; if (m_hwnd!=NULL) { ::SetWindowText(m_hwndProgramInfo,TEXT("")); RedrawButton(BUTTON_PROGRAMINFOPREV); RedrawButton(BUTTON_PROGRAMINFONEXT); } } if (m_hwnd!=NULL && pItem->IsVisible()) RedrawItem(Item); return true; }
BOOL CElcSkinFrameBase::NcLButtonDown(UINT nHitTest, CPoint point) { GetOppositePoint(point); m_nLBDownItem = ESNWT_NONE; if (HTMENU == nHitTest) { int nIndex = PtInMenuItem(point); if (nIndex != -1) { m_bMenuActivated = !m_bMenuActivated; m_nActiveItem = nIndex; if (m_bMenuActivated) { RedrawMenuBar(); //m_bSelfCancelMenu = TRUE; PopupMenu(nIndex); } else { m_bSelfCancelMenu = TRUE; ::SendMessage(m_hDerive, WM_CANCELMODE, 0, 0); RedrawMenuBar(); } } } else if (HTSYSMENU == nHitTest) { PopupSysMenu(); } else { int nItem = FindButton(nHitTest); if (nItem != -1) { m_nLBDownItem = nHitTest; RedrawButton(m_arrButton[nItem].pButton); return TRUE; } m_nActiveItem = -1; m_bMenuActivated = FALSE; m_nActiveButton = -1; m_nLBDownItem = ESNWT_NONE; RedrawMenuBar(); return FALSE; } return TRUE; }
//*************************************************************************************** BOOL CBCGPToolBoxPage::InitPage (UINT uiBmpResID, int nImageWidth, const CStringList& lstLabels, CRuntimeClass* pButtonClass) { ASSERT_VALID (this); m_pButtonClass = pButtonClass; m_uiBmpResID = uiBmpResID; if (!m_Images.Load (uiBmpResID)) { ASSERT (FALSE); return FALSE; } // Enable tooltips: CBCGPTooltipManager::CreateToolTip (m_pToolTip, this, BCGP_TOOLTIP_TYPE_TOOLBOX); HBITMAP hBitmap = m_Images.GetImageWell (); BITMAP bmp; ::GetObject (hBitmap, sizeof (BITMAP), (LPVOID) &bmp); m_sizeImage.cx = nImageWidth; m_sizeImage.cy = bmp.bmHeight; m_Images.SetImageSize (m_sizeImage, TRUE); if (globalData.GetRibbonImageScale () != 1.) { double dblImageScale = globalData.GetRibbonImageScale (); m_sizeImage = CSize ((int)(.5 + m_sizeImage.cx * dblImageScale), (int)(.5 + m_sizeImage.cy * dblImageScale)); } for (int i = 0; i < m_Images.GetCount (); i++) { CBCGPToolBoxButton* pButton = DYNAMIC_DOWNCAST (CBCGPToolBoxButton, pButtonClass->CreateObject ()); if (pButton == NULL) { ASSERT (FALSE); return FALSE; } ASSERT_VALID (pButton); pButton->SetParentPage (this); pButton->SetImageList (&m_Images); pButton->SetImageIndex (i); pButton->SetID (i + 1); POSITION posLabel = lstLabels.FindIndex (i); if (posLabel != NULL) { pButton->SetLabel (lstLabels.GetAt (posLabel)); } if (i == 0 && m_bCheckFirstButton) { m_nCheckedButton = 0; pButton->SetCheck (TRUE); RedrawButton (m_nCheckedButton); } m_arButtons.Add (pButton); if (m_pToolTip->GetSafeHwnd () != NULL) { CRect rectDummy; rectDummy.SetRectEmpty (); m_pToolTip->AddTool ( this, LPSTR_TEXTCALLBACK, &rectDummy, pButton->GetID ()); } } return TRUE; }
void parse_message_line(char *line) { char *rest; int action = -1; button_info *b; char *act; char *buttonn; int mousebutton; silent = False; do { action = GetTokenIndex(line, actions, -1, &rest); if (action == -1) { show_error("Message not understood: %s", line); return; } if (action == 0) { silent = True; break; } } while (action == 0); /* If silent was given (to surpress erros from parsing commands, then * retokenise the rest of the line, so that token matching for the * actual command is possible. */ if (silent == True) { line = PeekToken(line, &rest); action = GetTokenIndex(rest, actions, -1, &rest); } /* find out which button */ b = parse_button_id(&rest); if (!b || !rest) { return; } switch (action) { case 1: /* ChangeButton */ /* The dimensions of individual buttons (& the overall size of * the FvwmButtons window) is based on the initial * configuration for the module. In some configurations, * dynamically adding/changing a title/icon may mean it no * longer fits on a button. Currently, there are no checks for * this occurance. */ while (rest && rest[0] != '\0') { char *option_pair; int option, i; char *value0, *value; FvwmPicture *icon; /* parse option and value and give diagnostics */ rest = GetQuotedString( rest, &option_pair, ",", NULL, NULL, NULL); while (isspace(*rest)) { rest++; } if (!option_pair) continue; option = GetTokenIndex( option_pair, button_options, -1, &value0); if (option < 0) { show_error( "Unsupported button option line '%s'\n", option_pair); free(option_pair); continue; } GetNextToken(value0, &value); free(option_pair); if (value == NULL) { show_error( "No title/icon to change specified.\n"); continue; } switch (option) { case 0: /* Title */ if (b->flags.b_Title) free(b->title); b->flags.b_Title = 1; b->title = value; value = NULL; break; case 2: /* ActiveTitle */ if (b->flags.b_ActiveTitle) free(b->activeTitle); b->flags.b_ActiveTitle = 1; b->title = value; value = NULL; break; case 4: /* PressTitle */ if (b->flags.b_PressTitle) free(b->pressTitle); b->flags.b_PressTitle = 1; b->title = value; value = NULL; break; case 6: /* Colorset */ i = atoi(value); b->colorset = i; b->flags.b_Colorset = 1; AllocColorset(i); break; default: if ( LoadIconFile( value, &icon, b->colorset) == 0) { show_error( "Cannot load icon \"%s\"\n", value); } else { switch (option) { case 1: /* Icon */ if (b->flags.b_Icon) { free(b->icon_file); PDestroyFvwmPicture( Dpy, b->icon); } b->flags.b_Icon = 1; b->icon_file = value; value = NULL; b->icon = icon; break; case 3: /* ActiveIcon */ if (b->flags.b_ActiveIcon) { free(b->active_icon_file); PDestroyFvwmPicture( Dpy, b->activeicon); } b->flags.b_ActiveIcon = 1; b->active_icon_file = value; value = NULL; b->activeicon = icon; break; case 5: /* PressIcon */ if (b->flags.b_PressIcon) { free(b->press_icon_file); PDestroyFvwmPicture( Dpy, b->pressicon); } b->flags.b_PressIcon = 1; b->press_icon_file = value; value = NULL; b->pressicon = icon; break; } } break; } if (value) { free(value); } } RedrawButton(b, DRAW_FORCE, NULL); if (UberButton->c->flags.b_TransBack) { SetTransparentBackground(UberButton, Width, Height); } break; case 2: /* ExpandButtonVars */ line = expand_button_vars(b, rest); if (line) { SendText(fd, line, 0); free(line); } break; case 3: /* PressButton */ rest = GetQuotedString(rest, &buttonn, "", NULL, NULL, NULL); if (buttonn) { mousebutton = atoi(buttonn); free(buttonn); if ( mousebutton <= 0 || mousebutton > NUMBER_OF_EXTENDED_MOUSE_BUTTONS) { mousebutton = 1; } } else { mousebutton = 1; } CurrentButton = b; act = GetButtonAction(b, mousebutton); ButtonPressProcess(b, &act); if (act) { free(act); } CurrentButton = NULL; break; } return; }