COXCoolComboBox
Copyright © The Code Project 1997 1998, All Rights Reserved

COXCoolComboBox class implements standard combo box as cool control. Refer to description of COXCoolCtrl class for details on cool controls. Briefly, we call any control (generally speaking, any window) as cool one if it supports normal or hot state. By definition, window is in hot state when mouse cursor is over it or it has focus. Otherwise window is in normal state.

COXCoolComboBox is derived from COXCoolCtrl. COXCoolComboBox doesn't have it's own public functions and it relies heavily on COXCoolCtrl class. 

Refer to COXCoolCtrl function reference for details.

Basically, COXCoolComboBox provides drawing routines for normal and hot state.Use COXCoolComboBox class the same way you would use standard CComboBox.

Note that COXCoolCtrl automatically support tooltip for control. You can set/retrieve tooltip text using the following functions:

    BOOL SetTooltipText(const CString& sTooltipText);
    BOOL GetTooltipText(CString& sTooltipText) const;

Dependencies:

   #include "OXCoolComboBox.h"

Source code files:

    "OXCoolComboBox.cpp"

COXCoolCtrl
Copyright © The Code Project 1997 1998, All Rights Reserved

Almost every application uses some of common controls in its implementation. Users used to see these common controls and khow how to use them. 

This the primary reason why you usually don't want to change the look and functionality of existing controls too much. But sometimes even by slightly changing the appearance of a control you can achive good results in terms of enhancing the feel and look of your application's user interface. 

We suggest the following new feature for common controls: every control (generally speaking, any window) can be in normal or hot state. By definition, window is in hot state when mouse cursor is over it or it has focus. Otherwise window is in normal state. Naturally, in order to distinguish window in different states some graphical effects should be applied. E.g. the drawing of window borders in different states might be different.

We call controls that support normal and hot state - cool controls.

We designed template class COXCoolCtrl that simplifies process of converting of common controls to cool ones.

COXCoolCtrl template has one argument that specifies the parent class of the new cool control. E.g. if you would like to design your own cool listbox class you can declare it as following:

    class CCoolListBox : public COXCoolCtrl<CListBox>

While implementing cool control using COXCoolCtrl derivation you might would like to override the following protected virtual functions:

    virtual void OnChangeHotState(BOOL bInHotState);
    virtual void OnFocusChange(CWnd* pWndGainFocus, CWnd* pWndLooseFocus);
    virtual void OnMouseEnter(const CPoint ptCursor);
    virtual void OnMouseLeave(const CPoint ptCursor);
    virtual BOOL HandleKey(const int nVirtKey);
    virtual BOOL OnChangeTooltipText(const CString& sTooltipText);

Refer to the class reference for detailed function explanations. 

Almost always you would like to override OnChangeHotState() function which is called when window is about to change its state from hot to normal and vise versa. In your implementation of this function you might redraw the window in order to show that window has changed its state.

OnFocusChange() is called every time window looses or gains focus and OnMouseEnter() and OnMouseLeave() functions are called every time mouse enters or leaves the screen space taken by the window correspondingly.

HandleKey() function will be called every time when user presses any key down. Overriding this function you can handle pressed key before control has a chance to do that. By returning TRUE you will notify control that you handled the event yourself and don't want to run default handler implementation.

One of the additional useful feature that COXCoolCtrl supports is tooltip for the control. You can set/retrieve tooltip text using the following functions:

    BOOL SetTooltipText(const CString& sTooltipText);
    BOOL GetTooltipText(CString& sTooltipText) const;

Every time you change the tooltip text OnChangeTooltipText() function will be called. By overriding this function you can control the process of setting of tooltip text. By returning FALSE you specify that you don't allow to change the tooltip text.

There are a few additional public functions that you might find useful:

    BOOL IsInHotState() const;
    BOOL IsMouseOver() const;

IsInHotState() function retrieves the flag that specifies whether the window is in hot or normal state. IsMouseOver() function retrieves the flag that specifies whether the current mouse position is over the window or not.

Although it's not a must requirement but it would be nice if control was able to support standard and new cool state. By default when control is created of subclassed the existing one it is set to cool state. But calling the following function you can set it back to statndard state:

virtual void SetCoolState(const BOOL bCoolState);

You can retrieve the flag that specifies whether the control is in cool or normal state

virtual BOOL IsInCoolState() const;

As you can see both of these functions are declared as virtual so if you don't want to support standard appearance of the control you might override this function (SetCoolState() would do nothing and IsInCoolState() would always return TRUE).

Again we would like to emphasize that COXCoolCtrl class is designed specifically in order to help you to create coll common controls. We are going to come up with classes that implements some common controls as cool ones (take look at the COXCoolComboBox class which implements cool combobox).

Dependencies:

#include "OXCoolCtrl.h"

Source code files:

"OXCoolCtrl.h"