Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Offer Har
|
Sep 17, 2008 - 10:38 AM
|
I have an in-place control, that implement the OnKeyDown event. I see that when I press the Delete key, the function is never called. For every other key it is called. I debugged the grid code and found that the source of the problem is in CExtGridCell::OnInplaceControlWindowProc . In this function, for some reason you replace the VK_DELETE KeyDown with a EM_REPLACESEL message that replaces the current selection with an empty string, ExtGridWnd.cpp line 58,240:
if( ( g_pEditCell->GetStyle() & __EGCS_READ_ONLY ) == 0 )
::SendMessage( msg.hwnd, EM_REPLACESEL, 1, reinterpret_cast < LPARAM > ( strEmpty ) ); Please explain how to prevent this from happening, and give the Delete key back to my In-lace control. Thanks,
Ron.
|
|
Technical Support
|
Sep 23, 2008 - 5:48 AM
|
The in-place editor window is not a grid cell. You can handle keyboard messages sent to the in-place activated cell editor window only if you implement the CExtGridCell::OnInplaceControlWindowProc() virtual method in your grid cell class or the CExtGridWnd::OnGridCellInplaceControlWindowProc() virtual method in your grid control class. These methods are designed for this. You should override one of them. If you don’t like them, then please implement the CWnd::WindowProc() virtual method in your in-place editor control class. We have handled the VK_DELETE key explicitly because it’s often pre-translated and filtered in customer applications.
|
|
Offer Har
|
Sep 23, 2008 - 6:20 AM
|
Dear Support, I know the in-place is not a grid cell - the in-place is CWnd derived - so I should be able to have an in-place that is not a grid specific, but any kind of control I have. My generic control handles the delete key, and I am not going to change a generic control to accomodate this requirement. Please explain how can I over-ride this behavior - I would like to understand why this happens, and how what is the reason for that.
|
|
Technical Support
|
Sep 24, 2008 - 5:00 AM
|
If the problem has to do with your custom controls activated as in-place cell editors, then you should override the CWnd::WindowProc() and CWnd::PreTranslateMessage() virtual method and redirect invocations to the grid window methods: virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = 0L;
if(m_refEditedGridCellObejct.OnInplaceControlWindowProc( lResult, message, wParam, lParam, m_hWnd, . . . ) )
return lResult;
. . .
lResult = __BASE_CLASS_NAME__:: WindowProc(message, wParam, lParam );
. . .
return lResult;
}
virtual BOOL PreTranslateMessage( MSG * pMsg )
{
ASSERT_VALID( this );
if( m_refEditedGridCellObejct.OnInplaceControlPreTranslateMessage( pMsg, m_hWnd, . . . ) )
return TRUE;
. . .
return __BASE_CLASS_NAME__::PreTranslateMessage( pMsg );
} This will allow the grid control to receive all the required notifications. But you will also need to handle the end of editing in the similar way like the CExtGridInplaceEdit::_DoEndEdit() method does. Please believe us, it’s not possible to use any abstract window/control as in-place active editor in any other control in Prof-UIS, in any Windows common control, in any Windows Forms controls for .NET, in any other libraries written for MFC or .NET. The host control which can do in-place editing of its inner UI items (grid cells in case of grid) requires some mechanisms of on-the-fly validation and end-of-editing which are specific for the host control only. Unfortunately nobody has written standards for such control hosting and OLE in-pace item activation is not the case of grid control. Besides there are a lot of other requirements for each case of in-place UI editing. For instance, editors inside popup menus and toolbars should not gain focus or should hide their focused state somehow.
|
|
Technical Support
|
Sep 17, 2008 - 12:23 PM
|
There are two absolutely different cases of keyboard processing related to the focused grid cell:
1) The focused grid cell is not being edited. You press a key and grid cell’s CExtGridCell::OnKey() virtual method is invoked (or the CExtGridCell::OnSysKey() virtual method). The focused window is the grid window in this case.
2) The focused grid cell is currently being edited. The in-pace editor window is created and displayed over the grid cell. The focused window in this case is the editor window rather than the grid window. As you know, all the keyboard messages are sent to the focused window only. So, you should implement the CExtGridCell::OnInplaceControlWindowProc() virtual method if you want to handle keyboard events during cell text editing. There are no problems in this method, you simply should implement it.
|
|
Offer Har
|
Sep 17, 2008 - 1:37 PM
|
Dear Support, I am only talking about the second case, when my In-Place control is created and displayed. I have implemented in my control the ON_WM_KEYDOWN event handler, and all keys are captured by this method except the VK_DELETE key.I saw that when I press the Delete key, you ’eat’ it in the function mentioned above. I don’t need to re-write the CExtGridCell::OnInplaceControlWindowProc() function, I just need to get the Delete key down event... and I don’t know why you replace it with an EM_REPLACESEL event as you do. Please check why you do it, and how to prevent it from happening.
|
|
Scott Moore
|
Sep 17, 2008 - 9:45 AM
|
Is it possible to have the grid display different text in the bubble popup when the mouse hovers over the cell? For instance, we display an error message in the cell, but in order for it to fit we just say something like "Connect Error". What I would like to do is display the full error message in a bubble popup when the user hovers over the cell - "The password used to login was incorrect.". Thanks for any help.
|
|
Scott Moore
|
Oct 27, 2008 - 7:48 AM
|
It’s been over a month since I first posted this question. Do you have an answer?
|
|
Technical Support
|
Oct 29, 2008 - 1:59 PM
|
|
|
Pawel Kalinowski
|
Sep 17, 2008 - 7:07 AM
|
|
|
Hans Bergmeister
|
Oct 5, 2008 - 7:13 AM
|
Hello, we have created ProfUIS-based skinned messages boxes by using another codeguru article. These message boxes worked well on XP, but the buttons disappeared on Vista, too. We found out, that simply removing the BS_OWNERDRAW style from the buttons after subclassing them to CExtButton objects did the job. This simple change caused CExtButton::OnPaint() to be called and skinned buttons became visible in our message boxes as desired. Perhaps this helps here,too. Regards, Juergen
|
|
Pawel Kalinowski
|
Sep 18, 2008 - 6:03 AM
|
Can we expect you add your own skinned vista compatible message boxes in the next library release?
|
|
Technical Support
|
Sep 18, 2008 - 12:12 PM
|
|
|
Technical Support
|
Sep 17, 2008 - 10:52 AM
|
We are sorry for the delay with this reply. We performed several tests under Windows Vista and it looks like it handles message boxes in some special way. First of all, we performed delayed subclassing: int CApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{
class CMyMsgBox : public CExtNCW < CExtResizableDialog >
{
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = CExtNCW < CExtResizableDialog > :: WindowProc( message, wParam, lParam );
switch( message )
{
case WM_INITDIALOG:
PostMessage( (WM_USER+666) );
break;
case (WM_USER+666):
ModifyStyle( 0, WS_CLIPCHILDREN|WS_CLIPSIBLINGS, SWP_FRAMECHANGED );
if( NcFrameImpl_IsSupported() )
NcFrameImpl_SetupRgn();
::SubclassChildControls( this );
break;
}
return lResult;
}
};
CMyMsgBox dlg;
AfxHookWindowCreate( &dlg );
return CWinApp::DoMessageBox( lpszPrompt, nType, nIDPrompt );
}<pre>But the result was also the same. We also tried to save location of visible buttons and then re-create the same buttons on the saved locations, but the result still was the same. Windows Vista does magic things with buttons created inside the message box window. Finally, we tried to re-create the buttons inside container windows created as children of the message box window:<pre>int CApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{
class CMyMsgBox : public CExtNCW < CExtResizableDialog >
{
class CDynamicButton : public CExtButton
{
protected:
virtual void PostNcDestroy()
{
delete this;
}
};
class CDynamicContainerWnd : public CWnd
{
protected:
virtual void PostNcDestroy()
{
delete this;
}
};
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = CExtNCW < CExtResizableDialog > :: WindowProc( message, wParam, lParam );
switch( message )
{
case WM_INITDIALOG:
PostMessage( (WM_USER+666) );
break;
case (WM_USER+666):
{
ModifyStyle( 0, WS_CLIPCHILDREN|WS_CLIPSIBLINGS, SWP_FRAMECHANGED );
if( NcFrameImpl_IsSupported() )
NcFrameImpl_SetupRgn();
static const TCHAR szButton[] = _T("BUTTON");
CList < HWND, HWND > _listFoundButtons;
CList < CRect, CRect > _listFoundRects;
CList < __EXT_MFC_LONG_PTR, __EXT_MFC_LONG_PTR > _listFoundStyles;
HWND hWnd = ::GetWindow( m_hWnd, GW_CHILD );
for( ; hWnd != NULL; hWnd = ::GetWindow( hWnd, GW_HWNDNEXT ) )
{
TCHAR szCompare[512] = _T("");
::GetClassName(
hWnd,
szCompare,
sizeof( szCompare )/sizeof( szCompare[0] )
);
if( _tcsicmp( szCompare, szButton ) == 0 )
{
__EXT_MFC_LONG_PTR dwWndStyle = ::__EXT_MFC_GetWindowLong( hWnd, GWL_STYLE );
if( ( dwWndStyle & WS_VISIBLE ) != 0 )
{
_listFoundButtons.AddTail( hWnd );
_listFoundStyles.AddTail( dwWndStyle );
CRect rc;
::GetWindowRect( hWnd, &rc );
ScreenToClient( &rc );
_listFoundRects.AddTail( rc );
}
}
}
::SubclassChildControls( this );
POSITION pos = _listFoundButtons.GetHeadPosition();
POSITION pos2 = _listFoundRects.GetHeadPosition();
POSITION pos3 = _listFoundStyles.GetHeadPosition();
for( ; pos != NULL ; )
{
hWnd = _listFoundButtons.GetNext( pos );
ASSERT( pos2 != NULL );
CRect rc = _listFoundRects.GetNext( pos2 );
ASSERT( pos3 != NULL );
__EXT_MFC_LONG_PTR dwWndStyle = _listFoundStyles.GetNext( pos3 );
CWnd * pWnd = CWnd::FromHandle( hWnd );
bool bFocus = ( GetFocus() == pWnd ) ? true : false;
CString s;
pWnd->GetWindowText( s );
::ShowWindow( hWnd, SW_HIDE );
int nID = pWnd->GetDlgCtrlID();
CDynamicContainerWnd * pWDC = new CDynamicContainerWnd;
VERIFY(
pWDC->Create(
::AfxRegisterWndClass( CS_HREDRAW|CS_HREDRAW|CS_DBLCLKS),
LPCTSTR(s),
WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP,
rc,
this,
nID
)
);
pWDC->SetWindowPos( pWnd, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
CButton * pButton = new CDynamicButton;
VERIFY(
pButton->Create(
LPCTSTR(s),
dwWndStyle,
CRect(0,0,rc.Width(),rc.Height()), // rc,
pWDC, //this,
nID
)
);
if( bFocus )
pWDC->SetFocus();
}
}
break;
}
return lResult;
}
};
CMyMsgBox dlg;
AfxHookWindowCreate( &dlg );
return CWinApp::DoMessageBox( lpszPrompt, nType, nIDPrompt );
} The same result again. There is a black hole in Vista’s message boxes. Button controls disappear even if they are created as deep children of the message box window. We decided to give up at this point. Even if we found some way to keep buttons visible and working, there would not be guarantee that a new magic will appear in the next Windows versions. It’s easier to re-code our own message box from scratch or use the standard ones.
|
|
Eun Hyang Im
|
Sep 16, 2008 - 9:08 PM
|
I want to change titlebar(caption) color (Normal... orange color... I don’t like this color) in CExtControlBar. How to change, please ?
|
|
Technical Support
|
Sep 17, 2008 - 5:55 AM
|
You should re-paint the caption of resizable bar. The TabbedBars sample application demonstrates how to do this. You can see resizable bars with custom painted captions and borders there. The CMainFrame::OnMsgUseCustomNcArea method in this sample application handles the CExtControlBar::g_nMsgCustomNcAreaQuery registered message which allows to re-compute non-client area of Prof-UIS control bar and/or repaint it.
|
|
Offer Har
|
Sep 17, 2008 - 10:40 AM
|
I would like to do the same... Isn’t there a simple place I can just change the RGB of the title? I don’t want to change the paint procedure, just want another color.
|
|
Technical Support
|
Sep 17, 2008 - 12:24 PM
|
There are no colors of UI items. In some themes any part of any control has a solid color. In some other themes parts are painted using horizontal or vertical gradients with two or more color points. In some other themes UI parts are painted using stretched or tiled bitmaps. So, generally there are no colors defined for controls and their parts. If you need something differently looking, then you should paint it.
|
|
Offer Har
|
Sep 17, 2008 - 1:40 PM
|
We are talking about one specific theme - the CExtPaintManagerOffice2007_Black. In this theme, the focused bar’s caption is orange. Can you point us to what method from the methods you mentioned above is used to implement it? I can change a bitmap or whatever, because we absolutly don’t want the orange caption, sow e don’t care changing the bitmap in the Prof-UIS resource to achieve that goal.
|
|
Timothy Anderson
|
Sep 16, 2008 - 6:10 PM
|
We jumped to 2k5 and to 2.82. Somewhere in the jump the automatic updating of the list of open documents in the top level "window" command stopped working correctly, it simply doesn’t show the open documents any longer. I was trying to avoid jumping to 2.84 since we are extremely close to releasing, and your example apps appear to work OK. Where should I start poking around to try to track this down? There appears to be a newer way of deriving off of the CMDIFrame class, I’ll poke my head in there first.
|
|
Timothy Anderson
|
Sep 17, 2008 - 5:15 PM
|
...or possibly dig through the MenuInfo after SetButtons is called...
|
|
Timothy Anderson
|
Sep 17, 2008 - 12:32 PM
|
Ya, I’m doing that. My example works like the mdidocview one. Switching the class derivation didn’t seem to help. One other thing, I did add in the profauto stuff around the same time so there may be some fighting between profauto and the main application. I’ll see if I can backtrack this out to find out if that’s the problem.
|
|
Technical Support
|
Sep 17, 2008 - 5:54 AM
|
The list of open MDI child frame windows works equally in all MFC versions. If you haven’t changed any UI related code, this feature should work in your project. The list of open MDI child frame windows appears in the Window menu because the menu bar’s button with "Windows" text is marked for displaying this list of commands by invoking the menu bar’s SetMdiWindowPopupName() method. So, first of all, please ensure this method is invoked in your project somewhere near menu bar creation code.
|
|
Timothy Anderson
|
Sep 17, 2008 - 12:47 PM
|
It’s profauto. Once profauto was removed everything started working again. I’ll keep going in this direction. This may also be why the "delete" key no longer works in the main app window also.
|
|
Timothy Anderson
|
Sep 17, 2008 - 2:27 PM
|
I’ve tracked this a little futher. On menu creation, a normal MDI application doesn’t have a MenuInfo pointer on the initial timer fired menu build up in CExtMenuControlBar::_UpdateMenuBar. Since this is the case, it plows through all of the new buildup of the menu inside the CExtMenuControlBar::_UpdateMenuBar code. This adds in all the extra "Window" information as appropriate. For a customized site, this menu command is already hanging around so it’s never built inside this call. So the question is how do I update the customized site’s MenuInfo AFTER I’ve added in the menus for all of my MDI child windows in order to update their own internal "buttons" so this displays correctly? Is there a better way to approach this?
|
|
Timothy Anderson
|
Sep 17, 2008 - 5:13 PM
|
It looks like CExtToolControlBar::SetButtons should probably dig through the buttons as it is putting them in looking for m_sMdiWindowPopupName, then calling MarkButtonAsMdiWindowsMenu when appropriate? I think I’m playing fast and loose with the variables used, and there is probably an easier way to do this. I was going to probably setup a OnExtMenuPrepare handler similarly to the mdidocview example and unfortunately duplicate some of the work done by the toolkit for setting up in there.
It looks like you need to do some extra hand standing with m_sMdiWindowPopupName in order to properly work with foreign languages.
|
|
Timothy Anderson
|
Sep 17, 2008 - 5:16 PM
|
oops, or possibly dig through the menu info after setbuttons is called inside _UpdateMenuBar
|
|
Technical Support
|
Sep 18, 2008 - 12:17 PM
|
The CExtMenuControlBar::SetMdiWindowPopupName() method is designed for a non-customizable menu bar only. In the case of a customizable menu bar with or without the ProfAuto library the __ECTN_TBB_APPEND_MDI_MENU style should be applied to appropriate command nodes which represent menu bar’s buttons both in active and default command trees of the menu line. The IExtAutoToolButton::AppendMdiMenu() property in the ProfAuto library simply works with this style to a command node. Please find the __ECTN_TBB_APPEND_MDI_MENU text in the source code of the DRAWCLI sample application so you will see how to set it correctly and where.
|
|
Timothy Anderson
|
Sep 18, 2008 - 5:58 PM
|
Sweet. Worked like a champ!
|
|
Offer Har
|
Sep 16, 2008 - 10:55 AM
|
Why do we have to keep nudging? Why don’t you just give answers to your customers?
|
|
Robert Webb
|
Sep 16, 2008 - 2:57 AM
|
Hi, For some reason our code hits a whole bunch of assertions via CExtBarTextFieldButton::SetSeparatedDropDown(). The code for this routine always asserts, so clearly it’s never supposed to be called. We are not calling it directly, rather we’re calling EnableCustomization() and it gets called via there. It appears to be called for combo boxes we have on some toolbars, so yes they’re text fields wiht drop-downs, but why should that be a problem? Thanks, Rob.
|
|
Technical Support
|
Sep 24, 2008 - 5:06 AM
|
There is a StyleEditor sample that demonstrates how to use built-in combo fields in customizable toolbars and menus.
|
|
Robert Webb
|
Sep 17, 2008 - 12:26 AM
|
Here’s a stack trace: > ProfUIS283nd.dll!CExtBarTextFieldButton::SetSeparatedDropDown(bool bSeparatedDropDown=true) Line 3265 + 0x17 bytes C++
ProfUIS283nd.dll!CExtBarButton::OnCustomizeUpdateProps(CExtCustomizeCmdTreeNode * pNode=0x0f931ae0) Line 3576 + 0x11 bytes C++
ProfUIS283nd.dll!CExtCustomizeSite::OnCreateToolbarButton(CExtToolControlBar * pBar=0x0f734258, CExtCustomizeCmdTreeNode * pNodeI=0x0f931ae0, CExtCustomizeCmdTreeNode * pNodeC=0x0f931ae0) Line 8392 + 0x16 bytes C++
ProfUIS283nd.dll!CExtToolControlBar::OnCustomizeUpdateInitialBarState(CExtCustomizeCmdTreeNode * pParentNode=0x0f931c50, bool bRecalcLayout=false) Line 14012 + 0x2a bytes C++
ProfUIS283nd.dll!CExtCustomizeSite::OnRegisterToolBar(CExtToolControlBar * pToolBar=0x0f734258) Line 8864 + 0x1b bytes C++
ProfUIS283nd.dll!CExtCustomizeSite::EnableCustomization(CWnd * pWndTop=0x0e906118, unsigned long dwCustomizeFlags=39) Line 6879 + 0x16 bytes C++
cadwind.exe!CMainFrame::CreateCadAppToolBars() Line 1075 + 0x17 bytes C++
cadwind.exe!CMainFrame::OnCreate(tagCREATESTRUCTA * lpCreateStruct=0x0012f108) Line 595 + 0x8 bytes C++
mfc80d.dll!CWnd::OnWndMsg(unsigned int message=1, unsigned int wParam=0, long lParam=1241352, long * pResult=0x0012edcc) Line 2000 + 0xd bytes C++
mfc80d.dll!CWnd::WindowProc(unsigned int message=1, unsigned int wParam=0, long lParam=1241352) Line 1741 + 0x20 bytes C++
cadwind.exe!CExtNCW<CMDIFrameWnd>::WindowProc(unsigned int message=1, unsigned int wParam=0, long lParam=1241352) Line 426 + 0x14 bytes C++
mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x0e906118, HWND__ * hWnd=0x00151620, unsigned int nMsg=1, unsigned int wParam=0, long lParam=1241352) Line 240 + 0x1c bytes C++
mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x00151620, unsigned int nMsg=1, unsigned int wParam=0, long lParam=1241352) Line 389 C++
mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x00151620, unsigned int nMsg=1, unsigned int wParam=0, long lParam=1241352) Line 411 + 0x15 bytes C++
user32.dll!7e418734()
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!7e418816()
user32.dll!7e418734()
user32.dll!7e41b4c0()
user32.dll!7e41f9fe()
ntdll.dll!_KiUserCallbackDispatcher@12() + 0x13 bytes
user32.dll!7e41fe13()
user32.dll!7e41fdd9()
ntdll.dll!_RtlFreeHeap@12() + 0x130 bytes
ntdll.dll!_RtlAllocateHeap@12() + 0xd7 bytes
ntdll.dll!_RtlpCoalesceFreeBlocks@16() + 0x33c bytes
0018fde0() Thanks,
Rob.
|
|
Technical Support
|
Sep 17, 2008 - 5:56 AM
|
It looks like you may have configured some of command tree nodes as both a split button in a toolbar and as a text field. This is not correct. The text fields cannot be split buttons at the same time.
|
|
Robert Webb
|
Sep 19, 2008 - 2:01 AM
|
Isn’t a combo box a text field with a drop-down button? That’s what these are. We derive new classes from CExtBarTextFieldButton, and call its constructor with the first argument true to create combo boxes. I don’t think we ever set the __ECTN_TBB_SEPARATED_DROPDOWN style for those items, unless it happens indirectly somehow. These are being used on toolbars not ribbon bars, by the way. Hmm, a little further investigation, and it looks like the flag is set in CExtBarButton::OnCustomizeNodeInit(), line 3709: if( GetSeparatedDropDown() || pCmdItem->StateIsSeparatedDD() )
dwAddFlags |= __ECTN_TBB_SEPARATED_DROPDOWN;
GetSeparatedDropDown() returns true after calling IsComboTextField() which returns true, so the flag is set. So it seems Prof-UIS code is setting this flag for combo boxes. Is that right or wrong? Thanks, Rob.
|
|
Technical Support
|
Sep 24, 2008 - 5:09 AM
|
Yes, the same style of the command tree node is used both by split buttons and text/combo fields. But combo field is not a kind of split button. The split button is an advanced version of the simple push button. The main difference between a simple button and a split button is that the latter uses two command identifiers. The combo field button works with text displayed in its the editor part and its single identifier is never used for sending command messages.
|
|
Robert Webb
|
Sep 25, 2008 - 4:11 AM
|
Looking at the StyleEditor demo, it uses pCmdItem->StateSetCombo() etc to make the control a combo. We however are deriving a new class from CExtBarTextFieldButton, and replacing the toolbar button with our control, roughly as follows: pCmdItem->StateSetResizable();
pCmdItem->m_nTextFieldWidth = 50;
pCmdItem->StateSetCombo();
pCmdItem->StateSetTextFieldNotEditable();
ourComboButton->SetBar(this);
if (!InsertSpecButton(index, ourComboButton, FALSE))
return E_FAIL;
RemoveButton(index + 1); // remove place holder button
Is there something wrong with that approach? It seems to lead to the assertion reported above, but otherwise works fine.
Thanks,
Rob.
|
|
Technical Support
|
Sep 26, 2008 - 12:24 PM
|
We don’t see any problems. The CExtBarTextFieldButton class is derived from CExtBarButton . It’s possible to create your CExtBarTextFieldButton -derived class and implement required virtual methods in it (the same as implemented in the CExtBarTextFieldButton class) and optionally invoke methods of the CExtBarButton class from them. This will convert a text field button into a push button.
|
|
Robert Webb
|
Sep 23, 2008 - 3:25 AM
|
Any thoughts on my last message? Do any of your samples have combo boxes on toolbars? I’d like to see what they do differently. Thanks, Rob.
|
|
Technical Support
|
Sep 16, 2008 - 9:45 AM
|
We believe this problem may have to do with some specifics of your project only. Could you show us the stack trace when the first assertion occurs or help us reproduce this problem using any of our sample projects?
|
|
Robert Webb
|
Sep 15, 2008 - 11:54 PM
|
How do I catch a mouse click in a read-only text field in a ribbon bar? I want it to act like a button and execute its command id. Thanks, Rob.
|
|
Technical Support
|
Sep 16, 2008 - 9:43 AM
|
You should create your own CExtRibbonNode -derived class for your text field button and use it in ribbon’s command tree. Your ribbon node class should return run-time class information of your text field button class:
CRuntimeClass * CYourRibbonNodeClassNameHere::_OnRibbonGetButtonRTC()
{
return RUNTIME_CLASS( CYourRibbonButtonClassNameHere );
} Your text field button class should be derived from the CExtBarTextFieldButton class and it should implement the CExtBarTextFieldButton::OnClick virtual method. The CExtBarButton::GetStyle() method returns a set of TBBS_***() button styles. If the TBBS_DISABLED() style is present, then the button is disabled. So, your OnClick virtual method will know whether to act like a button or whether to invoke parent class method. There is one more very important thing: the ribbon/toolbar buttons are not clickable in disabled state by default. So, you will also need to override the CExtBarButton::CanBePressedInDisabledState() virtual method in your text field button class and simply return true from it.
|
|
Robert Webb
|
Sep 19, 2008 - 2:03 AM
|
|
|
Peter Meier
|
Sep 15, 2008 - 12:51 PM
|
Hi As I have learned from the documentation and from the forums, only one icon is supported per command. So if I want to display small icons in the menus and use large icons in the toolbars, I need 2 different commands, one for the menu with the small icon and one for the toolbar with the large icon. However, how does the CExtCustomizeSite handle this? How does it know the ones designed for menus and the ones designed for toolbars? Is it left up to the customer to correctly choose the commands from the lists? Regards - Peter
|
|
Technical Support
|
Sep 16, 2008 - 6:24 AM
|
The customize site is also designed for handling one icon per command only. Of course, it’s possible to define two different commands for the same action, but you will see them as different commands in the customize dialog. The customize site is designed to make your application having customizable toolbars and menus similar to those in the latest modern Microsoft’s applications which always use the same images both in toolbars and menus. We could add support for independent icons in toolbars and menus, but this would be inconsistent with well known design of Microsoft applications.
|
|
Peter Meier
|
Sep 16, 2008 - 9:07 AM
|
Oh, I have seen the menu icons now in developer studio :-) . So I agree that Prof-UIS behaves like devstudio does. Sorry for that. But the problem with the checkmarks not breaking through the menuicons still remains. Kind regards - Peter
|
|
Peter Meier
|
Sep 16, 2008 - 6:59 AM
|
Well, MS does not use icons in menus neither, as far as I know. I like the possibility to do this with Prof-UIS, however, since only one icon size is supported, choosing that feature prevents selecting icon sizes larger than 16x16 for toolbars, what would be appropriate nowadays. Also, if I have a command with a check mark in the menu - and highlighted in the toolbar - I really NEED 2 commands up to now, because the icon takes precedence over the checkmark in the menu, and they DO both show up in the customize site. So if you like, please accept these thoughts as feature requests... Kind regards - Peter
|
|
Peter Meier
|
Sep 16, 2008 - 6:51 AM
|
As far as I know, MS does not use
|
|
Peter Meier
|
Sep 16, 2008 - 6:51 AM
|
|
|
Peter Meier
|
Sep 16, 2008 - 6:51 AM
|
|
|
Peter Meier
|
Sep 16, 2008 - 6:51 AM
|
|
|
Peter Meier
|
Sep 16, 2008 - 6:51 AM
|
|
|
Offer Har
|
Sep 15, 2008 - 9:40 AM
|
Again, another week is going by, and all our begging to get some support are ignored... I see that we are not the only ones complaining... please try and do something about the support we are getting in past year. <table width="100%" cellspacing="0" cellpadding="6" border="0" id="MessagesTable" style="border-top: 1px solid rgb(213, 213, 213); border-collapse: collapse;"> <tbody> <tr> <td colspan="3" style="padding: 0px;"> We are here Ron and continuing answering your questions. Nothing is lost. </td> </tr> <tr> <td> </td> <td style="white-space: nowrap; font-weight: bold;">Offer Har</td> <td style="white-space: nowrap;">Sep 9, 2008 - 3:16 PM</td> </tr> <tr> <td colspan="3" style="padding: 0px;"> </td> </tr> </tbody> </table>
|
|
Mike Van Duzee
|
Sep 15, 2008 - 5:12 AM
|
This is the second time I’ve posted this problem... and it was also posted by another user. I realize that this may be a very difficult issue, but its been a month and the only response I’ve gotten is "This issue is not fixed yet. We are working on it." I’m also waiting on another Docking bug that was reported back in March. Does it just happen that the problems I find are so difficult that I can’t even get an update on their status? Or are they just forgotten about? It makes it very difficult to release software built on your framework when I can’t even get updates on the issues I find. I realize that you are very busy with issues reported by other users too, I am just asking for a little feedback. We are currently having problems with the input of key codes (ALT + character sequence). For instance, in ProfStudio if you attempt to enter ALT + 0176 to input a "degree" symbol you get the "spade" or ALT+6. It appears as though all but the last character are being ignored.
This seems consistent in all prof controls (i.e. in the profstudio child window or in either of the edit controls in the tool bars).
|
|
Technical Support
|
Sep 17, 2008 - 2:30 AM
|
It looks like we fixed the issue related to the ALT-key based character code typing issue. Please update the .../Prof-UIS/Include/ExtMenuControlBar.h and .../Prof-UIS/Src/ExtMenuControlBar.cpp files from the following ZIP file, then re-build required Prof-UIS library configurations and your project(s):
http://www.prof-uis.com/download/forums/FixAltKey_CExtMenuControlBar.zip
|
|
Stephan Finkler
|
Sep 15, 2008 - 2:10 AM
|
Hi!
WHERE IS THE SUPPORT????
Have you found a solution in the meantime?
I’m still waiting for an answer/solution.
!!!! IT’S REALLY URGENT !!!!!
I read in the forum that other people have the same problem.
So whats up?
> Dear Michael,
> >>
> >> You asked an interesting question. We modified the following part of the
> >> CExtMenuControlBar::TranslateMainFrameMessage() method:
> >>
> >> if( ( bAlt
> >> || ( m_bFlatTracking
> >> && vkTCHAR != VK_LEFT
> >> && vkTCHAR != VK_RIGHT
> >> && vkTCHAR != VK_UP
> >> && vkTCHAR != VK_DOWN
> >> && vkTCHAR != VK_F4
> >> && vkTCHAR != VK_RETURN
> >> && vkTCHAR != VK_SPACE
> >> && vkTCHAR != VK_ESCAPE
> >> && vkTCHAR != VK_TAB
> >> )
> >> )
> >> && (!bDockSiteCustomizeMode)
> >> )
> >> { // if VK_ALT + VK_... pressed
> >> // if( g_bCancelNearestAltUp ) // (+ v.2.23)
> >> // return FALSE;
> >> if( bKeyUp )
> >> {
> >> // return TRUE; // COMMENTED
> >> return FALSE; // ADDED
> >> }
> >>
> >> And we set breakpoints on all the return TRUE; code lines in this method.
> >> There were no return TRUE; code lines invoked after typing ALT+0160 after
> >> this modification. But WM_CHAR messages are still not received, though the
> >> CExtMenuControlBar::TranslateMainFrameMessage() is no longer filters
> >> keyboard events during ALT+0160 input.
> >>
> >> It looks like GetKeyboardState() and/or GetKeyboardLayout() API
> >>
> invocations
>
> >> are breaking ALT+0160 input. But we cannot avoid the usage of these APIs.
> >> So, we continue our experiments by modifying the
> >> CExtMenuControlBar::TranslateMainFrameMessage() method for correct
> >>
> ALT+0160
>
> >> input.
> >>
> >>
Hi,
>>
>> I’ve got a problem to handle an ALT+0160 (non-breaking space) keyboard
>> input.
>> The view do not receive the WM_CHAR message if I use in
>> CMainFrame::PreTranslateMessage(...)
>> the m_wndMenuBar.TranslateMainFrameMessage() call.
>>
>> See the enclosed and modified StyleEditor Sample.
>>
>> to reproduce that behaviour:
>> - Make a breakpoint in CChildView::OnChar()
>> - press and hold the ALT key and type on num pad 0160 ( ALT + 0160 )
>> --> CChildView::OnKeyUp() is called but not CChildView::OnChar()
>>
>> now comment the lines
>> // if( m_wndMenuBar.TranslateMainFrameMessage( pMsg ) )
>> // return TRUE;
>> in CMainFrame::PreTranslateMessage(...)
>>
>> and repeat the steps above.
>>
>> --> CChildView::OnKeyUp() is called AND CChildView::OnChar() is called
>>
>>
>> Only ALT + 0160 is not working. All other combinations seems ok.
>>
>> Any idea?
|
|
Technical Support
|
Sep 17, 2008 - 2:31 AM
|
It looks like we fixed the issue related to the ALT-key based character code typing issue. Please update the .../Prof-UIS/Include/ExtMenuControlBar.h and .../Prof-UIS/Src/ExtMenuControlBar.cpp files from the following ZIP file, then re-build required Prof-UIS library configurations and your project(s):
http://www.prof-uis.com/download/forums/FixAltKey_CExtMenuControlBar.zip
|
|
Developer NCS
|
Sep 14, 2008 - 9:28 PM
|
Hi Prof-UIS team ! I’d just purcharse Prof-uis v.2.83 and I created a application like RibbonBar MDI. I have some question about ribbonbar: 1. Does Prof-UIS v.2.83 has method that to hide/show a ribbon tab page on RibbonBar ? 2. How to insert dynamic a ribbon tab page at the run time ? 3. "RibbonBar MDI " example in v.2.83 have Maximize, Minimize and Close buttons in the MDI child frame window. But if i create a application RibbonBar MDI using Doc/View Architecture, how to insert Maximize, Minimize and Close buttons in the MDI child frame ?? Thanks !
|
|
Technical Support
|
Sep 15, 2008 - 12:45 PM
|
Our ribbon bar uses a tree structure of command nodes for re-presenting the ribbon layout. Your tree initialization code should be similar to that in our RibbonBarMDI sample application except it should support optional construction of tree branches. When you need to show/hide some ribbon parts (tab pages, groups or some buttons) dynamically, you should re-construct the tree and re-assign it to the ribbon bar control. The [_][o][x] buttons should appear automatically both in the ribbon bar and in the MDI child frame window caption. We need more details about your last question.
|
|
Peter Meier
|
Sep 12, 2008 - 10:00 AM
|
Hi I am wondering if there is a list of new and changed features for the 2.84 release already? My special question about it is whether the CExtResizablePropertySheet class will be 100% compatible with paint managers also in tabbed mode. So if you know already, I would be glad to get a (positive) answer --> else I could already start doing it "by hand". Kind Regards - Peter
|
|
Scott Moore
|
Sep 11, 2008 - 3:21 PM
|
I have a single dynamic bar in my application: _serversCB = static_cast<CExtDynamicControlBar *> (CExtDynamicBarSite::BarAlloc(
L"Servers",
serversIcon,
0,
RUNTIME_CLASS(CExtDynamicControlBar)
)); which I am trying to show in a menu using this code: CExtDynamicBarSite::m_nBarListInMenusCmdID = ID_WINDOW_LIST;
CExtDynamicBarSite::Install(this); POPUP "&Window"
BEGIN
MENUITEM "Window List", ID_WINDOW_LIST
END However, the name "Servers" does show up in the menu, but it’s always greyed out, even if I close the dynamic bar. How do I fix this?
|
|
Scott Moore
|
Sep 12, 2008 - 12:49 PM
|
Thank you, that was the problem.
|
|
Technical Support
|
Sep 12, 2008 - 12:44 PM
|
We failed to reproduce the problem with the MDI_DynamicBars sample. We also tried to insert a new simple popup sub menu using that sample application: POPUP "&ZZZ"
BEGIN
MENUITEM "<< DYNAMIC BARS LIST >>", ID_DYNAMIC_BARS_LIST
END As a result, the menu contains a list of dynamic control bars as it should. This is exactly as you did in your project and this menu is correct.
We suspect the problem may be with something else what is not discussed in your message. Please compare the OnCmdMsg() virtual method in the main frame class of the MDI_DynamicBars sample application with the same method in your project. This virtual method should first of all invoke the CExtDynamicBarSite::OnCmdMsg() method:BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
if( CExtDynamicBarSite::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) )
return TRUE;
. . .
|
|
Scott Moore
|
Sep 11, 2008 - 3:22 PM
|
By the way, I am using prof ui 2.82.
|
|
Robert Webb
|
Sep 11, 2008 - 1:03 AM
|
When I create a split drop-down item in the ribbon bar (__ECTN_TBB_SEPARATED_DROPDOWN) and put icons beside the items on the drop-down, the text for the parent button no longer appears.
Also, I’m playing with the __ECTN_TBB_AUTOCHANGE_ID property, and need a few things it can’t do:
1 - I’d like the tip to also be inherited from the chosen drop-down item.
2 - I’d like to put CExtRibbonNode items in the drop-down, rather than just CExtCustomizeCmdTreeNode. The latter can only provide an icon in one size. It would make more sense to use CExtRibbonNodes which have two icon sizes, which could both be inherited by the main button when an item is selected. That way the button can be resized and make use of the two icons. Currently if I try this, the menu looks fine, but the parent button shows no icon nor text!
I attach a test program below. These files replace the matching ones from the RibbonBarMDI sample code. See the start of MainFrm.cpp for an explanation, and change the TEST_NUMBER #define to try the different test cases.
So let me know what you think of the three main points ASAP:
1 - Can the missing button text be fixed?
2 - Can tips be inherited along with the icon/text?
3 - Is there a way to make it work with CExtRibbonNodes on the drop-down?
Thanks,
Rob. Sorry, can’t see a way to attach a file, so I’ll have to paste them below. There’s two: MainFrm.h and MainFrm.cpp: ========== MainFrm.h ================== // MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__8AD8EDA0_FE43_4657_B159_597A63DD8A98__INCLUDED_)
#define AFX_MAINFRM_H__8AD8EDA0_FE43_4657_B159_597A63DD8A98__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define ID_RIBBON_PAGE_CLIPBOARD 9000
#define ID_RIBBON_PAGE_FONT 9001
#define ID_RIBBON_PAGE_PARAGRAPH 9002
#define ID_MAILINGS_RULES 9003
#define ID_MAILINGS_GOTO_RECORD 9004
#define ID_TRANSLATION_TOOL_TIP 9005
#define ID_SHOW_HIDE_RULER 9006
#define ID_SHOW_HIDE_GRIDLINES 9007
#define ID_SHOW_HIDE_PROPERTIES 9008
#define ID_SHOW_HIDE_DOCUMENT_MAP 9009
#define ID_SHOW_HIDE_THUMBNAILS 9010
#define ID_SHOW_HIDE_DOCUMENT_ACTION_BAR 9011
#define ID_RIBBON_PAGE_STYLE 9012
#define ID_RIBBON_PAGE_INSERT_PAGES 9013
#define ID_RIBBON_PAGE_INSERT_TABLE 9014
#define ID_RIBBON_PAGE_INSERT_ILLUSTRATIONS 9015
#define ID_RIBBON_PAGE_INSERT_LINKS 9016
#define ID_RIBBON_PAGE_INSERT_HEADER_AND_FOOTER 9017
#define ID_RIBBON_PAGE_INSERT_TEXT 9018
#define ID_RIBBON_PAGE_INSERT_SYMBOLS 9019
#define ID_RIBBON_PAGE_PL_THEMES 9020
#define ID_RIBBON_PAGE_PL_PAGE_SETUP 9021
#define ID_RIBBON_PAGE_PL_PAGE_BACKGROUND 9022
#define ID_RIBBON_PAGE_PL_PARAGRAPH 9023
#define ID_RIBBON_PAGE_PL_ARRANGE 9024
#define ID_RIBBON_PAGE_REF_TOC 9025
#define ID_RIBBON_PAGE_REF_FOOTNOTES 9026
#define ID_RIBBON_PAGE_REF_CB 9027
#define ID_RIBBON_PAGE_REF_CAPTIONS 9028
#define ID_RIBBON_PAGE_REF_INDEX 9029
#define ID_RIBBON_PAGE_REF_TOA 9030
#define ID_RIBBON_PAGE_MAIL_CREATE 9031
#define ID_RIBBON_PAGE_MAIL_SMM 9032
#define ID_RIBBON_PAGE_MAIL_WIF 9033
#define ID_RIBBON_PAGE_MAIL_PREVIEW_RESULTS 9034
#define ID_RIBBON_PAGE_MAIL_FINISH 9035
#define ID_RIBBON_PAGE_REVIEW_PROOFING 9036
#define ID_RIBBON_PAGE_REVIEW_COMMENTS 9037
#define ID_RIBBON_PAGE_REVIEW_TRACKING 9038
#define ID_RIBBON_PAGE_REVIEW_CHANGES 9039
#define ID_RIBBON_PAGE_REVIEW_COMPARE 9040
#define ID_RIBBON_PAGE_REVIEW_PROTECT 9041
#define ID_RIBBON_PAGE_VIEW_DV 9042
#define ID_RIBBON_PAGE_VIEW_SHOW_HIDE 9043
#define ID_RIBBON_PAGE_VIEW_ZOOM 9044
#define ID_RIBBON_PAGE_VIEW_WINDOW 9044
#define ID_FB_FINISH_RESTRICT_PERMISSION_UNRESTRICTED_ACCESS 9044
#define ID_FB_FINISH_RESTRICT_PERMISSION_DO_NOT_DISTRIBUTE 9045
#define ID_FB_FINISH_RESTRICT_PERMISSION_AS 9046
#define ID_SAVE_SELECTION_AS_NEW_QUICK_STYLE 9047
#define ID_CLEAR_FORMATTING 9048
#define ID_APPLY_STYLES 9049
#define ID_FONT_MORE_UNDERLINES 9050
#define ID_FONT_CASE_SENTENCE 9051
#define ID_FONT_CASE_LOWER 9052
#define ID_FONT_CASE_UPPPER 9053
#define ID_FONT_CASE_CAPITALIZE_EACH_WORD 9054
#define ID_FONT_CASE_TOGGLE 9055
#define ID_EDIT_PASTE_AS_HYPERLINK 9056
#define ID_PARAGRAPH_LINE_SPACING_10 9057
#define ID_PARAGRAPH_LINE_SPACING_15 9058
#define ID_PARAGRAPH_LINE_SPACING_20 9059
#define ID_PARAGRAPH_LINE_SPACING_25 9060
#define ID_PARAGRAPH_LINE_SPACING_30 9061
#define ID_PARAGRAPH_LINE_SPACING_MORE 9062
#define ID_PARAGRAPH_LINE_SPACING_SPACE_BEFORE 9063
#define ID_PARAGRAPH_LINE_SPACING_NO_SPACE_AFTER 9064
#define ID_DEFINE_NEW_BULLET 9065
#define ID_DEFINE_NEW_MULTILEVEL_LIST 9066
#define ID_DEFINE_NEW_LIST_STYLE 9067
#define ID_SE_FONT_LIST 9068
#define ID_SE_SIZE 9069
#define ID_RTL 9070
#define ID_RIBBON_PAGE_TEST 9071
#include "ChildView.h"
#if !defined(__EXT_TEMPL_H)
#include <ExtTempl.h>
#endif
#define ID_WINDOWS_LIST ID_WINDOW_SWITCH_LARGE
/////////////////////////////////////////////////////////////////////////////
// CMyUserDefinedRibbonOptionsPage
class CMyUserDefinedRibbonOptionsPage : public CExtRibbonOptionsPage
{
public:
DECLARE_DYNCREATE( CMyUserDefinedRibbonOptionsPage );
CMyUserDefinedRibbonOptionsPage();
virtual ~CMyUserDefinedRibbonOptionsPage();
virtual UINT RibbonOptionsPage_GetID() const;
virtual bool RibbonOptionsPage_InitContent();
virtual void RibbonOptionsPage_Apply();
virtual void RibbonOptionsPage_Cancel();
// Attributes
public:
// Dialog Data
//{{AFX_DATA(CMyUserDefinedRibbonOptionsPage)
CExtLabel m_label;
//}}AFX_DATA
// Implementation
protected:
//{{AFX_VIRTUAL(CExtRibbonBar)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnInitDialog();
//}}AFX_VIRTUAL
protected:
// Generated message map functions
//{{AFX_MSG(CMyUserDefinedRibbonOptionsPage)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
}; // class CMyUserDefinedRibbonOptionsPage
/////////////////////////////////////////////////////////////////////////////
// CMyRibbonBar
#define __SO_FONT_SIZE_MIN 4.0f
#define __SO_FONT_SIZE_MAX 200.f
class CMyRibbonBar : public CExtRibbonBar
{
public:
HICON m_hIconPara, m_hIconFontTT, m_hIconFontPix;
CString m_sDecimalSeparator, m_sCurrentFontFaceName;
float m_lfCurrentFontSize;
COLORREF m_clrFontColor;
COLORREF m_clrTextHighlightColor;
CMyRibbonBar();
virtual ~CMyRibbonBar();
virtual void OnRibbonGalleryInitContent(
CExtRibbonGalleryWnd & wndRG,
CExtRibbonGalleryPopupMenuWnd * pGalleryPopup,
CExtRibbonButtonGallery * pRibbonGalleryTBB
);
virtual void OnRibbonOptionsDialogInitPageRTCs(
CExtRibbonOptionsDialog & dlgRibbonOptions
);
virtual bool OnPopupListBoxGetStyles(
CExtBarButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
DWORD & dwListBoxStyles
) const;
virtual bool OnPopupListBoxInitContent(
CExtBarButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
CListBox & wndListBox
);
virtual CSize OnPopupListBoxMeasureTrackSize(
const CExtBarButton * pTBB,
const CExtCustomizeCmdTreeNode * pNode
) const;
virtual bool OnPopupListBoxItemDraw(
CExtBarButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
CListBox & wndListBox,
LPDRAWITEMSTRUCT pDIS
);
virtual bool OnPopupListBoxItemMeasure(
CExtBarButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
CListBox & wndListBox,
LPMEASUREITEMSTRUCT pMIS
);
static int CALLBACK stat_FillFontListBoxProc(
ENUMLOGFONTEX * pEnumLogFontEx,
NEWTEXTMETRICEX * pNewTextMetriCEx,
int nFontType,
CListBox * pListBox
);
virtual bool OnTextFieldVerify(
CExtBarTextFieldButton * pTextFieldTBB,
CExtCustomizeCmdTreeNode * pNode,
__EXT_MFC_SAFE_LPCTSTR sTextOld,
__EXT_MFC_SAFE_LPCTSTR sTextNew
);
virtual void OnTextFieldInplaceTextGet(
const CExtBarTextFieldButton * pTextFieldTBB,
const CExtCustomizeCmdTreeNode * pNode,
CExtSafeString & sTextFieldBuffer
);
virtual void OnTextFieldInplaceTextSet(
CExtBarTextFieldButton * pTextFieldTBB,
CExtCustomizeCmdTreeNode * pNode,
CExtSafeString & sTextFieldBuffer,
__EXT_MFC_SAFE_LPCTSTR sTextNew
);
virtual bool OnColorItemValueGet(
CExtBarColorButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
COLORREF & clr,
bool bSelected
);
virtual bool OnColorItemValueSet(
CExtBarColorButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
COLORREF & clr,
bool bSelected
);
virtual bool OnColorItemCustom(
CExtCustomizeCmdTreeNode * pNode
);
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
class CMainFrame : public CExtNCW < CMDIFrameWnd >
{
public:
CMainFrame();
protected:
DECLARE_DYNAMIC(CMainFrame)
// Attributes
public:
#ifndef __EXT_MFC_NO_MDI_WINDOWS_LIST_DIALOG
class CMyMdiWindowsListDlg : public CExtMdiWindowsListDlg
{
public:
CMyMdiWindowsListDlg(
CMDIFrameWnd * pMDIFrameWnd,
CWnd * pParent = NULL
)
: CExtMdiWindowsListDlg(
pMDIFrameWnd,
pParent
)
{
}
CMyMdiWindowsListDlg(
HWND hMDIFrameWnd,
CWnd * pParent = NULL
)
: CExtMdiWindowsListDlg(
hMDIFrameWnd,
pParent
)
{
}
protected:
virtual void OnUpdateButtons()
{
CExtMdiWindowsListDlg::OnUpdateButtons();
m_btnSave.ShowWindow(SW_HIDE);
}
}; // class CMyMdiWindowsListDlg : public CExtMdiWindowsListDlg
#endif // #ifndef __EXT_MFC_NO_MDI_WINDOWS_LIST_DIALOG
private:
// window placement persistence
WINDOWPLACEMENT m_dataFrameWP;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL DestroyWindow();
virtual void ActivateFrame(int nCmdShow = -1);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
virtual void RecalcLayout(BOOL bNotify = TRUE);
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
class CMDITabs : public CExtTabMdiWnd
{
protected:
bool OnHookWndMsg( LRESULT & lResult, HWND hWndHooked, UINT nMessage, WPARAM & wParam, LPARAM & lParam )
{
__PROF_UIS_MANAGE_STATE;
if( hWndHooked == _GetHwndMdiArea() )
{
switch( nMessage )
{
case WM_ERASEBKGND:
lResult = 1L;
return true;
case WM_PAINT:
{
CWnd * pWnd = CWnd::FromHandle( hWndHooked );
CPaintDC dc( pWnd );
CRect rcClient;
::GetClientRect( hWndHooked, &rcClient );
if( ! g_PaintManager->PaintDockerBkgnd(
true,
dc,
pWnd
)
)
dc.FillSolidRect(
&rcClient,
g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT )
);
}
lResult = 1L;
return true;
case WM_NCCALCSIZE:
lResult = 0L;
return true;
} // switch( nMessage )
} // if( hWndHooked == _GetHwndMdiArea() )
return CExtTabMdiWnd::OnHookWndMsg( lResult, hWndHooked, nMessage, wParam, lParam );
}
};
protected: // control bar embedded members
CMyRibbonBar m_wndRibbonBar;
CExtStatusControlBar m_wndStatusBar;
// CExtMenuControlBar m_wndMenuBar;
CExtToolControlBar m_wndToolBar;
CExtThemeSwitcherToolControlBar m_wndToolBarUiLook;
CExtZoomScrollBar m_wndZoomScrollBar;
CMDITabs m_wndMdiTabs;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
afx_msg void OnUpdateControlBarMenu(CCmdUI* pCmdUI);
afx_msg BOOL OnBarCheck(UINT nID);
DECLARE_MESSAGE_MAP()
void _AdjustRTL();
CExtRibbonNode * m_pRibbonNode;
void _InitRibbonBar();
CExtRibbonNodeRightButtonsCollection * _InitRibbon_RightButtonsCollection();
CExtRibbonNodeQuickAccessButtonsCollection * _InitRibbon_QuickAccessButtonsCollection();
CExtRibbonNodeFile * _InitRibbon_FileMenu();
CExtRibbonNode * _InitRibbonPage_Test();
CExtRibbonNode * _InitRibbonNode_Test_Test();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__8AD8EDA0_FE43_4657_B159_597A63DD8A98__INCLUDED_) ================= MainFrm.cpp ====================== // MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
//
// The problem: text for a drop-down button disappear when the drop-down
// contains images.
//
// Try changing #define TEST_NUMBER below to one of the following numbers:
//
// 1 - No drop-down used. Shows that without a drop-down, the icon and
// text for the button work as expected.
//
// 2 - Now button has an auto-change drop-down, and no images appear in the
// drop-down menu. This case also works as expected, with text appearing for
// the button, and changing depending on the item selected.
//
// 3 - Shows that when the drop-down items contain icons, the button’s text is
// missing. In this case the __ECTN_TBB_AUTOCHANGE_ID property is NOT used.
//
// 4 - Similar to 3, but with auto-change-id (__ECTN_TBB_AUTOCHANGE_ID).
// Selecting an item changes the main icon as expected, but the text which
// should also change remains blank.
//
// 5 - Like 3, but using CExtRibbonNodes as drop-down items rather than
// CExtCustomizeCmdTreeNode. Result is that the menu itself looks fine, but
// somehow the parent button has lost both its icon AND its text.
//
// 6 - Like 4, but using CExtRibbonNodes as drop-down items rather than
// CExtCustomizeCmdTreeNode. Result is same as case 5. Selecting a menu item
// does not put an icon or text on the button either.
//
// Cases 5 and 6 would be ideal, since the button could then inherit its
// child’s small and large icons, to be used according to the size of the
// button at the time (CExtCustomizeCmdTreeNode only has one icon size).
// I’d like large icons on the menu, but to still allow the parent button to be
// resized as necessary.
//
// Finally, I’d like the tip text to also be transfered to the parent button
// when an item is selected. That is, the tip for the menu item should now be
// the tip for the button (along with its icon and text). This could be
// handled via an additional flag maybe for people who use
// __ECTN_TBB_AUTOCHANGE_ID but don’t necessarily want this behaviour.
//
// - Robert Webb
//
#define TEST_NUMBER 4
//
#if (TEST_NUMBER == 1)
//# define USE_DROP_DOWN
//# define USE_AUTO_CHANGE
//# define TRY_RIBBON_NODES_IN_MENU
//# define SHOW_ICONS_IN_MENU
#elif (TEST_NUMBER == 2)
# define USE_DROP_DOWN
# define USE_AUTO_CHANGE
//# define TRY_RIBBON_NODES_IN_MENU
//# define SHOW_ICONS_IN_MENU
#elif (TEST_NUMBER == 3)
# define USE_DROP_DOWN
//# define USE_AUTO_CHANGE
//# define TRY_RIBBON_NODES_IN_MENU
# define SHOW_ICONS_IN_MENU
#elif (TEST_NUMBER == 4)
# define USE_DROP_DOWN
# define USE_AUTO_CHANGE
//# define TRY_RIBBON_NODES_IN_MENU
# define SHOW_ICONS_IN_MENU
#elif (TEST_NUMBER == 5)
# define USE_DROP_DOWN
//# define USE_AUTO_CHANGE
# define TRY_RIBBON_NODES_IN_MENU
# define SHOW_ICONS_IN_MENU
#elif (TEST_NUMBER == 6)
# define USE_DROP_DOWN
# define USE_AUTO_CHANGE
# define TRY_RIBBON_NODES_IN_MENU
# define SHOW_ICONS_IN_MENU
#endif
#include "RibbonBarMDI.h"
#include "MainFrm.h"
#if (!defined __RibbonIcons_H)
#include "res/RibbonIcons.h"
#endif // (!defined __RibbonIcons_H)
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyUserDefinedRibbonOptionsPage
IMPLEMENT_DYNCREATE( CMyUserDefinedRibbonOptionsPage, CExtRibbonOptionsPage );
CMyUserDefinedRibbonOptionsPage::CMyUserDefinedRibbonOptionsPage()
: CExtRibbonOptionsPage( IDD_MY_USER_DEFINED_OPTIONS_PAGE )
{
//{{AFX_DATA_INIT(CMyUserDefinedRibbonOptionsPage)
//}}AFX_DATA_INIT
}
CMyUserDefinedRibbonOptionsPage::~CMyUserDefinedRibbonOptionsPage()
{
}
UINT CMyUserDefinedRibbonOptionsPage::RibbonOptionsPage_GetID() const
{
ASSERT_VALID( this );
return IDD_MY_USER_DEFINED_OPTIONS_PAGE;
}
bool CMyUserDefinedRibbonOptionsPage::RibbonOptionsPage_InitContent()
{
ASSERT_VALID( this );
//CExtRibbonOptionsDialog * pDialogRibbonOptions =
// RibbonOptionsPage_GetContainer();
// if( pDialogRibbonOptions == NULL )
// return false;
return true;
}
void CMyUserDefinedRibbonOptionsPage::RibbonOptionsPage_Apply()
{
ASSERT_VALID( this );
}
void CMyUserDefinedRibbonOptionsPage::RibbonOptionsPage_Cancel()
{
ASSERT_VALID( this );
}
void CMyUserDefinedRibbonOptionsPage::DoDataExchange(CDataExchange* pDX)
{
CExtRibbonOptionsPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyUserDefinedRibbonOptionsPage)
DDX_Control( pDX, IDC_MY_STATIC, m_label );
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP( CMyUserDefinedRibbonOptionsPage, CExtRibbonOptionsPage )
//{{AFX_MSG_MAP(CMyUserDefinedRibbonOptionsPage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CMyUserDefinedRibbonOptionsPage::OnInitDialog()
{
if( ! CExtRibbonOptionsPage::OnInitDialog() )
{
ASSERT( FALSE );
return FALSE;
}
m_label.SetBkColor( m_clrPageBkgnd );
m_label.SetTextColor( true, m_clrPageText );
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMyRibbonBar
CMyRibbonBar::CMyRibbonBar()
{
::GetLocaleInfo(
::GetSystemDefaultLCID(),
LOCALE_SDECIMAL,
m_sDecimalSeparator.GetBuffer( 64 ),
63
);
m_sDecimalSeparator.ReleaseBuffer();
m_sDecimalSeparator.TrimLeft( _T(" \r\n\t") );
m_sDecimalSeparator.TrimRight( _T(" \r\n\t") );
if( m_sDecimalSeparator.GetLength() == 0 )
m_sDecimalSeparator = _T(’.’);
m_hIconFontTT = AfxGetApp()->LoadIcon(IDI_ICON_FONT_TT);
ASSERT( m_hIconFontTT != NULL );
m_hIconFontPix = AfxGetApp()->LoadIcon(IDI_ICON_FONT_PIX);
ASSERT( m_hIconFontPix != NULL );
m_sCurrentFontFaceName = _T("Arial");
m_lfCurrentFontSize = 12.0f;
m_clrFontColor = RGB(255,0,0);
m_clrTextHighlightColor = RGB(255,255,0);
}
CMyRibbonBar::~CMyRibbonBar()
{
::DestroyIcon( m_hIconFontTT );
::DestroyIcon( m_hIconFontPix );
}
int CALLBACK CMyRibbonBar::stat_FillFontListBoxProc(
ENUMLOGFONTEX * pEnumLogFontEx,
NEWTEXTMETRICEX * pNewTextMetriCEx,
int nFontType,
CListBox * pListBox
)
{
pNewTextMetriCEx;
nFontType;
bool bAt =
( pEnumLogFontEx->elfLogFont.lfFaceName[0] == _T(’@’) )
? true : false;
if( bAt )
return 1; // current version hides tool fonts
LPCTSTR sFaceName =
bAt
? ((LPCTSTR)&(pEnumLogFontEx->elfLogFont.lfFaceName))+1
: pEnumLogFontEx->elfLogFont.lfFaceName
;
if( pListBox->FindStringExact( 0, sFaceName ) == CB_ERR )
{
int nItemIdx = pListBox->AddString( sFaceName );
DWORD dwItemData =
( bAt ? 1L : 0L )
| DWORD( pEnumLogFontEx->elfLogFont.lfPitchAndFamily ) << 1
| DWORD( pEnumLogFontEx->elfLogFont.lfOutPrecision ) << 9
| DWORD( pEnumLogFontEx->elfLogFont.lfCharSet) << 17
;
pListBox->SetItemData( nItemIdx, dwItemData );
} // if( pListBox->FindStringExact( 0, sFaceName ) == CB_ERR )
return 1;
}
void CMyRibbonBar::OnRibbonGalleryInitContent(
CExtRibbonGalleryWnd & wndRG,
CExtRibbonGalleryPopupMenuWnd * pGalleryPopup,
CExtRibbonButtonGallery * pRibbonGalleryTBB
)
{
ASSERT_VALID( this );
ASSERT( GetSafeHwnd() != NULL );
ASSERT_VALID( (&wndRG) );
ASSERT( wndRG.GetSafeHwnd() != NULL );
#ifdef _DEBUG
if( pGalleryPopup != NULL )
{
ASSERT_VALID( pGalleryPopup );
ASSERT( pGalleryPopup->GetSafeHwnd() != NULL );
}
#endif // _DEBUG
UINT nCmdID = 0;
if( pRibbonGalleryTBB != NULL )
{
ASSERT_VALID( pRibbonGalleryTBB );
nCmdID = pRibbonGalleryTBB->GetCmdID();
} // if( pRibbonGalleryTBB != NULL )
else
{
ASSERT( pGalleryPopup != NULL );
CExtCustomizeCmdTreeNode * pNode = pGalleryPopup->_CmdNodeGet();
ASSERT_VALID( pNode );
nCmdID = pNode->GetCmdID();
}
switch( nCmdID )
{
case ID_QUICK_STYLES_BIG:
{
wndRG.ModifyToolBoxWndStyle( __TBWS_ZERO_HEIGHT_CAPTIONS );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup =
wndRG.ItemInsert( NULL, _T("Gallery group"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup != NULL );
CExtBitmap _bmp;
VERIFY( _bmp.LoadBMP_Resource( MAKEINTRESOURCE(ID_RIBBON_GALLERY_STYLES) ) );
CSize _sizeBmp = _bmp.GetSize();
static const INT nItemWidth = 64;
CRect rcItem( 0, 0, nItemWidth, _sizeBmp.cy );
INT nItemIndex, nItemCount = _sizeBmp.cx / nItemWidth;
for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
{
CExtCmdIcon _icon;
_icon.m_bmpNormal.FromBitmap( _bmp, &rcItem );
rcItem.OffsetRect( nItemWidth, 0 );
CExtSafeString str;
str.Format( _T("Style %d"), nItemIndex + 1 );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
if( nItemIndex == 0 )
pTBCI_GalleryItem->ModifyItemStyle( __TBWI_SELECTED );
} // for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
pTBCI_GalleryGroup->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
wndRG.ItemExpand( pTBCI_GalleryGroup );
wndRG.ItemSetActive( pTBCI_GalleryGroup );
wndRG.UpdateToolBoxWnd( true );
}
break; // case ID_QUICK_STYLES_BIG
case ID_FONT_UNDERLINE:
{
wndRG.ModifyToolBoxWndStyle( __TBWS_ZERO_HEIGHT_CAPTIONS );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup =
wndRG.ItemInsert( NULL, _T("Gallery group"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup != NULL );
CExtBitmap _bmp;
VERIFY( _bmp.LoadBMP_Resource( MAKEINTRESOURCE(ID_RIBBON_GALLERY_UNDERLINES) ) );
CSize _sizeBmp = _bmp.GetSize();
static const INT nItemHeight = 26;
CRect rcItem( 0, 0, _sizeBmp.cx, nItemHeight );
INT nItemIndex, nItemCount = _sizeBmp.cy / nItemHeight;
for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
{
CExtCmdIcon _icon;
_icon.m_bmpNormal.FromBitmap( _bmp, &rcItem );
rcItem.OffsetRect( 0, nItemHeight );
CExtSafeString str;
str.Format( _T("Underline Style %d"), nItemIndex + 1 );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
if( nItemIndex == 0 )
pTBCI_GalleryItem->ModifyItemStyle( __TBWI_SELECTED );
} // for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
pTBCI_GalleryGroup->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
wndRG.ItemExpand( pTBCI_GalleryGroup );
wndRG.ItemSetActive( pTBCI_GalleryGroup );
wndRG.UpdateToolBoxWnd( true );
}
break; // case ID_FONT_UNDERLINE
case ID_PARAGRAPH_BULLETS:
{
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup0 =
wndRG.ItemInsert( NULL, _T("Recently Used Bullets"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup0 != NULL );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup1 =
wndRG.ItemInsert( NULL, _T("Bullet Library"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup1 != NULL );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup2 =
wndRG.ItemInsert( NULL, _T("Document Bullets"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup2 != NULL );
CExtBitmap _bmp;
VERIFY( _bmp.LoadBMP_Resource( MAKEINTRESOURCE(ID_RIBBON_GALLERY_BULLETS) ) );
CSize _sizeBmp = _bmp.GetSize();
static const INT nItemWidth = 40;
CRect rcItem( 0, 0, nItemWidth, _sizeBmp.cy );
INT nItemIndex, nItemCount = _sizeBmp.cx / nItemWidth;
for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
{
CExtCmdIcon _icon;
_icon.m_bmpNormal.FromBitmap( _bmp, &rcItem );
rcItem.OffsetRect( nItemWidth, 0 );
CExtSafeString str;
if( nItemIndex == 0 )
str = _T("None");
else
str.Format( _T("Bullet %d"), nItemIndex + 1 );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup1, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
if( nItemIndex == 0 )
pTBCI_GalleryItem->ModifyItemStyle( __TBWI_SELECTED );
if( nItemIndex == 1 )
{
pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup0, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup2, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
}
} // for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
pTBCI_GalleryGroup0->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
pTBCI_GalleryGroup1->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
pTBCI_GalleryGroup2->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
wndRG.ItemExpand( pTBCI_GalleryGroup0 );
wndRG.ItemExpand( pTBCI_GalleryGroup1 );
wndRG.ItemExpand( pTBCI_GalleryGroup2 );
wndRG.ItemSetActive( pTBCI_GalleryGroup1 );
wndRG.UpdateToolBoxWnd( true );
}
break; // case ID_PARAGRAPH_BULLETS
case ID_PARAGRAPH_NUMBERING:
{
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup0 =
wndRG.ItemInsert( NULL, _T("Recently Used Number Formats"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup0 != NULL );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup1 =
wndRG.ItemInsert( NULL, _T("Numbering Library"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup1 != NULL );
CExtBitmap _bmp;
VERIFY( _bmp.LoadBMP_Resource( MAKEINTRESOURCE(ID_RIBBON_GALLERY_NUMBERING) ) );
CSize _sizeBmp = _bmp.GetSize();
static const INT nItemWidth = 76;
CRect rcItem( 0, 0, nItemWidth, _sizeBmp.cy );
INT nItemIndex, nItemCount = _sizeBmp.cx / nItemWidth;
for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
{
CExtCmdIcon _icon;
_icon.m_bmpNormal.FromBitmap( _bmp, &rcItem );
rcItem.OffsetRect( nItemWidth, 0 );
CExtSafeString str;
if( nItemIndex == 0 )
str = _T("None");
else
str.Format( _T("Number Format %d"), nItemIndex + 1 );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup1, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
if( nItemIndex == 0 )
pTBCI_GalleryItem->ModifyItemStyle( __TBWI_SELECTED );
if( nItemIndex == 1 )
{
pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup0, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
}
} // for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
pTBCI_GalleryGroup0->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
pTBCI_GalleryGroup1->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
wndRG.ItemExpand( pTBCI_GalleryGroup0 );
wndRG.ItemExpand( pTBCI_GalleryGroup1 );
wndRG.ItemSetActive( pTBCI_GalleryGroup1 );
wndRG.UpdateToolBoxWnd( true );
}
break; // case ID_PARAGRAPH_NUMBERING
case ID_PARAGRAPH_MULTILEVEL_LIST:
{
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup0 =
wndRG.ItemInsert( NULL, _T("Current List"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup0 != NULL );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup1 =
wndRG.ItemInsert( NULL, _T("My Lists"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup1 != NULL );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup2 =
wndRG.ItemInsert( NULL, _T("Lists in Current Document"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup2 != NULL );
CExtBitmap _bmp;
VERIFY( _bmp.LoadBMP_Resource( MAKEINTRESOURCE(ID_RIBBON_GALLERY_MULTILEVEL_LIST) ) );
CSize _sizeBmp = _bmp.GetSize();
static const INT nItemWidth = 76;
CRect rcItem( 0, 0, nItemWidth, _sizeBmp.cy );
INT nItemIndex, nItemCount = _sizeBmp.cx / nItemWidth;
for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
{
CExtCmdIcon _icon;
_icon.m_bmpNormal.FromBitmap( _bmp, &rcItem );
rcItem.OffsetRect( nItemWidth, 0 );
CExtSafeString str;
if( nItemIndex == 0 )
str = _T("None");
else
str.Format( _T("List Format %d"), nItemIndex + 1 );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup1, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
if( nItemIndex == 0 )
pTBCI_GalleryItem->ModifyItemStyle( __TBWI_SELECTED );
if( nItemIndex == 1 )
{
pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup0, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup2, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
}
} // for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
pTBCI_GalleryGroup0->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
pTBCI_GalleryGroup1->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
pTBCI_GalleryGroup2->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
wndRG.ItemExpand( pTBCI_GalleryGroup0 );
wndRG.ItemExpand( pTBCI_GalleryGroup1 );
wndRG.ItemExpand( pTBCI_GalleryGroup2 );
wndRG.ItemSetActive( pTBCI_GalleryGroup1 );
wndRG.UpdateToolBoxWnd( true );
}
break; // case ID_PARAGRAPH_MULTILEVEL_LIST
case ID_CHANGE_LIST_LEVEL:
{
wndRG.ModifyToolBoxWndStyle( __TBWS_ZERO_HEIGHT_CAPTIONS );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup =
wndRG.ItemInsert( NULL, _T("Gallery group"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup != NULL );
CExtBitmap _bmp;
VERIFY( _bmp.LoadBMP_Resource( MAKEINTRESOURCE(ID_RIBBON_GALLERY_CHANGE_LIST_LEVEL) ) );
CSize _sizeBmp = _bmp.GetSize();
static const INT nItemHeight = 30;
CRect rcItem( 0, 0, _sizeBmp.cx, nItemHeight );
INT nItemIndex, nItemCount = _sizeBmp.cy / nItemHeight;
for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
{
CExtCmdIcon _icon;
_icon.m_bmpNormal.FromBitmap( _bmp, &rcItem );
rcItem.OffsetRect( 0, nItemHeight );
CExtSafeString str;
str.Format( _T("Level %d"), nItemIndex + 1 );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup, str, &_icon );
ASSERT( pTBCI_GalleryItem != NULL );
if( nItemIndex == 0 )
pTBCI_GalleryItem->ModifyItemStyle( __TBWI_SELECTED );
} // for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
pTBCI_GalleryGroup->ModifyItemStyle( 0, __TBWI_LISTBOX_VIEW );
wndRG.ItemExpand( pTBCI_GalleryGroup );
wndRG.ItemSetActive( pTBCI_GalleryGroup );
wndRG.UpdateToolBoxWnd( true );
}
break; // case ID_CHANGE_LIST_LEVEL
default:
if( (pGalleryPopup->TrackFlagsGet()&TPMX_RIBBON_FILE_MENU) )
{
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup =
wndRG.ItemInsert( NULL, _T("Recent Documents"), (HICON) NULL );
ASSERT( pTBCI_GalleryGroup != NULL );
INT nItemIndex, nItemCount = 5;
for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
{
CExtSafeString str;
str.Format( _T(" %d Recent Document Name"), nItemIndex + 1 );
CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryItem =
wndRG.ItemInsert( pTBCI_GalleryGroup, str, (HICON)NULL );
ASSERT( pTBCI_GalleryItem != NULL );
pTBCI_GalleryItem;
} // for( nItemIndex = 0; nItemIndex < nItemCount; nItemIndex++ )
wndRG.ItemExpand( pTBCI_GalleryGroup );
wndRG.ItemSetActive( pTBCI_GalleryGroup );
wndRG.UpdateToolBoxWnd( true );
} // if( (pGalleryPopup->TrackFlagsGet()&TPMX_RIBBON_FILE_MENU) )
break; // default
} // switch( nCmdID )
}
void CMyRibbonBar::OnRibbonOptionsDialogInitPageRTCs(
CExtRibbonOptionsDialog & dlgRibbonOptions
)
{
ASSERT_VALID( this );
CExtRibbonBar::OnRibbonOptionsDialogInitPageRTCs( dlgRibbonOptions );
dlgRibbonOptions.m_arrPageRTCs.Add(
RUNTIME_CLASS( CMyUserDefinedRibbonOptionsPage )
);
}
bool CMyRibbonBar::OnColorItemValueGet(
CExtBarColorButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
COLORREF & clr,
bool bSelected
)
{
ASSERT_VALID( this );
ASSERT_VALID( pNode );
CExtRibbonPage * pRibbonPage = GetMainRibbonPage();
if( pRibbonPage == NULL )
{
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_FONT_CHAR_COLOR:
if( bSelected )
clr = m_clrFontColor;
else
clr = RGB(255,0,0);
break;
case ID_FONT_TEXT_HIGHLIGHT_COLOR:
if( bSelected )
clr = m_clrTextHighlightColor;
else
clr = RGB(255,255,0);
break;
default:
return
CExtRibbonBar::OnColorItemValueGet(
pTBB,
pNode,
clr,
bSelected
);
}
return true;
}
else
return
pRibbonPage->OnColorItemValueGet(
pTBB,
pNode,
clr,
bSelected
);
}
bool CMyRibbonBar::OnColorItemValueSet(
CExtBarColorButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
COLORREF & clr,
bool bSelected
)
{
ASSERT_VALID( this );
ASSERT_VALID( pNode );
CExtRibbonPage * pRibbonPage = GetMainRibbonPage();
if( pRibbonPage == NULL )
{
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_FONT_CHAR_COLOR:
if( clr == COLORREF(-1L) )
m_clrFontColor = RGB(255,0,0);
else
m_clrFontColor = clr;
break;
case ID_FONT_TEXT_HIGHLIGHT_COLOR:
if( clr == COLORREF(-1L) )
m_clrTextHighlightColor = RGB(255,255,0);
else
m_clrTextHighlightColor = clr;
break;
default:
return
CExtRibbonBar::OnColorItemValueSet(
pTBB,
pNode,
clr,
bSelected
);
}
CExtRibbonBar::RedrawCommandItems( nCmdID );
return true;
}
else
return
pRibbonPage->OnColorItemValueSet(
pTBB,
pNode,
clr,
bSelected
);
}
bool CMyRibbonBar::OnColorItemCustom(
CExtCustomizeCmdTreeNode * pNode
)
{
ASSERT_VALID( this );
ASSERT_VALID( pNode );
CExtRibbonPage * pRibbonPage = GetMainRibbonPage();
if( pRibbonPage == NULL )
{
CExtColorDlg dlg;
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_FONT_CHAR_COLOR:
dlg.m_clrInit = dlg.m_clrNew = m_clrFontColor;
break;
case ID_FONT_TEXT_HIGHLIGHT_COLOR:
dlg.m_clrInit = dlg.m_clrNew = m_clrTextHighlightColor;
break;
default:
return CExtRibbonBar::OnColorItemCustom( pNode );
}
if( dlg.DoModal() != IDOK )
return false;
switch( nCmdID )
{
case ID_FONT_CHAR_COLOR:
m_clrFontColor = dlg.m_clrNew;
break;
case ID_FONT_TEXT_HIGHLIGHT_COLOR:
m_clrTextHighlightColor = dlg.m_clrNew;
break;
}
CExtRibbonBar::RedrawCommandItems( nCmdID );
return true;
}
else
return pRibbonPage->OnColorItemCustom( pNode );
}
bool CMyRibbonBar::OnPopupListBoxGetStyles(
CExtBarButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
DWORD & dwListBoxStyles
) const
{
ASSERT_VALID( this );
#ifdef _DEBUG
if( pTBB != NULL )
{
ASSERT_VALID( pTBB );
ASSERT_VALID( pTBB->GetBar() );
}
#endif // _DEBUG
ASSERT_VALID( pNode );
UINT nCmdID = pNode->GetCmdID(false);
if( nCmdID == ID_SE_FONT_LIST )
{
dwListBoxStyles |= LBS_SORT;
return true;
} // if( nCmdID == ID_SE_FONT_LIST )
return
CExtRibbonBar::OnPopupListBoxGetStyles(
pTBB,
pNode,
dwListBoxStyles
);
}
static void stat_FormatFontSize(
CExtSafeString & sText,
LPCTSTR sDecimalSeparator,
float fFontSize
)
{
ASSERT( sDecimalSeparator != NULL );
float fFL = (float)floor(fFontSize);
if( fFL == fFontSize )
sText.Format( _T("%.0f"), fFontSize );
else
{
// double fDiv = double(fFontSize) - double(fFL);
// fDiv *= 10.0;
// fDiv = ceil(fDiv);
// int nDiv = (int)fDiv;
// sText.Format(
// _T("%.0f%s%d"),
// fFL,
// sDecimalSeparator,
// nDiv
// );
sText.Format( _T("%.1f"), fFontSize );
sText.Replace( __EXT_MFC_SAFE_LPCTSTR(_T(".")), __EXT_MFC_SAFE_LPCTSTR(sDecimalSeparator) );
}
}
bool CMyRibbonBar::OnPopupListBoxInitContent(
CExtBarButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
CListBox & wndListBox
)
{
#ifdef _DEBUG
if( pTBB != NULL )
{
ASSERT_VALID( pTBB );
ASSERT_VALID( pTBB->GetBar() );
}
#endif // _DEBUG
ASSERT_VALID( pNode );
ASSERT_VALID( (&wndListBox) );
pTBB;
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_SE_FONT_LIST:
{
CClientDC dc( this );
LOGFONT lf;
::memset( &lf, 0, sizeof(LOGFONT) );
lf.lfCharSet = DEFAULT_CHARSET;
::EnumFontFamiliesEx(
dc.m_hDC,
&lf,
(FONTENUMPROC)stat_FillFontListBoxProc,
(LPARAM)&wndListBox,
0
);
LPCTSTR sFieldText = (LPCTSTR)pNode->m_sDefInplaceEditBuffer;
if( sFieldText != NULL && _tcslen(sFieldText) > 0 )
wndListBox.SelectString( -1, sFieldText );
return true;
} // case ID_SE_FONT_LIST
case ID_SE_SIZE:
{
static const float arr_sizes[] = {
8.0f, 9.0f, 10.0f, 10.5f, 11.0f, 12.0f, 14.0f, 16.0f,
18.0f, 20.0f, 22.0f, 24.0f, 26.0f, 28.0f, 36.0f, 48.0f, 72.0f
};
for( int nItemIdx = 0;
nItemIdx < sizeof(arr_sizes)/sizeof(arr_sizes[0]);
nItemIdx++
)
{
CExtSafeString sText;
float fFontSize = arr_sizes[nItemIdx];
ASSERT( __SO_FONT_SIZE_MIN <= fFontSize );
ASSERT( fFontSize <= __SO_FONT_SIZE_MAX );
stat_FormatFontSize(
sText,
m_sDecimalSeparator,
fFontSize
);
wndListBox.AddString( (LPCTSTR)sText );
wndListBox.SetItemData( nItemIdx, (DWORD)fFontSize );
}
CExtSafeString sFieldText;
stat_FormatFontSize(
sFieldText,
m_sDecimalSeparator,
m_lfCurrentFontSize
);
if( !sFieldText.IsEmpty() )
wndListBox.SelectString( -1, sFieldText );
return true;
} // case ID_SE_FONT_LIST
} // switch( nCmdID )
return false;
}
CSize CMyRibbonBar::OnPopupListBoxMeasureTrackSize(
const CExtBarButton * pTBB,
const CExtCustomizeCmdTreeNode * pNode
) const
{
#ifdef _DEBUG
if( pTBB != NULL )
{
ASSERT_VALID( pTBB );
ASSERT_VALID( pTBB->GetBar() );
}
#endif // _DEBUG
ASSERT_VALID( pNode );
pTBB;
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_SE_FONT_LIST:
return CSize( 300, 400 );
} // switch( nCmdID )
return CSize( 0, 0 ); // this is not our business, let the bar button compute it
}
bool CMyRibbonBar::OnPopupListBoxItemDraw(
CExtBarButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
CListBox & wndListBox,
LPDRAWITEMSTRUCT pDIS
)
{
pTBB;
#ifdef _DEBUG
if( pTBB != NULL )
{
ASSERT_VALID( pTBB );
ASSERT_VALID( pTBB->GetBar() );
}
#endif // _DEBUG
ASSERT_VALID( pNode );
ASSERT_VALID( (&wndListBox) );
ASSERT( pDIS != NULL && pDIS->hDC != NULL );
wndListBox;
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_SE_FONT_LIST:
{
ASSERT( (wndListBox.GetStyle() & LBS_HASSTRINGS) != 0 );
if( ((INT)pDIS->itemID) < 0 || ((INT)pDIS->itemID) >= wndListBox.GetCount() )
return true;
CString sText;
wndListBox.GetText( (INT)pDIS->itemID, sText );
ASSERT( !sText.IsEmpty() );
DWORD dwItemData = DWORD( wndListBox.GetItemData( (INT)pDIS->itemID ) );
bool bSymbols =
( (( ((DWORD)(dwItemData)) >> 17)&0x0FF) == SYMBOL_CHARSET )
? true : false;
HFONT hDefFont = (HFONT)g_PaintManager->m_FontNormal.GetSafeHandle();
if( hDefFont == NULL )
hDefFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
if( hDefFont == NULL )
hDefFont = (HFONT)::GetStockObject(SYSTEM_FONT);
ASSERT( hDefFont != NULL );
LOGFONT lf;
::memset( &lf, 0, sizeof(LOGFONT) );
if( ::GetObject(
(HGDIOBJ)hDefFont,
sizeof(LOGFONT),
&lf
) != sizeof(LOGFONT)
)
{
ASSERT( FALSE );
return true;
}
__EXT_MFC_STRNCPY(
lf.lfFaceName,
LF_FACESIZE,
LPCTSTR(sText),
LF_FACESIZE
);
lf.lfHeight = ::MulDiv( lf.lfHeight, 13, 8 );
lf.lfOutPrecision = BYTE( (dwItemData >> 9) & 0x0FF);
lf.lfCharSet = BYTE( (dwItemData >> 17) & 0x0FF);
lf.lfQuality = PROOF_QUALITY;
CFont font;
if( !font.CreateFontIndirect( &lf ) )
{
ASSERT( FALSE );
return true;
}
CDC dc;
dc.Attach( pDIS->hDC );
dc.FillSolidRect(
&pDIS->rcItem,
g_PaintManager->GetColor(
( pDIS->itemState & ODS_SELECTED )
? COLOR_HIGHLIGHT
: COLOR_WINDOW
,
this
)
);
CRect rcText( pDIS->rcItem );
//rcText.DeflateRect( OnPopupListBoxCalcItemExtraSizes(pTBB) );
ASSERT( m_hIconFontTT != NULL );
ASSERT( m_hIconFontPix != NULL );
dc.DrawIcon(
rcText.TopLeft(),
(dwItemData & 2) ? m_hIconFontPix : m_hIconFontTT
);
rcText.left += 18;
COLORREF clrTextOld =
dc.SetTextColor(
g_PaintManager->GetColor(
( pDIS->itemState & ODS_SELECTED )
? COLOR_HIGHLIGHTTEXT
: COLOR_BTNTEXT
,
this
)
);
int nOldBkMode = dc.SetBkMode( TRANSPARENT );
HGDIOBJ hOldFont = dc.SelectObject( (HGDIOBJ)hDefFont );
if( bSymbols )
{
CRect rcTextMeasure( 0, 0, 0, 0 );
dc.DrawText(
sText,
&rcTextMeasure,
DT_SINGLELINE|DT_LEFT|DT_TOP|DT_NOPREFIX|DT_CALCRECT
);
dc.DrawText(
sText,
&rcText,
DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_NOPREFIX
);
rcText.left += rcTextMeasure.Width() + 4;
} // if( bSymbols )
dc.SelectObject( &font );
dc.DrawText(
sText,
&rcText,
DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_NOPREFIX
);
dc.SetBkMode( nOldBkMode );
dc.SetTextColor( clrTextOld );
dc.SelectObject( (HGDIOBJ)hOldFont );
if( pDIS->itemState & ODS_SELECTED )
{
COLORREF clrTextOld =
dc.SetTextColor(
::GetSysColor( COLOR_HIGHLIGHTTEXT )
);
COLORREF clrBkOld = dc.SetBkColor( RGB(0,0,0) );
dc.DrawFocusRect( &pDIS->rcItem );
dc.SetBkColor( clrBkOld );
dc.SetTextColor( clrTextOld );
}
dc.Detach();
return true;
} // case ID_SE_FONT_LIST
} // switch( nCmdID )
return false; // this is not our business, let the bar button paint it
}
bool CMyRibbonBar::OnPopupListBoxItemMeasure(
CExtBarButton * pTBB,
CExtCustomizeCmdTreeNode * pNode,
CListBox & wndListBox,
LPMEASUREITEMSTRUCT pMIS
)
{
pTBB;
#ifdef _DEBUG
if( pTBB != NULL )
{
ASSERT_VALID( pTBB );
ASSERT_VALID( pTBB->GetBar() );
}
#endif // _DEBUG
ASSERT_VALID( pNode );
ASSERT_VALID( (&wndListBox) );
ASSERT( pMIS != NULL );
wndListBox;
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_SE_FONT_LIST:
{
ASSERT( (wndListBox.GetStyle() & LBS_HASSTRINGS) != 0 );
if( ((INT)pMIS->itemID) < 0 || ((INT)pMIS->itemID) >= wndListBox.GetCount() )
return true;
CString sText;
wndListBox.GetText( (INT)pMIS->itemID, sText );
ASSERT( !sText.IsEmpty() );
DWORD dwItemData = DWORD( wndListBox.GetItemData( (INT)pMIS->itemID ) );
HFONT hDefFont = (HFONT)g_PaintManager->m_FontNormal.GetSafeHandle();
if( hDefFont == NULL )
hDefFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
if( hDefFont == NULL )
hDefFont = (HFONT)::GetStockObject(SYSTEM_FONT);
ASSERT( hDefFont != NULL );
LOGFONT lf;
::memset( &lf, 0, sizeof(LOGFONT) );
if( ::GetObject(
(HGDIOBJ)hDefFont,
sizeof(LOGFONT),
&lf
) != sizeof(LOGFONT)
)
{
ASSERT( FALSE );
return true;
}
__EXT_MFC_STRNCPY(
lf.lfFaceName,
LF_FACESIZE,
LPCTSTR(sText),
LF_FACESIZE
);
lf.lfHeight = ::MulDiv( lf.lfHeight, 13, 8 );
lf.lfOutPrecision = BYTE( (dwItemData >> 9) & 0x0FF);
lf.lfCharSet = BYTE( (dwItemData >> 17) & 0x0FF);
lf.lfQuality = PROOF_QUALITY;
CFont font;
if( !font.CreateFontIndirect( &lf ) )
{
ASSERT( FALSE );
return true;
}
//CSize sizeExtra = OnPopupListBoxCalcItemExtraSizes( pTBB );
//sizeExtra.cx *= 2;
//sizeExtra.cy *= 2;
CClientDC dc( this );
HGDIOBJ hOldFont = dc.SelectObject( (HGDIOBJ)hDefFont );
CRect rcText( 0, 0, 0, 0 );
dc.DrawText(
sText,
&rcText,
DT_SINGLELINE|DT_LEFT|DT_TOP|DT_NOPREFIX|DT_CALCRECT
);
CSize sizeBtn( rcText.Size() );
dc.SelectObject( &font );
rcText.SetRect( 0, 0, 0, 0 );
dc.DrawText(
sText,
&rcText,
DT_SINGLELINE|DT_LEFT|DT_TOP|DT_NOPREFIX|DT_CALCRECT
);
sizeBtn.cx = max( sizeBtn.cx, rcText.Width() );
sizeBtn.cy = max( sizeBtn.cy, rcText.Height() );
dc.SelectObject( hOldFont );
sizeBtn.cx += 18; // icon
sizeBtn.cy = max( 16, sizeBtn.cy ); // icon
//sizeBtn += sizeExtra;
pMIS->itemWidth = sizeBtn.cx;
pMIS->itemHeight = sizeBtn.cy;
return true;
} // case ID_SE_FONT_LIST
} // switch( nCmdID )
return false; // this is not our business, let the bar button measure it
}
bool CMyRibbonBar::OnTextFieldVerify(
CExtBarTextFieldButton * pTextFieldTBB,
CExtCustomizeCmdTreeNode * pNode,
__EXT_MFC_SAFE_LPCTSTR sTextOld,
__EXT_MFC_SAFE_LPCTSTR sTextNew
)
{
ASSERT_VALID( this );
#ifdef _DEBUG
if( pTextFieldTBB != NULL )
{
ASSERT_VALID( pTextFieldTBB );
ASSERT_VALID( pTextFieldTBB->GetBar() );
}
#endif // _DEBUG
ASSERT_VALID( pNode );
ASSERT( sTextOld != NULL );
ASSERT( sTextNew != NULL );
pTextFieldTBB;
sTextOld;
UINT nCmdID = pNode->GetCmdID(false);
if( nCmdID == ID_SE_SIZE )
{
int nTextLenNew = int( _tcslen( sTextNew ) );
//if( nTextLenNew == 0 )
// return false;
int nSepLen = m_sDecimalSeparator.GetLength();
ASSERT( nSepLen > 0 );
bool bSeparatorPassed = false;
for( int nChrIdx = 0; nChrIdx < nTextLenNew; nChrIdx++ )
{
TCHAR chr = sTextNew[nChrIdx];
if( _istdigit(chr) )
continue;
if( bSeparatorPassed )
return false;
if( _tcsncmp(
((LPCTSTR)sTextNew) + nChrIdx,
m_sDecimalSeparator,
nSepLen
)
)
return false;
bSeparatorPassed = true;
nChrIdx += nSepLen - 1;
} // for( int nChrIdx = 0; nChrIdx < nTextLenNew; nChrIdx++ )
return true;
} // if( nCmdID == ID_SE_SIZE )
return true;
}
void CMyRibbonBar::OnTextFieldInplaceTextGet(
const CExtBarTextFieldButton * pTextFieldTBB,
const CExtCustomizeCmdTreeNode * pNode,
CExtSafeString & sTextFieldBuffer
)
{
#ifdef _DEBUG
if( pTextFieldTBB != NULL )
{
ASSERT_VALID( pTextFieldTBB );
ASSERT_VALID( pTextFieldTBB->GetBar() );
}
#endif // _DEBUG
ASSERT_VALID( pNode );
pTextFieldTBB;
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_SE_FONT_LIST:
sTextFieldBuffer = m_sCurrentFontFaceName;
return;
case ID_SE_SIZE:
{
float fFontSize = m_lfCurrentFontSize;
ASSERT( __SO_FONT_SIZE_MIN <= fFontSize );
ASSERT( fFontSize <= __SO_FONT_SIZE_MAX );
stat_FormatFontSize(
sTextFieldBuffer,
m_sDecimalSeparator,
fFontSize
);
return;
} // case ID_SE_FONT_LIST
} // switch( nCmdID )
}
void CMyRibbonBar::OnTextFieldInplaceTextSet(
CExtBarTextFieldButton * pTextFieldTBB,
CExtCustomizeCmdTreeNode * pNode,
CExtSafeString & sTextFieldBuffer,
__EXT_MFC_SAFE_LPCTSTR sTextNew
)
{
ASSERT_VALID( this );
#ifdef _DEBUG
if( pTextFieldTBB != NULL )
{
ASSERT_VALID( pTextFieldTBB );
ASSERT_VALID( pTextFieldTBB->GetBar() );
}
#endif // _DEBUG
ASSERT_VALID( pNode );
ASSERT( sTextNew != NULL );
pTextFieldTBB;
CString sTextAdjusted;
sTextAdjusted = LPCTSTR(sTextNew);
UINT nCmdID = pNode->GetCmdID(false);
switch( nCmdID )
{
case ID_SE_FONT_LIST:
sTextFieldBuffer = LPCTSTR(sTextAdjusted);
m_sCurrentFontFaceName = LPCTSTR(sTextAdjusted);
CExtRibbonBar::RedrawCommandItems( nCmdID );
break;
case ID_SE_SIZE:
{
sTextAdjusted.Replace(
LPCTSTR(m_sDecimalSeparator),
_T(".")
);
sTextAdjusted.Replace( _T(" "), _T("") );
TCHAR * pEndPtr = NULL;
float fFontSize =
(float) _tcstod( (LPCTSTR)sTextAdjusted, &pEndPtr );
m_lfCurrentFontSize = fFontSize;
ASSERT( __SO_FONT_SIZE_MIN <= fFontSize );
ASSERT( fFontSize <= __SO_FONT_SIZE_MAX );
stat_FormatFontSize(
sTextFieldBuffer,
m_sDecimalSeparator,
fFontSize
);
CExtRibbonBar::RedrawCommandItems( nCmdID );
break;
} // case ID_SE_FONT_LIST
} // switch( nCmdID )
CExtPopupMenuWnd * pPopup =
CExtPopupMenuWnd::GetTrackingMenu();
if( pPopup->GetSafeHwnd() != NULL
&& ::IsWindow( pPopup->GetSafeHwnd() )
)
{
::PostMessage(
pPopup->GetSafeHwnd(),
WM_CANCELMODE,
0,
0
);
}
// if( m_wndView.GetSafeHwnd() != NULL
// && ::IsWindow( m_wndView.GetSafeHwnd() )
// )
// {
// m_wndView.Invalidate();
// m_wndView.UpdateWindow();
// }
CExtRibbonBar::OnTextFieldInplaceTextSet(
pTextFieldTBB,
pNode,
sTextFieldBuffer,
sTextNew
);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNAMIC( CMainFrame, CMDIFrameWnd )
BEGIN_MESSAGE_MAP( CMainFrame, CMDIFrameWnd )
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
//}}AFX_MSG_MAP
// ON_COMMAND_EX(ID_VIEW_MENUBAR, OnBarCheck )
// ON_UPDATE_COMMAND_UI(ID_VIEW_MENUBAR, OnUpdateControlBarMenu)
ON_COMMAND_EX(ID_VIEW_UI_LOOK_BAR, OnBarCheck )
ON_UPDATE_COMMAND_UI(ID_VIEW_UI_LOOK_BAR, OnUpdateControlBarMenu)
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
ID_INDICATOR_ZOOM
};
void CMainFrame::OnUpdateControlBarMenu(CCmdUI* pCmdUI)
{
CExtControlBar::DoFrameBarCheckUpdate( this, pCmdUI, true );
}
BOOL CMainFrame::OnBarCheck(UINT nID)
{
return CExtControlBar::DoFrameBarCheckCmd( this, nID, true );
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
: m_pRibbonNode( NULL )
{
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
if( ! g_PaintManager.PaintManagerStateLoad(
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName
)
)
g_PaintManager.InstallPaintManager(
RUNTIME_CLASS(CExtPaintManagerOffice2007_R3_Silver)
);
// if( ! g_PaintManager.PaintManagerStateLoad(
// pApp->m_pszRegistryKey,
// pApp->m_pszProfileName,
// pApp->m_pszProfileName
// )
// )
// {
// CExtPaintManagerSkin * pPM = new CExtPaintManagerSkin;
// bool bLoaded = true;
// if( ! pPM->m_Skin.SearchAndLoadSkinFile( _T("BlackDiamond.Skin"), false ) )
// {
// if( ! pPM->m_Skin.SearchAndLoadSkinFile( _T("..\\..\\Skins\\Binary\\Aqua.Skin"), false ) )
// {
// bLoaded = false;
// ::AfxMessageBox( _T("Failed to load initial skin.") );
// delete pPM;
// }
// }
// if( bLoaded )
// g_PaintManager.InstallPaintManager( pPM );
// }
CExtPopupMenuWnd::g_bMenuExpanding = false;
CExtPopupMenuWnd::g_bMenuHighlightRarely = false;
// window placement persistence
::memset( &m_dataFrameWP, 0, sizeof(WINDOWPLACEMENT) );
m_dataFrameWP.length = sizeof(WINDOWPLACEMENT);
m_dataFrameWP.showCmd = SW_HIDE;
}
CMainFrame::~CMainFrame()
{
if( m_pRibbonNode != NULL )
delete m_pRibbonNode;
}
void CMainFrame::RecalcLayout(BOOL bNotify)
{
CExtNCW < CMDIFrameWnd > :: RecalcLayout( bNotify );
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if( CExtNCW < CMDIFrameWnd > :: OnCreate( lpCreateStruct ) == -1 )
return -1;
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
HICON hIcon = pApp->LoadIcon( IDR_MAINFRAME );
ASSERT( hIcon != NULL );
SetIcon( hIcon, TRUE );
SetIcon( hIcon, FALSE );
g_CmdManager->ProfileSetup(
pApp->m_pszProfileName,
GetSafeHwnd()
);
VERIFY(
g_CmdManager->UpdateFromMenu(
pApp->m_pszProfileName,
IDR_MAINFRAME
)
);
if( ! m_wndRibbonBar.Create(
NULL,
this
)
)
{
TRACE0("Failed to create the m_wndRibbonBar toolbar\n");
return -1; // fail to create
}
//m_wndRibbonBar.ModifyStyleEx( 0, WS_EX_LAYOUTRTL, SWP_FRAMECHANGED );
//m_wndView.ModifyStyleEx( 0, WS_EX_LAYOUTRTL, SWP_FRAMECHANGED );
//g_ResourceManager->SetLangLayout( LAYOUT_RTL );
_InitRibbonBar();
m_wndToolBarUiLook.m_bEnableOffice2007r3 = true;
if( (! m_wndToolBarUiLook.Create( NULL, this, ID_VIEW_UI_LOOK_BAR ) )
|| (! m_wndToolBarUiLook.ThemeSwitcherInit() )
)
{
TRACE0("Failed to create the m_wndToolBarUiLook toolbar\n");
return -1; // fail to create
}
m_wndStatusBar.m_bDrawPaneSeparatorsInsteadOfBorders = true;
if( (! m_wndStatusBar.Create( this ) )
|| (! m_wndStatusBar.SetIndicators(
indicators,
sizeof(indicators)/sizeof(UINT)
) )
|| (! m_wndZoomScrollBar.Create(
WS_CHILD|WS_VISIBLE|SBS_HORZ,
CRect(0,0,0,21),
&m_wndStatusBar,
ID_INDICATOR_ZOOM
)
)
|| (! m_wndStatusBar.SetPaneControl(
&m_wndZoomScrollBar,
ID_INDICATOR_ZOOM,
true
)
)
)
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.GetStatusBarCtrl().SetMinHeight( 23 );
INT nZoomPaneIndex = m_wndStatusBar.CommandToIndex( ID_INDICATOR_ZOOM );
m_wndStatusBar.SetPaneWidth( nZoomPaneIndex, 120 );
m_wndZoomScrollBar.SetScrollRange( 0, 100 );
m_wndZoomScrollBar.SetScrollPos( 50 );
m_wndZoomScrollBar.m_bEnabledToolTips = true;
m_wndZoomScrollBar.m_strTipTextForThumbButton = _T("Zoom");
m_wndZoomScrollBar.m_strTipTextForUpButton = _T("Zoom Out");
m_wndZoomScrollBar.m_strTipTextForDownButton = _T("Zoom In");
m_wndZoomScrollBar.m_eSO = CExtScrollBar::__ESO_BOTTOM;
m_wndToolBarUiLook.EnableDocking( CBRS_ALIGN_ANY );
if( ! CExtControlBar::FrameEnableDocking( this ) )
{
ASSERT( FALSE );
return -1;
}
_AdjustRTL();
m_wndRibbonBar.CustomizeStateLoad(
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName
);
if( ! CExtControlBar::ProfileBarStateLoad(
this,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName,
&m_dataFrameWP
)
)
{
DockControlBar( &m_wndToolBarUiLook, AFX_IDW_DOCKBAR_RIGHT );
RecalcLayout();
}
if( m_wndMdiTabs.Create( this ) )
m_wndMdiTabs.OrientationSet( __ETWS_ORIENT_BOTTOM );
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( ! CExtNCW < CMDIFrameWnd > :: PreCreateWindow( cs ) )
return FALSE;
cs.dwExStyle &= ~(WS_EX_CLIENTEDGE|WS_EX_LAYOUT_RTL);
cs.lpszClass =
::AfxRegisterWndClass(
CS_BYTEALIGNCLIENT,
::LoadCursor( NULL, IDC_ARROW ),
NULL,
NULL
);
cs.style |= WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
//cs.dwExStyle |= WS_EX_LAYOUTRTL;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CExtNCW < CMDIFrameWnd > :: AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CExtNCW < CMDIFrameWnd > :: Dump( dc );
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
if( nID == ID_RIBBON_MINIMIZE_RESTORE )
{
if( nCode == CN_UPDATE_COMMAND_UI )
{
((CCmdUI *)pExtra)->Enable();
((CCmdUI *)pExtra)->SetCheck( m_wndRibbonBar.RibbonPage_ExpandedModeGet() );
}
else if( pExtra == NULL )
{
m_wndRibbonBar.RibbonPage_ExpandedModeSet( ! m_wndRibbonBar.RibbonPage_ExpandedModeGet(), true );
}
return TRUE;
}
#if (!defined __EXT_MFC_NO_MDI_WINDOWS_LIST_DIALOG)
if( nCode == CN_COMMAND || nCode == CN_UPDATE_COMMAND_UI )
{
if( nID == ID_WINDOWS_LIST )
{
if( pExtra == NULL && nCode == CN_COMMAND )
{
CMyMdiWindowsListDlg dlg( this );
dlg.DoModal();
}
else if( nCode == CN_UPDATE_COMMAND_UI )
((CCmdUI*)pExtra)->Enable();
return TRUE;
}
}
#endif // (!defined __EXT_MFC_NO_MDI_WINDOWS_LIST_DIALOG)
// // TEST FOR INDETERIMINATE BUTTON STATE IN RIBBONs
// if( nID == ID_EDIT_PASTE
// || nID == ID_EDIT_COPY
// || nID == ID_EDIT_FIND
// || nID == ID_EDIT_REPLACE
// || nID == ID_FONT_BOLD
// || nID == ID_PB_NO_BORDER
// )
// {
// if( nCode == CN_UPDATE_COMMAND_UI )
// {
// ((CCmdUI*)pExtra)->Enable();
// ((CCmdUI*)pExtra)->SetCheck( 2 );
// }
// return TRUE;
// }
if( nID == ID_RTL )
{
if( nCode == CN_UPDATE_COMMAND_UI )
{
((CCmdUI *)pExtra)->Enable( g_PaintManager.m_bIsWinNT );
if( g_PaintManager.m_bIsWinNT )
((CCmdUI *)pExtra)->SetCheck(
( (GetExStyle()&WS_EX_LAYOUT_RTL) != 0 ) ? 1 : 0
);
}
else if( pExtra == NULL && g_PaintManager.m_bIsWinNT )
{
CExtNcFrameImpl::m_bNcFrameImpl_IsEnabled = false;
if( (GetExStyle()&WS_EX_LAYOUT_RTL) != 0 )
ModifyStyleEx( WS_EX_LAYOUT_RTL, 0, SWP_FRAMECHANGED );
else
ModifyStyleEx( 0, WS_EX_LAYOUT_RTL, SWP_FRAMECHANGED );
CExtNcFrameImpl::m_bNcFrameImpl_IsEnabled = true;
_AdjustRTL();
}
return TRUE;
}
// if( nID == ID_EDIT_COPY && nCode == CN_COMMAND )
// { // correct
// if( pExtra == NULL )
// {
// int x = 0;
// x;
// AfxMessageBox("Edit Copy");
// }
// return TRUE; // this should be invoked even if pExtra != NULL
// } // correct
// otherwise, do default handling
// return CExtNCW < CMDIFrameWnd > :: OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
CExtNCW < CMDIFrameWnd > :: OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
return TRUE;
}
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if( m_wndToolBarUiLook.PreTranslateMessage( pMsg ) )
return TRUE;
if( m_wndRibbonBar.TranslateMainFrameMessage(pMsg) )
return TRUE;
return CExtNCW < CMDIFrameWnd > :: PreTranslateMessage(pMsg);
}
BOOL CMainFrame::DestroyWindow()
{
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
m_wndRibbonBar.CustomizeStateSave(
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName
);
VERIFY(
CExtControlBar::ProfileBarStateSave(
this,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName
)
);
VERIFY(
g_PaintManager.PaintManagerStateSave(
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName
)
);
g_CmdManager->ProfileWndRemove( GetSafeHwnd() );
return CExtNCW < CMDIFrameWnd > :: DestroyWindow();
}
void CMainFrame::ActivateFrame(int nCmdShow)
{
bool bDwmMode = NcFrameImpl_IsDwmCaptionReplacement();
// window placement persistence
if( m_dataFrameWP.showCmd != SW_HIDE )
{
if( bDwmMode )
NcFrameImpl_NcLock( true );
SetWindowPlacement( &m_dataFrameWP );
CExtNCW < CMDIFrameWnd > :: ActivateFrame( m_dataFrameWP.showCmd );
m_dataFrameWP.showCmd = SW_HIDE;
if( bDwmMode )
{
NcFrameImpl_NcLock( false );
NcFrameImpl_RecalcNcFrame();
}
return;
}
CExtNCW < CMDIFrameWnd > :: ActivateFrame( nCmdShow );
if( bDwmMode )
NcFrameImpl_RecalcNcFrame();
}
void CMainFrame::_AdjustRTL()
{
ASSERT_VALID( this );
if( (GetExStyle()&WS_EX_LAYOUT_RTL) != 0 )
{
CExtNcFrameImpl::m_dwNcFrameImpl_StyleExInitial |= WS_EX_LAYOUT_RTL;
m_wndRibbonBar.ModifyStyleEx( 0, WS_EX_LAYOUTRTL, 0 );
g_ResourceManager->SetLangLayout( LAYOUT_RTL );
}
else
{
CExtNcFrameImpl::m_dwNcFrameImpl_StyleExInitial &= ~(WS_EX_LAYOUT_RTL);
m_wndRibbonBar.ModifyStyleEx( WS_EX_LAYOUTRTL, 0, 0 );
g_ResourceManager->SetLangLayout( LAYOUT_LTR );
}
m_wndRibbonBar.Ribbon_UpdateLayout( true );
CExtNcFrameImpl::NcFrameImpl_RecalcNcFrame();
CExtNcFrameImpl::NcFrameImpl_SetupRgn();
if( IsWindowVisible() )
RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN );
}
void CMainFrame::_InitRibbonBar()
{
ASSERT_VALID( this );
ASSERT( m_pRibbonNode == NULL );
m_pRibbonNode = new CExtRibbonNode;
CExtRibbonNodeTabPageCollection * pRibbonNodeTabPageCollection =
new CExtRibbonNodeTabPageCollection;
m_pRibbonNode->InsertNode( NULL, pRibbonNodeTabPageCollection );
pRibbonNodeTabPageCollection->InsertNode( NULL, _InitRibbonPage_Test() );
pRibbonNodeTabPageCollection->PageSelectionSet( 0 );
//INT nPageIndex, nPageCount = pRibbonNodeTabPageCollection->GetNodeCount();
// for( nPageIndex = 0; nPageIndex < nPageCount; nPageIndex ++ )
// {
// CExtRibbonNodeTabPage * pRibbonNodeTabPage =
// STATIC_DOWNCAST(
// CExtRibbonNodeTabPage,
// pRibbonNodeTabPageCollection->ElementAt( nPageIndex )
// );
// ASSERT_VALID( pRibbonNodeTabPage );
// pRibbonNodeTabPage->ModifyFlags( __ECTN_TBB_HIDDEN );
// } // for( nPageIndex = 0; nPageIndex < nPageCount; nPageIndex ++ )
CExtRibbonNodeRightButtonsCollection * pRibbonNodeRightButtonsCollection =
_InitRibbon_RightButtonsCollection();
m_pRibbonNode->InsertNode( NULL, pRibbonNodeRightButtonsCollection );
CExtRibbonNodeQuickAccessButtonsCollection * pRibbonNodeQuickAccessButtonsCollection =
_InitRibbon_QuickAccessButtonsCollection();
m_pRibbonNode->InsertNode( NULL, pRibbonNodeQuickAccessButtonsCollection );
CExtRibbonNodeFile * pRibbonNodeFile = _InitRibbon_FileMenu();
m_pRibbonNode->InsertNode( NULL, pRibbonNodeFile );
m_wndRibbonBar.SetButtons( m_pRibbonNode );
VERIFY(
m_wndRibbonBar.
MenuInfoGetDefault()->
AccelTableLoad( IDR_MAINFRAME )
);
VERIFY(
m_wndRibbonBar.Ribbon_FileButtonGet() ->
m_iconForLargeMode.m_bmpNormal.
LoadBMP_Resource( MAKEINTRESOURCE( IDB_BITMAP_SMALL_ICON ) )
);
}
CExtRibbonNodeFile * CMainFrame::_InitRibbon_FileMenu()
{
CExtRibbonNodeFile * pRibbonNodeFile = new CExtRibbonNodeFile;
pRibbonNodeFile->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’F’) ) ), false );
pRibbonNodeFile->m_keyTipOptionsButton.KeyCodeAdd( DWORD(’T’) );
pRibbonNodeFile->m_keyTipExitButton.KeyCodeAdd( DWORD(’X’) );
CExtCustomizeCmdScreenTip * pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->CaptionMainSet( _T("Application Button") );
pCmdScreenTip->TextMainSet( _T("Click here to open, save or print,\nand to see everything else you can\ndo with the document.") );
pCmdScreenTip->BmpMainGet().LoadBMP_Resource( MAKEINTRESOURCE(ID_FILE_DLB_TIP_IMAGE) );
pCmdScreenTip->BmpMainGet().Make32();
pCmdScreenTip->BmpMainGet().AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pRibbonNodeFile->CmdScreenTipAttach( pCmdScreenTip );
CExtRibbonNode * pNodeFileNew =
new CExtRibbonNode(
ID_FB_NEW,
ID_FB_NEW,
NULL,
__ECTN_BIG_ACCENT_IN_MENU,
NULL,
_T("&New...")
);
pNodeFileNew->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’N’) ) ), false );
VERIFY(
pNodeFileNew->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_NEW )
)
);
pNodeFileNew->m_iconBig.m_bmpNormal.Make32();
pNodeFileNew->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("New") );
pNodeFileNew->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeFile->InsertNode( NULL, pNodeFileNew );
CExtRibbonNode * pNodeFileOpen =
new CExtRibbonNode(
ID_FB_OPEN,
ID_FB_OPEN,
NULL,
__ECTN_BIG_ACCENT_IN_MENU,
NULL,
_T("&Open...")
);
pNodeFileOpen->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’O’) ) ), false );
VERIFY(
pNodeFileOpen->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_OPEN )
)
);
pNodeFileOpen->m_iconBig.m_bmpNormal.Make32();
pNodeFileOpen->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Open") );
pNodeFileOpen->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeFile->InsertNode( NULL, pNodeFileOpen );
CExtRibbonNode * pNodeFileSave =
new CExtRibbonNode(
ID_FB_SAVE,
ID_FB_SAVE,
NULL,
__ECTN_BIG_ACCENT_IN_MENU,
NULL,
_T("&Save")
);
pNodeFileSave->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’S’) ) ), false );
VERIFY(
pNodeFileSave->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SAVE )
)
);
pNodeFileSave->m_iconBig.m_bmpNormal.Make32();
pNodeFileSave->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Save") );
pNodeFileSave->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeFile->InsertNode( NULL, pNodeFileSave );
CExtRibbonNode * pNodeFileSaveAs =
new CExtRibbonNode(
ID_FB_SAVE_AS,
ID_FB_SAVE_AS,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_TBB_SEPARATED_DROPDOWN,
NULL,
_T("Save &As...")
);
pNodeFileSaveAs->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’A’) ) ), false );
pNodeFileSaveAs->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’F’) ) ), false, false );
pNodeFileSaveAs->SetTextMenuCaption( _T("Save As Other Format") );
VERIFY(
pNodeFileSaveAs->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SAVE_AS )
)
);
pNodeFileSaveAs->m_iconBig.m_bmpNormal.Make32();
pNodeFileSaveAs->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Save As") );
pNodeFileSaveAs->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeFile->InsertNode( NULL, pNodeFileSaveAs );
CExtRibbonNode * pNodeFileSaveAsFormat1 =
new CExtRibbonNode(
ID_FB_SAVE_AS_FROMAT_ICON,
ID_FB_SAVE_AS_FROMAT_ICON,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Save Document As Format 1")
);
pNodeFileSaveAsFormat1->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’1’) ) ), false );
pNodeFileSaveAsFormat1->SetTextMenuExtended(
_T("Save a copy of that will be fully compatible\nwith Format 1")
);
VERIFY(
pNodeFileSaveAsFormat1->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SAVE_AS_FROMAT_ICON )
)
);
pNodeFileSaveAsFormat1->m_iconBig.m_bmpNormal.Make32();
pNodeFileSaveAsFormat1->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileSaveAs->InsertNode( NULL, pNodeFileSaveAsFormat1 );
CExtRibbonNode * pNodeFileSaveAsFormat2 =
new CExtRibbonNode(
ID_FB_SAVE_AS_FROMAT_ICON,
ID_FB_SAVE_AS_FROMAT_ICON,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Save Document As Format 2")
);
pNodeFileSaveAsFormat2->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’2’) ) ), false );
pNodeFileSaveAsFormat2->SetTextMenuExtended(
_T("Publish a copy of this document\nas Format 2")
);
VERIFY(
pNodeFileSaveAsFormat2->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SAVE_AS_FROMAT_ICON )
)
);
pNodeFileSaveAsFormat2->m_iconBig.m_bmpNormal.Make32();
pNodeFileSaveAsFormat2->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileSaveAs->InsertNode( NULL, pNodeFileSaveAsFormat2 );
CExtRibbonNode * pNodeFileSaveAsFormat3 =
new CExtRibbonNode(
ID_FB_SAVE_AS_FROMAT_ICON,
ID_FB_SAVE_AS_FROMAT_ICON,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Save Document As Format 3")
);
pNodeFileSaveAsFormat3->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’3’) ) ), false );
pNodeFileSaveAsFormat3->SetTextMenuExtended(
_T("Save a copy of that will be fully compatible\nwith Format 3")
);
VERIFY(
pNodeFileSaveAsFormat3->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SAVE_AS_FROMAT_ICON )
)
);
pNodeFileSaveAsFormat3->m_iconBig.m_bmpNormal.Make32();
pNodeFileSaveAsFormat3->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileSaveAs->InsertNode( NULL, pNodeFileSaveAsFormat3 );
CExtRibbonNode * pNodeFileSaveAsFormat4 =
new CExtRibbonNode(
ID_FB_SAVE_AS_FROMAT_ICON,
ID_FB_SAVE_AS_FROMAT_ICON,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Save Document As Format 4")
);
pNodeFileSaveAsFormat4->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’4’) ) ), false );
pNodeFileSaveAsFormat4->SetTextMenuExtended(
_T("Publish a copy of this document\nas Format 4")
);
VERIFY(
pNodeFileSaveAsFormat4->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SAVE_AS_FROMAT_ICON )
)
);
pNodeFileSaveAsFormat4->m_iconBig.m_bmpNormal.Make32();
pNodeFileSaveAsFormat4->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileSaveAs->InsertNode( NULL, pNodeFileSaveAsFormat4 );
CExtRibbonNode * pNodeFileFinish =
new CExtRibbonNode(
ID_FB_FINISH,
ID_FB_FINISH,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_GROUP_START,
NULL,
_T("&Finish")
);
pNodeFileFinish->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’I’) ) ), false );
pNodeFileFinish->SetTextMenuCaption( _T("Before You Share") );
VERIFY(
pNodeFileFinish->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_FINISH )
)
);
pNodeFileFinish->m_iconBig.m_bmpNormal.Make32();
pNodeFileFinish->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pRibbonNodeFile->InsertNode( NULL, pNodeFileFinish );
CExtRibbonNode * pNodeFileFinishInspectDocument =
new CExtRibbonNode(
ID_FB_FINISH_INSPECT_DOCUMENT,
ID_FB_FINISH_INSPECT_DOCUMENT,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("&Inspect Document...")
);
pNodeFileFinishInspectDocument->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’I’) ) ), false );
pNodeFileFinishInspectDocument->SetTextMenuExtended(
_T("Helps check the document for\ninapropriate or private information.")
);
VERIFY(
pNodeFileFinishInspectDocument->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_FINISH_INSPECT_DOCUMENT )
)
);
pNodeFileFinishInspectDocument->m_iconBig.m_bmpNormal.Make32();
pNodeFileFinishInspectDocument->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileFinish->InsertNode( NULL, pNodeFileFinishInspectDocument );
CExtRibbonNode * pNodeFileFinishRestrictPermission =
new CExtRibbonNode(
ID_FB_FINISH_RESTRICT_PERMISSION,
ID_FB_FINISH_RESTRICT_PERMISSION,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Restrict &Permission")
);
pNodeFileFinishRestrictPermission->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’R’) ) ), false );
pNodeFileFinishRestrictPermission->SetTextMenuExtended(
_T("Grant access to specific users by verifying\ntheir login credentials.")
);
VERIFY(
pNodeFileFinishRestrictPermission->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_FINISH_RESTRICT_PERMISSION )
)
);
pNodeFileFinishRestrictPermission->m_iconBig.m_bmpNormal.Make32();
pNodeFileFinishRestrictPermission->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileFinish->InsertNode( NULL, pNodeFileFinishRestrictPermission );
CExtRibbonNode * pNodeFileFinishUnrestrictedAccess =
new CExtRibbonNode(
ID_FB_FINISH_RESTRICT_PERMISSION_UNRESTRICTED_ACCESS,
ID_FB_FINISH_RESTRICT_PERMISSION_UNRESTRICTED_ACCESS,
NULL,
0,
NULL,
_T("&Unrestricted Access")
);
pNodeFileFinishUnrestrictedAccess->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’U’) ) ), false );
pNodeFileFinishRestrictPermission->InsertNode( NULL, pNodeFileFinishUnrestrictedAccess );
CExtRibbonNode * pNodeFileFinishDoNotDistribute =
new CExtRibbonNode(
ID_FB_FINISH_RESTRICT_PERMISSION_DO_NOT_DISTRIBUTE,
ID_FB_FINISH_RESTRICT_PERMISSION_DO_NOT_DISTRIBUTE,
NULL,
0,
NULL,
_T("Do &Not Distribute...")
);
pNodeFileFinishRestrictPermission->InsertNode( NULL, pNodeFileFinishDoNotDistribute );
CExtRibbonNode * pNodeFileFinishRestrictPermissionAs =
new CExtRibbonNode(
ID_FB_FINISH_RESTRICT_PERMISSION_AS,
ID_FB_FINISH_RESTRICT_PERMISSION_AS,
NULL,
__ECTN_GROUP_START,
NULL,
_T("&Restrict Permission As...")
);
pNodeFileFinishRestrictPermissionAs->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’R’) ) ), false );
pNodeFileFinishRestrictPermission->InsertNode( NULL, pNodeFileFinishRestrictPermissionAs );
CExtRibbonNode * pNodeFileFinishAddDigitalSignature =
new CExtRibbonNode(
ID_FB_FINISH_ADD_DIGITAL_SIGNATURE,
ID_FB_FINISH_ADD_DIGITAL_SIGNATURE,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Add a Digital &Signature...")
);
pNodeFileFinishAddDigitalSignature->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’S’) ) ), false );
pNodeFileFinishAddDigitalSignature->SetTextMenuExtended(
_T("Add a signature that is not visible within\nthe content of the document.")
);
VERIFY(
pNodeFileFinishAddDigitalSignature->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_FINISH_ADD_DIGITAL_SIGNATURE )
)
);
pNodeFileFinishAddDigitalSignature->m_iconBig.m_bmpNormal.Make32();
pNodeFileFinishAddDigitalSignature->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileFinish->InsertNode( NULL, pNodeFileFinishAddDigitalSignature );
CExtRibbonNode * pNodeFileFinishCompatibilityChecker =
new CExtRibbonNode(
ID_FB_FINISH_COMPATIBILITY_CHECKER,
ID_FB_FINISH_COMPATIBILITY_CHECKER,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("&Compatibility Checker...")
);
pNodeFileFinishCompatibilityChecker->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’C’) ) ), false );
pNodeFileFinishCompatibilityChecker->SetTextMenuExtended(
_T("Check the document for features\nunsupported by previous version.")
);
VERIFY(
pNodeFileFinishCompatibilityChecker->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_FINISH_COMPATIBILITY_CHECKER )
)
);
pNodeFileFinishCompatibilityChecker->m_iconBig.m_bmpNormal.Make32();
pNodeFileFinishCompatibilityChecker->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileFinish->InsertNode( NULL, pNodeFileFinishCompatibilityChecker );
CExtRibbonNode * pNodeFileFinishMarkAsFinal =
new CExtRibbonNode(
ID_FB_FINISH_MARK_AS_FINAL,
ID_FB_FINISH_MARK_AS_FINAL,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Mark As &Final")
);
pNodeFileFinishMarkAsFinal->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’M’) ) ), false );
pNodeFileFinishMarkAsFinal->SetTextMenuExtended(
_T("Let readers know your document is final\nand make it read only.")
);
VERIFY(
pNodeFileFinishMarkAsFinal->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_FINISH_MARK_AS_FINAL )
)
);
pNodeFileFinishMarkAsFinal->m_iconBig.m_bmpNormal.Make32();
pNodeFileFinishMarkAsFinal->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileFinish->InsertNode( NULL, pNodeFileFinishMarkAsFinal );
CExtRibbonNode * pNodeFileShare =
new CExtRibbonNode(
ID_FB_SHARE,
ID_FB_SHARE,
NULL,
__ECTN_BIG_ACCENT_IN_MENU,
NULL,
_T("S&hare")
);
pNodeFileShare->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’H’) ) ), false );
pNodeFileShare->SetTextMenuCaption( _T("Share Your Document") );
VERIFY(
pNodeFileShare->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SHARE )
)
);
pNodeFileShare->m_iconBig.m_bmpNormal.Make32();
pNodeFileShare->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pRibbonNodeFile->InsertNode( NULL, pNodeFileShare );
CExtRibbonNode * pNodeFileShareEmail =
new CExtRibbonNode(
ID_FB_SHARE_EMAIL,
ID_FB_SHARE_EMAIL,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("&Email...")
);
pNodeFileShareEmail->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’E’) ) ), false );
pNodeFileShareEmail->SetTextMenuExtended(
_T("Email a copy of your document as an\nattachment.")
);
VERIFY(
pNodeFileShareEmail->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SHARE_EMAIL )
)
);
pNodeFileShareEmail->m_iconBig.m_bmpNormal.Make32();
pNodeFileShareEmail->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileShare->InsertNode( NULL, pNodeFileShareEmail );
CExtRibbonNode * pNodeFileShareInternetFax =
new CExtRibbonNode(
ID_FB_SHARE_INET_FAX,
ID_FB_SHARE_INET_FAX,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Internet Fa&x...")
);
pNodeFileShareInternetFax->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’F’) ) ), false );
pNodeFileShareInternetFax->SetTextMenuExtended(
_T("Use an internet fax service to fax your\ndocument.")
);
VERIFY(
pNodeFileShareInternetFax->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SHARE_INET_FAX )
)
);
pNodeFileShareInternetFax->m_iconBig.m_bmpNormal.Make32();
pNodeFileShareInternetFax->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileShare->InsertNode( NULL, pNodeFileShareInternetFax );
CExtRibbonNode * pNodeFileShareDocumentManagementServer =
new CExtRibbonNode(
ID_FB_SHARE_DMS,
ID_FB_SHARE_DMS,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("&Document Management Server...")
);
pNodeFileShareDocumentManagementServer->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’D’) ) ), false );
pNodeFileShareDocumentManagementServer->SetTextMenuExtended(
_T("Share this document by saving it to an\ndocument management server.")
);
VERIFY(
pNodeFileShareDocumentManagementServer->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SHARE_DMS )
)
);
pNodeFileShareDocumentManagementServer->m_iconBig.m_bmpNormal.Make32();
pNodeFileShareDocumentManagementServer->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileShare->InsertNode( NULL, pNodeFileShareDocumentManagementServer );
CExtRibbonNode * pNodeFileShareCreateDocumentWorkspace =
new CExtRibbonNode(
ID_FB_SHARE_CREATE_DOC_WKS,
ID_FB_SHARE_CREATE_DOC_WKS,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("&Create Document Workspace...")
);
pNodeFileShareCreateDocumentWorkspace->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’W’) ) ), false );
pNodeFileShareCreateDocumentWorkspace->SetTextMenuExtended(
_T("Create new site of this document and\nkeep your local copy synchronized.")
);
VERIFY(
pNodeFileShareCreateDocumentWorkspace->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_SHARE_CREATE_DOC_WKS )
)
);
pNodeFileShareCreateDocumentWorkspace->m_iconBig.m_bmpNormal.Make32();
pNodeFileShareCreateDocumentWorkspace->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFileShare->InsertNode( NULL, pNodeFileShareCreateDocumentWorkspace );
CExtRibbonNode * pNodeFilePrint =
new CExtRibbonNode(
ID_FB_PRINT,
ID_FB_PRINT,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_TBB_SEPARATED_DROPDOWN,
NULL,
_T("&Print...")
);
pNodeFilePrint->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’P’) ) ), false );
pNodeFilePrint->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’W’) ) ), false, false );
pNodeFilePrint->SetTextMenuCaption( _T("Printing Your Document") );
VERIFY(
pNodeFilePrint->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_PRINT )
)
);
pNodeFilePrint->m_iconBig.m_bmpNormal.Make32();
pNodeFilePrint->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pRibbonNodeFile->InsertNode( NULL, pNodeFilePrint );
CExtRibbonNode * pNodeFilePrintPrint =
new CExtRibbonNode(
ID_FB_PRINT,
ID_FB_PRINT,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU|__ECTN_BIG_ACCENT_IN_MENU,
NULL,
_T("&Quick Print")
);
pNodeFilePrintPrint->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’Q’) ) ), false );
VERIFY(
pNodeFilePrintPrint->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_PRINT )
)
);
pNodeFilePrintPrint->m_iconBig.m_bmpNormal.Make32();
pNodeFilePrintPrint->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFilePrint->InsertNode( NULL, pNodeFilePrintPrint );
CExtRibbonNode * pNodeFilePringPreview =
new CExtRibbonNode(
ID_FB_PRINT_PREVIEW,
ID_FB_PRINT_PREVIEW,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU|__ECTN_BIG_ACCENT_IN_MENU,
NULL,
_T("Print Pre&view")
);
pNodeFilePringPreview->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’V’) ) ), false );
VERIFY(
pNodeFilePringPreview->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_PRINT_PREVIEW )
)
);
pNodeFilePringPreview->m_iconBig.m_bmpNormal.Make32();
pNodeFilePringPreview->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pNodeFilePrint->InsertNode( NULL, pNodeFilePringPreview );
CExtRibbonNode * pNodeFileClose =
new CExtRibbonNode(
ID_FB_CLOSE,
ID_FB_CLOSE,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_GROUP_START,
NULL,
_T("&Close")
);
pNodeFileClose->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’C’) ) ), false );
VERIFY(
pNodeFileClose->m_iconBig.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_FB_CLOSE )
)
);
pNodeFileClose->m_iconBig.m_bmpNormal.Make32();
pNodeFileClose->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Close") );
pNodeFileClose->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeFile->InsertNode( NULL, pNodeFileClose );
return pRibbonNodeFile;
}
CExtRibbonNodeRightButtonsCollection * CMainFrame::_InitRibbon_RightButtonsCollection()
{
CExtRibbonNodeRightButtonsCollection * pRibbonNodeRightButtonsCollection =
new CExtRibbonNodeRightButtonsCollection;
CExtRibbonNode * pNodeRTL =
new CExtRibbonNode(
ID_RTL,
ID_RTL,
NULL,
0L,
_T("RTL")
);
VERIFY(
pNodeRTL->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( IDB_RTL )
)
);
pNodeRTL->m_iconSmall.m_bmpNormal.Make32( false );
pNodeRTL->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), BYTE(0) );
pRibbonNodeRightButtonsCollection->InsertNode(
NULL,
pNodeRTL
);
CExtRibbonNode * pNodeAppAbout =
new CExtRibbonNode(
ID_APP_ABOUT,
ID_APP_ABOUT,
NULL,
0L,
_T("About")
);
VERIFY(
pNodeAppAbout->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_APP_ABOUT_16x16 )
)
);
pNodeAppAbout->m_iconSmall.m_bmpNormal.PreMultiplyRGBChannels( false );
CExtCustomizeCmdScreenTip * pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("About") );
pNodeAppAbout->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeRightButtonsCollection->InsertNode(
NULL,
pNodeAppAbout
);
CExtRibbonNodeMdiRightButtons * pNodeMDI =
new CExtRibbonNodeMdiRightButtons;
pRibbonNodeRightButtonsCollection->InsertNode(
NULL,
pNodeMDI
);
return pRibbonNodeRightButtonsCollection;
}
CExtRibbonNodeQuickAccessButtonsCollection * CMainFrame::_InitRibbon_QuickAccessButtonsCollection()
{
CExtRibbonNodeQuickAccessButtonsCollection * pRibbonNodeQuickAccessButtonsCollection =
new CExtRibbonNodeQuickAccessButtonsCollection;
CExtRibbonNode * pNodeQA_FileSave =
new CExtRibbonNode(
ID_QA_FILE_SAVE,
ID_QA_FILE_SAVE,
NULL,
0L,
_T("Save")
);
VERIFY(
pNodeQA_FileSave->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_QA_FILE_SAVE )
)
);
pNodeQA_FileSave->m_iconSmall.m_bmpNormal.Make32();
pNodeQA_FileSave->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
CExtCustomizeCmdScreenTip * pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Save") );
pNodeQA_FileSave->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeQuickAccessButtonsCollection->InsertNode(
NULL,
pNodeQA_FileSave
);
CExtRibbonNode * pNodeQA_EditUndo =
new CExtRibbonNode(
ID_QA_EDIT_UNDO,
ID_QA_EDIT_UNDO,
NULL,
0L,
_T("Undo")
);
VERIFY(
pNodeQA_EditUndo->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_QA_EDIT_UNDO )
)
);
pNodeQA_EditUndo->m_iconSmall.m_bmpNormal.Make32();
pNodeQA_EditUndo->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Undo") );
pNodeQA_EditUndo->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeQuickAccessButtonsCollection->InsertNode(
NULL,
pNodeQA_EditUndo
);
CExtRibbonNode * pNodeQA_EditRedo =
new CExtRibbonNode(
ID_QA_EDIT_REDO,
ID_QA_EDIT_REDO,
NULL,
0L,
_T("Redo")
);
VERIFY(
pNodeQA_EditRedo->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_QA_EDIT_REDO )
)
);
pNodeQA_EditRedo->m_iconSmall.m_bmpNormal.Make32();
pNodeQA_EditRedo->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Redo") );
pNodeQA_EditRedo->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeQuickAccessButtonsCollection->InsertNode(
NULL,
pNodeQA_EditRedo
);
CExtRibbonNode * pNodeQA_FilePrint =
new CExtRibbonNode(
ID_QA_FILE_PRINT,
ID_QA_FILE_PRINT,
NULL,
0L,
_T("Print")
);
VERIFY(
pNodeQA_FilePrint->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_QA_FILE_PRINT )
)
);
pNodeQA_FilePrint->m_iconSmall.m_bmpNormal.Make32();
pNodeQA_FilePrint->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Print") );
pNodeQA_FilePrint->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeQuickAccessButtonsCollection->InsertNode(
NULL,
pNodeQA_FilePrint
);
CExtRibbonNode * pNodeQA_AddDigitalSignature =
new CExtRibbonNode(
ID_QA_ADD_DIGITAL_SIGNATURE,
ID_QA_ADD_DIGITAL_SIGNATURE,
NULL,
0L,
_T("Add a Digital Signature")
);
VERIFY(
pNodeQA_AddDigitalSignature->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_QA_ADD_DIGITAL_SIGNATURE )
)
);
pNodeQA_AddDigitalSignature->m_iconSmall.m_bmpNormal.Make32();
pNodeQA_AddDigitalSignature->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Add digital signature") );
pNodeQA_AddDigitalSignature->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeQuickAccessButtonsCollection->InsertNode(
NULL,
pNodeQA_AddDigitalSignature
);
return pRibbonNodeQuickAccessButtonsCollection;
}
CExtRibbonNode * CMainFrame::_InitRibbonPage_Test()
{
CExtRibbonNodeTabPage * pRibbonNodeTabPage = new CExtRibbonNodeTabPage( 0L, NULL, _T("Test") );
pRibbonNodeTabPage->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’T’) ) ), false );
pRibbonNodeTabPage->InsertNode( NULL, _InitRibbonNode_Test_Test() );
return pRibbonNodeTabPage;
}
static bool
SetRibbonBMP(CExtBitmap &bmp, UINT id)
{
if (!bmp.LoadBMP_Resource(MAKEINTRESOURCE(id)))
{
TRACE("SetRibbonBMP: Can’t find bitmap resource id %d\n", id);
return false;
}
bmp.Make32();
bmp.AlphaColor(RGB(255,0,255), RGB(0,0,0), 0);
return true;
}
static void
SetRibbonTips(CExtCustomizeCmdTreeNode *node, const TCHAR *keyTip,
CExtBitmap &bmp,
const TCHAR *tipTitle = NULL,
const TCHAR *tipText = NULL,
UINT bmpId2 = 0,
const TCHAR *tipText2 = NULL,
bool isDropDown = false)
{
if (keyTip != NULL)
node->CmdKeyTipSet(new CExtCustomizeCmdKeyTip(
__EXT_MFC_SAFE_TCHAR(keyTip)), false, !isDropDown);
if (tipTitle == NULL && tipText == NULL)
return;
CExtCustomizeCmdScreenTip *tip = new CExtCustomizeCmdScreenTip;
tip->BmpMainGet() = bmp;
if (tipTitle != NULL)
tip->CaptionMainSet(tipTitle);
if (tipText != NULL)
{
tip->TextMainSet(tipText);
if (tipText2 != NULL)
{
tip->CaptionSecondarySet(tipText2);
if (bmpId2 != 0)
{
tip->BmpSecondaryGet().LoadBMP_Resource(
MAKEINTRESOURCE(bmpId2));
tip->BmpSecondaryGet().PreMultiplyRGBChannels(false);
}
}
}
node->CmdScreenTipAttach(tip, !isDropDown);
}
static void
SetRibbonTips(CExtCustomizeCmdTreeNode *node, const TCHAR *keyTip,
UINT bmpId = 0,
const TCHAR *tipTitle = NULL,
const TCHAR *tipText = NULL,
UINT bmpId2 = 0,
const TCHAR *tipText2 = NULL,
bool isDropDown = false)
{
if (keyTip != NULL)
node->CmdKeyTipSet(new CExtCustomizeCmdKeyTip(
__EXT_MFC_SAFE_TCHAR(keyTip)), false, !isDropDown);
if (tipTitle == NULL && tipText == NULL)
return;
CExtCustomizeCmdScreenTip *tip = new CExtCustomizeCmdScreenTip;
if (bmpId != 0)
SetRibbonBMP(tip->BmpMainGet(), bmpId);
if (tipTitle != NULL)
tip->CaptionMainSet(tipTitle);
if (tipText != NULL)
{
tip->TextMainSet(tipText);
if (tipText2 != NULL)
{
tip->CaptionSecondarySet(tipText2);
if (bmpId2 != 0)
{
tip->BmpSecondaryGet().LoadBMP_Resource(
MAKEINTRESOURCE(bmpId2));
tip->BmpSecondaryGet().PreMultiplyRGBChannels(false);
}
}
}
node->CmdScreenTipAttach(tip, !isDropDown);
}
void
AddRibbonDropDownItem(CExtRibbonNode *parent, const TCHAR *label,
const TCHAR *keyTip, UINT id, UINT bmpId = 0)
{
CExtCmdIcon icon, *iconP = NULL;
#ifdef TRY_RIBBON_NODES_IN_MENU
// Attempting to use a CExtRibbonNode instead creates the items in the menu
// properly, but somehow removes both the icon and text from the parent
// button!
CExtRibbonNode *node =
new CExtRibbonNode(id, id, NULL, 0, label, label);
SetRibbonBMP(node->m_iconBig.m_bmpNormal, bmpId);
SetRibbonBMP(node->m_iconSmall.m_bmpNormal, id);
#else
if (bmpId != 0 && SetRibbonBMP(icon.m_bmpNormal, bmpId))
iconP = &icon;
CExtCustomizeCmdTreeNode *node =
new CExtCustomizeCmdTreeNode(id, id, NULL, 0, label, label, NULL, 0,
iconP);
#endif // TRY_RIBBON_NODES_IN_MENU
SetRibbonTips(node, keyTip, bmpId, label, _T("More text could go here"));
parent->InsertNode(NULL, node);
}
CExtRibbonNode * CMainFrame::_InitRibbonNode_Test_Test()
{
CExtRibbonNodeGroup * group =
new CExtRibbonNodeGroup( ID_RIBBON_PAGE_TEST );
SetRibbonTips(group, _T(""), ID_COVER_PAGE_LARGE, _T("Blah"), _T("Blah blah"));
SetRibbonBMP(group->m_iconBig.m_bmpNormal, ID_COVER_PAGE_LARGE);
SetRibbonBMP(group->m_iconSmall.m_bmpNormal, ID_COVER_PAGE_SMALL);
CExtCustomizeCmdScreenTip * pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Test") );
group->CmdScreenTipAttach( pCmdScreenTip );
group->SetTextInToolbar( _T("Test") );
#ifdef USE_SAME_IDS_FOR_CMD_AND_BMP
UINT cmdId = ID_COVER_PAGE_LARGE;
UINT cmdId2 = ID_BLANK_PAGE_LARGE;
UINT cmdId3 = ID_PAGE_BREAK_LARGE;
#else
UINT cmdId = ID_COVER_PAGE_SMALL;
UINT cmdId2 = ID_BLANK_PAGE_SMALL;
UINT cmdId3 = ID_PAGE_BREAK_SMALL;
#endif // USE_SAME_IDS_FOR_CMD_AND_BMP
#ifdef SHOW_ICONS_IN_MENU
UINT bmpId = ID_COVER_PAGE_LARGE;
UINT bmpId2 = ID_BLANK_PAGE_LARGE;
UINT bmpId3 = ID_PAGE_BREAK_LARGE;
#else
UINT bmpId = 0;
UINT bmpId2 = 0;
UINT bmpId3 = 0;
#endif // SHOW_ICONS_IN_MENU
CExtRibbonNode * node =
new CExtRibbonNode( cmdId, cmdId, NULL, 0, _T("Test") );
//node->RibbonILE_RuleArrayGet().RemoveAll();
SetRibbonBMP(node->m_iconBig.m_bmpNormal, ID_COVER_PAGE_LARGE);
SetRibbonBMP(node->m_iconSmall.m_bmpNormal, ID_COVER_PAGE_SMALL);
SetRibbonTips(node, _T(""), ID_COVER_PAGE_LARGE, _T("Test"), _T("Blah blah"));
SetRibbonTips(node, _T(""), ID_COVER_PAGE_LARGE, _T("Drop"), _T("Drop down"), 0, NULL, true);
group->InsertNode(NULL, node);
#ifdef USE_DROP_DOWN
#ifdef USE_AUTO_CHANGE
node->ModifyFlags(__ECTN_TBB_SEPARATED_DROPDOWN | __ECTN_TBB_AUTOCHANGE_ID);
#else
node->ModifyFlags(__ECTN_TBB_SEPARATED_DROPDOWN);
#endif // USE_AUTO_CHANGE
AddRibbonDropDownItem(node, _T("Item 1"), _T(""), cmdId, bmpId);
AddRibbonDropDownItem(node, _T("Item 2"), _T(""), cmdId2, bmpId2);
AddRibbonDropDownItem(node, _T("Item 3"), _T(""), cmdId3, bmpId3);
#endif // NO_DROP_DOWN
return group;
}
|
|
Robert Webb
|
Sep 16, 2008 - 6:42 PM
|
> The ribbon bar buttons should contain text which are not changed via menu
> actions. Changing the button’s text can change entire ribbon’s layout of
> buttons and even make some ribbon groups collapsed. This means the split
> buttons with auto-changed command identifier should be without text.
Yes it should cause a rearrangement. However I don’t see why that’s a problem. Ribbon bars are specifically designed to do this sort of rearrangement, so what’s the problem? If the text changes, the ribbon bar should rearrange. I don’t mind that. But I do need the text to match the menu item chosen.
Any tips on how I can make this happen with the current Prof-UIS release? There seem to be a few issues:
(1) How do I catch the menu selection event?
(2) Once caught I can call SetTextInToolbar(). Will that cause the ribbon bar to rearrange if called on-the-fly? Or do I need to force a rearrangement somehow?
(3) The next problem though is that even when text is set Prof-UIS won’t display it on an auto-change drop-down item. How would I force that to happen? Can you point me to the place in the Prof-UIS library code where the text is drawn?
(4) Finally, if the menu is made from CExtRibbonNodes rather than CExtCustomizeCmdTreeNodes, even the icon won’t appear in the ribbon bar. Just a blank button with no icon and no text. Why is this? How do I get around it? I want to do it this way so that the items have large and small icons which can both be inherited by the parent drop-down button, and used as appropriate. Again, I need to override the auto-behaviour myself I think to do this (and inherit tooltips as well).
> The inheritable ribbon tip feature is not implemented yet. Thank you for
> reporting us this issue. We added this to our to-do list.
Thanks. We have a deadline soon though. I’m happy to impliment this myself for now, but need to know how to override a few things as per above.
Thanks,
Rob.
|
|
Technical Support
|
Sep 17, 2008 - 5:58 AM
|
Here are the answers to your questions,
1) You should handle a CExtPopupBaseWnd::g_nMsgTranslateMouseClickEvent registered message in your main frame window so that you can catch mouse click events during menu item tacking. The WPARAM parameter is a pointer to the CExtPopupBaseWnd::TranslateMouseClickEventData_t data structure. If your method handles the mouse click event, it should set the CExtPopupBaseWnd::TranslateMouseClickEventData_t::m_bMessageHandled property to true and CExtPopupBaseWnd::TranslateMouseClickEventData_t::m_bNoEat property to false . Of course, you will need to hit-test the menu item using the CExtPopupMenuWnd::_HitTest() method and detect whether it’s disabled using the CExtPopupMenuWnd::ItemEnabledGet() method.
2) You should update the ribbon bar’s layout using the CExtRibbonPage::Ribbon_UpdateLayout() method.
3) This is not supported yet. We need to do some tricky changes in ribbon’s code to make this possible.
4) Currently the ribbon nodes should be used for in-ribbon elements only and command tree nodes should be used for popup menu items. The large/small icon inheritance is also require improvements in Prof-UIS code.
We took a closer look at the Microsoft Office 2007 applications again. It looks like split buttons never change the main part of button there. We suppose such auto-change-able buttons are replaced with galleries.
|
|
Robert Webb
|
Sep 18, 2008 - 3:29 AM
|
Thanks for the answers, I’ll try them out.
3) This is not supported yet. We need to do some tricky changes in ribbon’s code to make this possible.
Surely it’s not far from working. Did you try the different cases in my test program? Change the TEST_NUMBER #define to other numbers, as described at the top. In particular, look at case 2. This shows that the text can indeed auto-change and is displayed, but only when no icons are used.
I tried different length labels in the drop-down, and the ribbon bar doesn’t rearrange accordingly, but I should be able to catch the event and force the update.
Does Prof-UIS core code explicitly prevent the label from appearing? Or is it a side effect of something else? If you could point me at the part in the code where the label is drawn I may be able try changing it.
4) Currently the ribbon nodes should be used for in-ribbon elements only and command tree nodes should
be used for popup menu items. They seem to work fine on the menu itself. The only side effect is that the parent button won’t show an icon or text at all (whether or not it’s an auto-change drop-down). How is it that the icon/text isn’t drawn? Again, is this something explicitly done by Prof-UIS, or some sort of side effect? We took a closer look at the Microsoft Office 2007 applications again. It looks like split
buttons never change the main part of button there. We suppose such auto-change-able buttons
are replaced with galleries. Is there a way I could use a gallery instead? Can I make a gallery appear like a simple menu, preferably with large icons? Thanks, Rob.
|
|
Robert Webb
|
Sep 23, 2008 - 3:18 AM
|
I’ve managed to get all this mostly working, but much trickiness was required to get it right. Here’s what I did:
- Used a new unique ID for drop-down button. Anytime the button shares an ID with one of the menu items things break.
- Handled CExtPopupBaseWnd::g_nMsgTranslateMouseClickEvent as you suggested. However I didn’t set m_bMessageHandled to true nor m_bNoEat to false, as this stopped the popup from closing, and all seems to work if I just leave those values as is. I also didn’t call ItemEnabledGet(), as this caused a failed assertion.
- I cast wParam to CExtPopupBaseWnd::TranslateMouseClickEventData_t. This class has a m_nFlags member. Took me a while to figure out what symbolic constants this used, but I eventually figured out it’s not flags at all, but rather a Windows message such as WM_LBUTTONUP. Why call it m_nFlags?
- I used _HitTest() as you suggested (why the "_" if it’s a public method?) to find the item clicked, which gave me access to the menu item node, and in turn its parent ribbon bar node, which is the drop-down button initially clicked.
- I copied the labels and tips from the menu item to the parent. I also copied the large icon (I’m using large icons in the drop-down menu). For the small icon I have a lookup table so I know which resource to use based on the large icon ID.
- Copied the effective command from the menu item to the basic command of the parent, leaving the parent’s effective ID unchanged. See explanation below for details.
- Called Ribbon_UpdateLayout() as you suggested to update the ribbon bar in case of label text changing size. This wasn’t enough though and I also needed to call InvalidateRect(NULL) and UpdateWindow().
Also needed a method to handle the drop-down button’s new event. The problem here however is that I need to know which menu item was last selected. The only way I could get it all to work was for the menu-item handler to change the basic ID to the desired command without changing the effective ID. Prof-UIS doesn’t give you a direct way to do this. SetCmdID(...true) changes the effective ID only, while SetCmdID(...false) changes both. So I needed to call it twice: once to set both, and again to set just the effective ID back again. Then I can use SearchNodeElement() in the drop-down button handler to find the relevant button via the constant effective ID, then get the basic ID from that node, which represents the command ID that should actually be performed.
Weird: Changing the basic and effective IDs for a ribbon button doesn’t effect which handler is used for it, as defined by ON_COMMAND(), even though the ID no longer matches. What’s happening here?
Remaining problems:
- If the drop-down is put on the quick-access bar, things don’t keep in sync. We took a closer look at the Microsoft Office 2007 applications again. It looks like split buttons never
change the main part of button there.
Maybe, but no reason it shouldn’t be allowed. It is a little odd when the change in text size causes the buttons to rearrange and switch between large and small, but it makes sense. Alternative would be to always allow enough space for the longest menu label.
|
|
Technical Support
|
Sep 24, 2008 - 5:07 AM
|
We are sorry for the delay with this reply. All the Prof-UIS notifications related to re-translated mouse events provide mouse event flags in appropriated data structures "as is". But we suspect some mouse flags can be really absent because mouse event is re-translated from thread hook procedure - not from window procedure. The methods starting from "_" character are internal Prof-UIS methods. They are not documented and we are advising to use them very rarely and only in case of advanced coding tasks like you requested us. The "_" character allows us to see all the internal class methods in the Class View separated from the other methods. We also using inversion based method naming (ItemTextGet and ItemTextSet instead of GetItemText and GetItemText ) what places similar methods near each other in the class method list displayed in Class View. You also worte:
Weird: Changing the basic and effective IDs for a ribbon button doesn’t effect which handler is used for it, as defined by ON_COMMAND(), even though the ID no longer matches. What’s happening here?
We don’t understand the problem. Of course, if you have changed button’s identifier, then it sends command messages with the new identifier.
The buttons inside the quick access toolbar are working exactly same as other buttons. The quick access toolbar is not a standalone control and even not window. This is several ribbon buttons placed near each other on the surface of the ribbon bar control. Besides the ribbon bar is based on the CExtCustomizeSite class which manages command tree nodes and appropriated toolbar buttons and menu items in customizable toolbars/menus and ribbon controls. The customize site does automatic synchronization of several types of toolbar/menu/ribbon items. For instance text values in text fields and combo fields are synchronized. The effective command identifiers of split buttons are not synchronized between several copies of the same button. Is that what want to do?
|
|
Robert Webb
|
Sep 25, 2008 - 4:20 AM
|
Weird: Changing the basic and effective IDs for a ribbon button doesn’t effect which handler is used for it, as defined by ON_COMMAND(), even though the ID no longer matches. What’s happening here?
We don’t understand the problem. Of course, if you have changed button’s identifier, then it sends command messages with the new identifier. No, that’s what I’m saying didn’t happen. I could change the effective and basic IDs, but the ON_COMMAND() for the original ID was still called, not for the new ID. Anyway, it’s not important for me as it isn’t causing a problem, I just thought it was odd. The buttons inside the quick access toolbar are working exactly same as other buttons. The quick access toolbar is not a standalone control and even not window. This is several ribbon buttons placed near each other on the surface of the ribbon bar control. Besides the ribbon bar is based on the CExtCustomizeSite class which manages command tree nodes and appropriated toolbar buttons and menu items in customizable toolbars/menus and ribbon controls. The customize site does automatic synchronization of several types of toolbar/menu/ribbon items. For instance text values in text fields and combo fields are synchronized. The effective command identifiers of split buttons are not synchronized between several copies of the same button. Is that what want to do? When a drop-down menu item is selected, I find the parent button (the drop-down button) and alter its large and small icons, its label, its tip, and its basic ID (but not effective). If the button appears on the quick-access, then only the drop-down used is updated, not the other copy. That is, if I selected from the QA drop-down, then only that button is altered. If I select from the original drop-down, then only that button is altered. The other button retains the old icons, text and tips (but does use the new ID). I guess I need to find all copies of buttons with the same effective ID somehow and update all of them. Rob.
|
|
Technical Support
|
Sep 26, 2008 - 12:25 PM
|
Yes, the quick access toolbar area is a collection of cloned copies of both nodes and toolbar button objects. To find all the button instances you should use the ribbon bar as toolbar. The CExtToolControlBar::GetButtonsCount() and CExtToolControlBar::GetButtons() methods allow you to enumerate all the buttons linearly without ribbon hierarchy and get pointer to each CExtBarButton() object for further changes.
|
|
Robert Webb
|
Oct 29, 2008 - 12:52 AM
|
I tried your idea of using CExtToolControlBar::GetButtonsCount() and CExtToolControlBar::GetButton() . However, it only iterates over buttons that are currently visible, ie only ones on the current ribbon page. If I use a quick access drop-down from another page, my update code won’t find the matching drop-down on the ribbon bar. Do I need to do something recursive to iterate over all ribbon nodes? SearchNodeElement() looks promising, but will only find one match. Thanks,
Rob.
|
|
Technical Support
|
Oct 29, 2008 - 2:02 PM
|
The command tree contains nodes which describe the entire ribbon bar structure. The ribbon bar contains toolbar button objects only for displayed nodes: tab buttons, quick access toolbar buttons, file button, buttons at right side of tabs and all the buttons on the selected tab page. If user selects other tab page, then current set of buttons become destroyed and new buttons for selected tab page are created. So, you code is unable to access toolbar buttons which are not displayed in the ribbon bar. We do not see any problems with this design. If some button is not found, then there is nothing to change.
|
|
Robert Webb
|
Oct 29, 2008 - 5:41 PM
|
There’s nothing wrong with the design, but for my purposes I need to iterate over all ribbon controls, even on pages not currently visible. That way I can change their icons appropriately so that when they do become visible they are showing the right icon. I have got this working though by recursing from the ribbon root node down through all child nodes, looking for matching IDs. Thanks, Rob.
|
|
Technical Support
|
Sep 16, 2008 - 9:44 AM
|
The ribbon bar buttons should contain text which are not changed via menu actions. Changing the button’s text can change entire ribbon’s layout of buttons and even make some ribbon groups collapsed. This means the split buttons with auto-changed command identifier should be without text.
The inheritable ribbon tip feature is not implemented yet. Thank you for reporting us this issue. We added this to our to-do list.
|
|
tera tera
|
Sep 10, 2008 - 10:37 PM
|
Hello. I want to let a grid domain follow it.
Can CExtGrid automatically change cell width?
|
|
Technical Support
|
Sep 12, 2008 - 12:37 PM
|
We have already answered today and explained you the necessary details about proportional resizing feature for grid columns. Besides, the report grid turns on this feature by default. Of course, you can use it in the tree grid and plain grid like we explained.
|
|
tera tera
|
Sep 21, 2008 - 11:49 PM
|
Hello. Not CExtGridWnd, should I use CExtReportGridWnd?
|
|
tera tera
|
Sep 22, 2008 - 1:47 AM
|
It was able to come true.
Thank you very much for your advice.
|
|
tera tera
|
Sep 10, 2008 - 8:12 PM
|
Hello. In comparison with the past, Version renewal to improve of Prof-UIS became slow.
Please teach a reason.
|
|
Technical Support
|
Sep 12, 2008 - 12:37 PM
|
In comparison with the past, we have different number of support questions each day, including Sundays and Saturdays.
|
|
tera tera
|
Sep 21, 2008 - 11:36 PM
|
Hello. When is Prof-UIS of next Version shown?
|
|
Technical Support
|
Sep 22, 2008 - 12:08 PM
|
The release of Prof-UIS 2.84 is delayed due to testing and documentation updating. We can provide you with the latest stable Prof-UIS 2.84 source code download.
|
|
tera tera
|
Sep 10, 2008 - 8:10 PM
|
Hello. Is not the resize of the column possible when I do not make a header outer cell?
|
|
tera tera
|
Sep 22, 2008 - 1:50 AM
|
Thank you very much for your advice. By the way , I want to make an outer column non-display.
Is it impossible?
|
|
Technical Support
|
Sep 22, 2008 - 12:09 PM
|
The CExtGridBaseWnd::OuterColumnWidthSet() method allows you you to make an outer header column on the left or right having a zero width. This is the same as hiding an outer header column. You should also invoke the OnSwRecalcLayout()() grid’s method when yo have changed the size of inner grid parts.
|
|
Technical Support
|
Sep 12, 2008 - 12:36 PM
|
You should turn on the proportional resizing feature for columns. First of all, you should use the __ESIS_STH_NONE scrolling type style when calling CExtGridWnd::SiwModifyStyle() . This disables horizontal scrolling at all. The proportionally resizable columns do not require horizontal scrolling and the horizontal scroll bar is useless at all. Second, you should apply the __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS style using the CExtGridWnd::BseModifyStyleEx() method. This style will turn on the feature you need. Third and optionally, you can set the proportional column weights using the CExtGridCell::ExtentPercentSet() method invoked for the header cells.
|
|
Pawel Kalinowski
|
Sep 10, 2008 - 3:51 AM
|
Dear Sirs,
Because Prof-UIS do not provide skinned MessageBox, we created a CExtResizableDialog-derived class implementing a message box dialog.
Here is the code:
int CGemiusExplorerApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{
CExtNCW<CExtResizableDialog> dlg;
dlg.SetAutoSubclassChildControls(true);
AfxHookWindowCreate( &dlg );
return CWinApp::DoMessageBox(lpszPrompt, nType, nIDPrompt);
}
Whis works almost fine but in Windows Vista buttons are invisible. Do you know how to solve this problem?
|
|
Pawel Kalinowski
|
Sep 18, 2008 - 6:04 AM
|
Can we expect you add your own skinned vista compatible message boxes in the next library release?
|
|
Technical Support
|
Sep 18, 2008 - 12:10 PM
|
|
|
Technical Support
|
Sep 17, 2008 - 10:56 AM
|
We are sorry for the delay with this reply. We performed several tests under Windows Vista and it looks like it handles message boxes in some special way. First of all, we performed delayed subclassing: int CApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{
class CMyMsgBox : public CExtNCW < CExtResizableDialog >
{
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = CExtNCW < CExtResizableDialog > :: WindowProc( message, wParam, lParam );
switch( message )
{
case WM_INITDIALOG:
PostMessage( (WM_USER+666) );
break;
case (WM_USER+666):
ModifyStyle( 0, WS_CLIPCHILDREN|WS_CLIPSIBLINGS, SWP_FRAMECHANGED );
if( NcFrameImpl_IsSupported() )
NcFrameImpl_SetupRgn();
::SubclassChildControls( this );
break;
}
return lResult;
}
};
CMyMsgBox dlg;
AfxHookWindowCreate( &dlg );
return CWinApp::DoMessageBox( lpszPrompt, nType, nIDPrompt );
} But the result was also the same. We also tried to save location of visible buttons and then re-create the same buttons on the saved locations, but the result still was the same. Windows Vista does magic things with buttons created inside the message box window. Finally, we tried to re-create the buttons inside container windows created as children of the message box window: int CApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{
class CMyMsgBox : public CExtNCW < CExtResizableDialog >
{
class CDynamicButton : public CExtButton
{
protected:
virtual void PostNcDestroy()
{
delete this;
}
};
class CDynamicContainerWnd : public CWnd
{
protected:
virtual void PostNcDestroy()
{
delete this;
}
};
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = CExtNCW < CExtResizableDialog > :: WindowProc( message, wParam, lParam );
switch( message )
{
case WM_INITDIALOG:
PostMessage( (WM_USER+666) );
break;
case (WM_USER+666):
{
ModifyStyle( 0, WS_CLIPCHILDREN|WS_CLIPSIBLINGS, SWP_FRAMECHANGED );
if( NcFrameImpl_IsSupported() )
NcFrameImpl_SetupRgn();
static const TCHAR szButton[] = _T("BUTTON");
CList < HWND, HWND > _listFoundButtons;
CList < CRect, CRect > _listFoundRects;
CList < __EXT_MFC_LONG_PTR, __EXT_MFC_LONG_PTR > _listFoundStyles;
HWND hWnd = ::GetWindow( m_hWnd, GW_CHILD );
for( ; hWnd != NULL; hWnd = ::GetWindow( hWnd, GW_HWNDNEXT ) )
{
TCHAR szCompare[512] = _T("");
::GetClassName(
hWnd,
szCompare,
sizeof( szCompare )/sizeof( szCompare[0] )
);
if( _tcsicmp( szCompare, szButton ) == 0 )
{
__EXT_MFC_LONG_PTR dwWndStyle = ::__EXT_MFC_GetWindowLong( hWnd, GWL_STYLE );
if( ( dwWndStyle & WS_VISIBLE ) != 0 )
{
_listFoundButtons.AddTail( hWnd );
_listFoundStyles.AddTail( dwWndStyle );
CRect rc;
::GetWindowRect( hWnd, &rc );
ScreenToClient( &rc );
_listFoundRects.AddTail( rc );
}
}
}
::SubclassChildControls( this );
POSITION pos = _listFoundButtons.GetHeadPosition();
POSITION pos2 = _listFoundRects.GetHeadPosition();
POSITION pos3 = _listFoundStyles.GetHeadPosition();
for( ; pos != NULL ; )
{
hWnd = _listFoundButtons.GetNext( pos );
ASSERT( pos2 != NULL );
CRect rc = _listFoundRects.GetNext( pos2 );
ASSERT( pos3 != NULL );
__EXT_MFC_LONG_PTR dwWndStyle = _listFoundStyles.GetNext( pos3 );
CWnd * pWnd = CWnd::FromHandle( hWnd );
bool bFocus = ( GetFocus() == pWnd ) ? true : false;
CString s;
pWnd->GetWindowText( s );
::ShowWindow( hWnd, SW_HIDE );
int nID = pWnd->GetDlgCtrlID();
CDynamicContainerWnd * pWDC = new CDynamicContainerWnd;
VERIFY(
pWDC->Create(
::AfxRegisterWndClass( CS_HREDRAW|CS_HREDRAW|CS_DBLCLKS),
LPCTSTR(s),
WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP,
rc,
this,
nID
)
);
pWDC->SetWindowPos( pWnd, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
CButton * pButton = new CDynamicButton;
VERIFY(
pButton->Create(
LPCTSTR(s),
dwWndStyle,
CRect(0,0,rc.Width(),rc.Height()), // rc,
pWDC, //this,
nID
)
);
if( bFocus )
pWDC->SetFocus();
}
}
break;
}
return lResult;
}
};
CMyMsgBox dlg;
AfxHookWindowCreate( &dlg );
return CWinApp::DoMessageBox( lpszPrompt, nType, nIDPrompt );
} The same result again. There is a black hole in Vista’s message boxes. Button controls disappear even if they are created as deep children of the message box window. We decided to give up at this point. Even if we found some way to keep buttons visible and working, there would not be guarantee that a new magic will appear in the next Windows versions. It’s easier to re-code our own message box from scratch or use the standard ones.
|
|