Files
Work/common/OWNER.HPP
2024-08-07 09:09:36 -04:00

63 lines
1.5 KiB
C++
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef _COMMON_OWNER_HPP_
#define _COMMON_OWNER_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_LINKEDBUTTON_HPP_
#include <common/btnlnk.hpp>
#endif
#ifndef _COMMON_LINKEDBITMAP_HPP_
#include <common/bmplnk.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class OwnerDraw
{
public:
enum FocusItem{FOCUS,NOFOCUS};
enum Usage{UseLibrary,UseInstance};
OwnerDraw(Usage sourceResource=UseLibrary);
virtual ~OwnerDraw();
operator HINSTANCE(void)const;
int associate(int ctlID,String &focusUp,String &noFocusUp,String &focusDown,FocusItem focusItem);
int associate(int ctlID,String &focusUp,String &noFocusUp,String &focusDown,String &noFocusDisabled,FocusItem focusItem);
int handleOwnerButton(int ctlID,LPARAM lParam);
void freeButton(int ctlID);
int associate(int ctlID,String &bitmapName);
void drawBitmap(int ctlID,HWND hWnd,RECT locationRect);
void drawBitmap(int ctlID);
void freeBitmap(int ctlID);
private:
HINSTANCE instanceData(void);
int locateLinkedButton(int ctlID);
int locateLinkedBitmap(int ctlID);
HINSTANCE mhLibrary;
HINSTANCE mhInstance;
Block<LinkedButton> mLinkedButtons;
Block<LinkedBitmap> mLinkedBitmaps;
};
inline
OwnerDraw::operator HINSTANCE(void)const
{
return mhLibrary;
}
inline
HINSTANCE OwnerDraw::instanceData(void)
{
#ifdef __FLAT__
return ::GetModuleHandle(0);
#else
return ((HINSTANCE)(_DS-1));
#endif
}
#endif