⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 combobox.h

📁 minigui 开源代码 非常实用 对学习嵌入式GUI开发有一定的实用的参考价值
💻 H
📖 第 1 页 / 共 2 页
字号:
/**
 * \file combobox.h
 * \author Wei Yongming <ymwei@minigui.org>
 * \date 2001/12/29
 * 
 \verbatim

    Copyright (C) 2002-2007 Feynman Software.
    Copyright (C) 1998-2002 Wei Yongming.

    All rights reserved by Feynman Software.

    This file is part of MiniGUI, a compact cross-platform Graphics 
    User Interface (GUI) support system for real-time embedded systems.

 \endverbatim
 */

/*
 * $Id: combobox.h 7365 2007-08-16 05:22:17Z xgwang $
 *
 *             MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, 
 *                     pSOS, ThreadX, NuCleus, OSE, and Win32.
 *
 *             Copyright (C) 2002-2007 Feynman Software.
 *             Copyright (C) 1999-2002 Wei Yongming.
 */

#ifndef _MGUI_CTRL_COMBOBOX_H
#define _MGUI_CTRL_COMBOBOX_H
 
#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */

    /**
     * \addtogroup controls
     * @{
     */

    /**
     * \defgroup ctrl_combobox ComboBox control
     * @{
     */

/**
 * \def CTRL_COMBOBOX
 * \brief The class name of combobox control.
 */
#define CTRL_COMBOBOX       ("combobox")

    /**
     * \defgroup ctrl_combobox_styles Styles of combobox control
     * @{
     */

/**
 * \def CBS_SIMPLE
 * \brief Displays the list box at all times.
 *
 * The current selection in the list box is displayed in the edit control.
 *
 * \note The argument \a dwAddData of \a CreateWindowEx function should be the
 * expected height of the list box.
 *
 * \code
 * int listbox_height = 100;
 *
 * CreateWindowEx (CTRL_COMBOBOX, ..., listbox_height);
 * \endcode
 */
#define CBS_SIMPLE              0x0000L

/**
 * \def CBS_AUTOSPIN
 * \brief Creates AutoSpin box.
 *
 * AutoSpin box has an input field with a spin button. The input field
 * displays an integer, and you can click spin button to increase or
 * decrease the value of the integer.
 */
#define CBS_AUTOSPIN            0x0001L

/**
 * \def CBS_SPINLIST
 * \brief Creates SpinList box.
 *
 * SpinList box has an input field with a spin button. The input field
 * displays some text, and you can click spin button to change the text.
 * The candidate text string comes from the strings you add to the box.
 */
#define CBS_SPINLIST            0x0002L

/**
 * \def CBS_DROPDOWNLIST
 * \brief Specifies a drop-down list box in the selection filed.
 *
 * \note The argument \a dwAddData of \a CreateWindowEx function should be the
 * expected height of the list box.
 *
 * \code
 * int listbox_height = 100;
 *
 * CreateWindowEx (CTRL_COMBOBOX, ..., listbox_height));
 * \endcode
 */
#define CBS_DROPDOWNLIST        0x0003L

/**
 * \def CBS_TYPEMASK
 * \brief The type mask of style of combobox.
 */
#define CBS_TYPEMASK            0x0007L

/**
 * \def CBS_NOTIFY
 * \brief Notifies the parent window.
 *
 * Causes the combo box to notify the parent window 
 * with a notification message.
 */
#define CBS_NOTIFY              0x0008L

/**
 * \def CBS_SPINARROW_TOPBOTTOM
 * \brief The spin arrow
 */
#define CBS_SPINARROW_TOPBOTTOM 0x0010L

/**
 * \def CBS_SPINARROW_LEFTRIGHT
 * \brief The spin arrow
 */
#define CBS_SPINARROW_LEFTRIGHT 0x0020L

#define CBS_AUTOHSCROLL         0x0040L
#define CBS_DISABLENOSCROLL     0x0080L

/**
 * \def CBS_SORT
 * \brief Automatically sorts strings entered in the list box.
 */
#define CBS_SORT                0x0100L

/**
 * \def CBS_AUTOLOOP
 * \brief Loops the value automatically if the type of combobox is CBS_AUTOSPIN.
 */
#define CBS_AUTOLOOP            0x0200L

/**
 * \def CBS_EDITNOBORDER
 * \brief The edit box has no border.
 */
#define CBS_EDITNOBORDER        0x0400L

/**
 * \def CBS_EDITBASELINE
 * \brief The edit box has base line.
 */
#define CBS_EDITBASELINE        0x0800L

/**
 * \def CBS_READONLY
 * \brief The edit field is read-only.
 */
#define CBS_READONLY            0x1000L

/**
 * \def CBS_UPPERCASE
 * \brief The edit field is uppercase.
 */
#define CBS_UPPERCASE           0x2000L

/**
 * \def CBS_LOWERCASE
 * \brief The edit field is lowercase.
 */
#define CBS_LOWERCASE           0x4000L

/**
 * \def CBS_AUTOFOCUS
 * \brief The edit field will gain the focus automatically.
 */
#define CBS_AUTOFOCUS           0x8000L

    /** @} end of ctrl_combobox_styles */

    /**
     * \defgroup ctrl_combobox_msgs Messages of combobox control
     * @{
     */

/**
 * \def CB_GETEDITSEL
 * \brief Gets the starting and ending character positions of the current 
 *        selection.
 *
 * An application sends a CB_GETEDITSEL message to get the starting and ending 
 * character positions of the current selection in the edit control of a combo box.
 *
 * \code
 * CB_GETEDITSEL
 * int start;
 * int end;
 *
 * wParam = (WPARAM)&start;
 * lParam = (LPARAM)&end;
 * \endcode
 *
 * \param start Pointer to a 32-bit value that receives the starting
 *           position of the selection.
 * \param end Pointer to a 32-bit value that receives the ending
 *           position of the selection.
 *
 * \note Not implemented yet.
 */
#define CB_GETEDITSEL               0xF140

/**
 * \def CB_LIMITTEXT
 * \brief Limits the length of text in the edit control.
 *
 * An application sends a CB_LIMITTEXT message to limit the length of the text
 * the user may type into the edit control of a combo box. 
 *
 * \code
 * CB_LIMITTEXT
 * int newLimit;
 *
 * wParam = (WPARAM)newLimit;
 * lParam = 0;
 * \endcode
 *
 * \param newLimit Specifies the maximum number of characters the user can enter.
 *
 * \return The return value is always zero.
 */
#define CB_LIMITTEXT                0xF141

/**
 * \def CB_SETEDITSEL
 * \brief Sets the starting and ending character positions of the current 
 *        selection.
 *
 * An application sends a CB_SETEDITSEL message to set the starting and ending 
 * character positions of the current selection in the edit control of a combo box.
 *
 * \code
 * CB_SETEDITSEL
 * int start;
 * int end;
 *
 * wParam = (WPARAM)start;
 * lParam = (LPARAM)end;
 * \endcode
 *
 * \param start The starting position of the selection.
 * \param end The ending position of the selection.
 *
 * \note Not implemented yet.
 */
#define CB_SETEDITSEL               0xF142

/**
 * \def CB_ADDSTRING
 * \brief Adds a string to the list box of a combo box.
 *
 * An application sends a CB_ADDSTRING message to add a string to the list box
 * of a combo box. 
 *
 * \code
 * CB_ADDSTRING
 * char* string;
 *
 * wParam = 0;
 * lParam = (LPARAM)string;
 * \endcode
 *
 * \param string Pointer to the null-terminated string to be added.
 *
 * \return The index of the new item on success, else the one of
 *         the following error codes:
 *
 *         - CB_ERRSPACE    No memory can be allocated for new item.
 *         - CB_ERR         Invalid passed arguments.
 */
#define CB_ADDSTRING                0xF143

/**
 * \def CB_DELETESTRING
 * \brief Deletes a string in the list box of a combo box.
 *
 * An application sends a CB_DELETESTRING message to delete a string in the list box
 * of a combo box. 
 *
 * \code
 * CB_DELETESTRING
 * int index;
 *
 * wParam = (WPARAM)index;
 * lParam = 0;
 * \endcode
 *
 * \param index Specifies the index of the string to delete.
 *
 * \return If succeed, return zero; otherwise CB_ERR.
 */
#define CB_DELETESTRING             0xF144

#define CB_DIR                      0xF145

/**
 * \def CB_GETCOUNT
 * \brief Retreives the number of items in the list box of a combo box.
 *
 * An application sends a CB_GETCOUNT message to retreive the number of items 
 * in the list box of a combo box. 
 *
 * \code
 * CB_GETCOUNT
 *
 * wParam = 0;
 * lParam = 0;
 * \endcode
 *
 * \return The number of items in the list box.
 */
#define CB_GETCOUNT                 0xF146

/**
 * \def CB_GETCURSEL
 * \brief Retreives the index of the currently selected item in the list box.
 *
 * An application sends a CB_GETCURSEL message to retreive the index of the 
 * currently selected item in the list box of a combo box. 
 *
 * \code
 * CB_GETCURSEL
 *
 * wParam = 0;
 * lParam = 0;
 * \endcode
 *
 * \return The index of currently selected item in the list box if have one;
 *         otherwise CB_ERR.
 */
#define CB_GETCURSEL                0xF147

/**
 * \def CB_GETLBTEXT
 * \brief Retreives the string of an item in the list box.
 *
 * An application sends a CB_GETLBTEXT message to retreive the string of 
 * a specified item in the list box of a combo box. 
 *
 * \code
 * CB_GETLBTEXT
 * int index;
 * char* string;
 *
 * wParam = (WPARAM)index;
 * lParam = (LPARAM)string;
 * \endcode
 *
 * \param index The index of the selected item.
 * \param string Pointer to the string buffer.
 *
 * \return One of the following values:
 *         - CB_OKAY\n  Success.
 *         - CB_ERR\n   Invalid item index.
 */
#define CB_GETLBTEXT                0xF148

/**
 * \def CB_GETLBTEXTLEN
 * \brief Gets the string length of an item in the list box.
 *
 * An application sends a CB_GETLBTEXTLEN message to get the string length
 * of a specified item in the list box of a combo box. 
 *
 * \code
 * CB_GETLBTEXTLEN
 * int index;
 *
 * wParam = (WPARAM)index;
 * lParam = 0;
 * \endcode
 *
 * \param index The index of the specified item.
 *
 * \return The length of the string on success; otherwise CB_ERR.
 */
#define CB_GETLBTEXTLEN             0xF149

/**
 * \def CB_INSERTSTRING
 * \brief Inserts a string to the list box of a combo box.
 *
 * An application sends a CB_INSERTSTRING message to insert a string to the list 
 * box of a combo box. Unlike the CB_ADDSTRING message, the CB_INSERTSTRING message
 * do not cause a list to be sorted.
 *
 * \code
 * CB_INSERTSTRING
 * int index;
 * char* string;
 *
 * wParam = (WPARAM)index;
 * lParam = (LPARAM)string;
 * \endcode
 *
 * \param index The index of the position at which to insert the string.
 * \param string Pointer to the null-terminated string to be added.
 *
 * \return The index of the new item on success, else the one of
 *         the following error codes:
 *
 *         - CB_ERRSPACE    No memory can be allocated for new item.
 *         - CB_ERR         Invalid passed arguments.
 */
#define CB_INSERTSTRING             0xF14A

/**
 * \def CB_RESETCONTENT
 * \brief Removes all items from the list box and edit control.
 *
 * An application sends a CB_RESETCONTENT message remove all items from the list
 * box and edit control of a combo box. 
 *
 * \code
 * CB_RESETCONTENT
 *
 * wParam = 0;
 * lParam = 0;
 * \endcode
 *
 * \return Always be zero.
 */
#define CB_RESETCONTENT             0xF14B

/**
 * \def CB_FINDSTRING
 * \brief Searchs the list box for an item beginning with the characters in a 
 *         specified string.
 *
 * An application sends a CB_FINDSTRING message to search the list box for an 
 * item beginning with the characters in a specified string.
 *
 * \code
 * CB_FINDSTRING
 * int indexStart;
 * char* string;
 *
 * wParam = (WPARAM)indexStart;
 * lParam = (LPARAM)string;
 * \endcode
 *
 * \param indexStart Index of the item preceding the first item to be searched.
 * \param string Pointer to the null-terminated string that contains the prefix
 *             to search for.
 *
 * \return The index of the matching item or CB_ERR to indicate not found.
 */
#define CB_FINDSTRING               0xF14C

#define CB_SELECTSTRING             0xF14D

/**
 * \def CB_SETCURSEL
 * \brief Selects a string in the list of a combo box.
 *
 * \code
 * CB_SETCURLSEL
 * int index;
 *
 * wParam = (WPARAM)index;
 * lParam = 0;
 * \endcode
 *
 * \param index The index of the string to select. 
 *
 * \return CB_OKAY on success; otherwise CB_ERR to indicate an invalid index.
 */
#define CB_SETCURSEL                0xF14E

#define CB_SHOWDROPDOWN             0xF14F

/**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -