lfpport_qte_choicegroup.h
来自「This is a resource based on j2me embedde」· C头文件 代码 · 共 1,394 行 · 第 1/3 页
H
1,394 行
class ListBody : public QListBox { public: /** * Override QListBox to notify Java peer of traversal out. * * @param keyEvent key event to handle */ void keyPressEvent(QKeyEvent *keyEvent); /** * Override QListBox to notify Java peer of traversal out. * * @param keyEvent key event to handle */ void keyReleaseEvent(QKeyEvent *keyEvent); /** * Construct. * @param parent List widget. */ ListBody(QWidget *parent); /** * ListBody destructor. */ virtual ~ListBody(); protected: /** * Makes this item have focus, enabling any item-specific commands; in * addition, if the given event was caused by a user action, notifies the * Java platform of the change in focus. * * @param event pointer to the device event corresponding to the change in * focus. */ void focusInEvent(QFocusEvent *event);};/** * Body widget for POPUP ChoiceGroup. * It's a extended QPushButton with a QPopupMenu. */class PopupBody : public QPushButton { protected: /** button text before truncation */ QString longText; /** button text, truncated */ QString shortText; /** button width to track resizing and redo truncation when necessary */ int oldWidth; /** popup list */ QListBox *qPopup; /** if list is popped up */ bool poppedUp; public: /** * PopupBody constructor. * * @param parent POPUP choicegroup widget */ PopupBody(QWidget *parent); /** * PopupBody destructor. */ virtual ~PopupBody(); /** * Overrides default implementation to return size based * on the width of the largest element in the Popup. * @return the size of the popup */ QSize sizeHint() const; /** * Override setText to support text truncation */ void setText(const QString & newText); /** * Set popup list variable */ void setList(QListBox *list); /** * Get popup list variable */ QListBox* getList(); /** * Override drawButton to support text truncation */ virtual void drawButton( QPainter * p ); /** * Pops down (removes) the combo box popup list box. */ void popDownList(); protected: /** * Makes this item have focus, enabling any item-specific commands; in * addition, if the given event was caused by a user action, notifies the * Java platform of the change in focus. * * @param event pointer to the device event corresponding to the change in * focus. */ void focusInEvent(QFocusEvent *event); /** * Override to show popup list * * @param keyEvent key event to handle */ void keyPressEvent(QKeyEvent *keyEvent); /** * Override to show popup list * * @param e pointer event to handle */ void mousePressEvent( QMouseEvent *e); /** * Override QPushButton to notify Java peer of traversal out. * * @param keyEvent key event to handle */ void keyReleaseEvent(QKeyEvent *keyEvent); /** * The event filter receives events from the listbox when it is * popped up. */ bool eventFilter(QObject *object, QEvent *event); /** * Popups the popup list. * If the list is empty, no selections appear. */ void popupList();};// *********************************************************/** * Native widget for MULTIPLE and EXCLUSIVE ChoiceGroup. */class ChoiceButtonBox : public Choice { Q_OBJECT /** Body widget */ ChoiceButtonBoxBody *qGroup; /** Current selected element. Only used for EXCLUSIVE CG. */ int selectedIndex; protected: /** * Moves this body widget so that its upper left corner is at the given x * and y coordinates. * * @param x the horizontal coordinate of the upper-left corner of this * choice group. * @param y the vertical coordinate of the upper-left corner of this choice * group. */ void bodyRelocate(int x, int y); /** * Resize this body widget. * * @param w new width * @param h new height */ void bodyResize(int w, int h); /** * Calculate body widget height when width is limited to a given value. * * @param takenWidth return value of the real width used * @param w maximum width * @return body widget height */ int bodyHeightForWidth(int *takenWidth, int w); /** * Calculate body widget width when height is limited to a given value. * * @param takenHeight return value of the real height used * @param h maximum height * @return body widget width */ int bodyWidthForHeight(int *takenHeight, int h); public : /** * Constructor. * * @param parent owner screen's widget * @param label label text * @param layout layout directive associated with this choicegroup * @param exclusive true if EXCLUSIVE CG, otherwise MULTIPLE CG * @param fitPolicy wrap text */ ChoiceButtonBox(QWidget *parent, const QString &label, int layout, bool exclusive, int fitPolicy); /** * ChoiceButtonBox destructor. */ ~ChoiceButtonBox(); /** * Insert an element. * * @param elementNum insert position * @param str text portion * @param img image portion * @param selected selection state * @return status of this call */ MidpError insert(int elementNum, const QString &str, QPixmap* img, jboolean selected); /** * Delete an element from this body widget. * * @param elementNum index of the element to be deleted * @param selIndex index of the element that should be selected * after deletion * @return status of this call */ MidpError deleteElement(int elementNum, int selectedIndex); /** * Delete all elements. * * @return status of this call */ MidpError deleteAll(); /** * Update an element with new text, image and selection state. * * @param elementNum index of the element * @param str new text * @param img new image * @param selected new selection state * @return status of this call */ MidpError set(int elementNum, const QString &str, QPixmap* img, jboolean selected); /** * Set selection state of an element. * * @param elementNum index of the element * @param selected new selection state * @return status of this call */ MidpError setSelectedIndex(int elementNum, jboolean selected); /** * Get current selected element. * * @param elementNum return value for index of currently selected element * @return status of this call */ MidpError getSelectedIndex(int *elementNum); /** * Set selection state for all elements. * * @param selectedArray array of selection state * @param arrayLength size of the array * @return status of the call */ MidpError setSelectedFlags(jboolean* selectedArray, int arrayLength); /** * Get selection state of all elements. * * @param numSelected return the number of elements currently selected * @param selectedArray array for store the states * @param arrayLength size of the array * @return status of this call */ MidpError getSelectedFlags(int *numSelected, jboolean* selectedArray, int arrayLength); /** * Check whether an element is selected. * * @param selected return whether selected * @param elementNum index of the element * @return status of this call */ MidpError isSelected(jboolean *selected, int elementNum); /** * Set the text wrapping policy. * * @param fitPolicy TEXT_WRAP_ON if wrapping is enabled * @return status of this call */ MidpError setFitPolicy(int fitPolicy); /** * Set font for an element. * * @param elementNum index of the element * @param font new font * @return status of this call */ MidpError setFont(int elementNum, QFont *font);};/** * Widget of IMPLICIT List. */class List : public Choice { Q_OBJECT /** * Body widget. */ ListBody *qList; protected: /** * Moves this choice group so that its upper left corner is at the given x * and y coordinates. * * @param x the horizontal coordinate of the upper-left corner of this * choice group. * @param y the vertical coordinate of the upper-left corner of this choice * group. */ void bodyRelocate(int x, int y); /** * Resize the body widget. * * @param w new widget * @param h new height */ void bodyResize(int w, int h); /** * Calculate the height of the body widget when its width is limited to a given * value. * * @param takenWidth pointer to the real width used, to be set on return * @param w maximum width allowed * @return height */ int bodyHeightForWidth(int *takenWidth, int w); /** * Calculate the width of the body widget when its height is limited to a given * value. * * @param takenHeight pointer to the real height used, to be set on return * @param h maximum height allowed * @return width */ int bodyWidthForHeight(int *takenHeight, int h); public : /** * List constructor. * * @param parent owner screen's widget * @param label label text * @param fitPolicy text wrapping policy */ List(QWidget *parent, const QString &label, int fitPolicy); /** * List destructor. */ ~List(); /** * Insert a new element into an implicit list. * * @param elementNum insert position * @param str text portion of the new element * @param img image portion of the new element * @param selected selection state of the new element * @return status of this call */ MidpError insert(int elementNum, const QString &str, QPixmap* img, jboolean selected); /** * Delete an element from an implicit List. * * @param elementNum index of the element to be deleted * @param selectedIndex new element to be selected after the deletion * @return status of this call */ MidpError deleteElement(int elementNum, int selectedIndex); /** * Delete all elements from an implicit list. * * @return status of this call */ MidpError deleteAll(); /** * Update the text and image of an element. * * @param elementNum index of the element * @param str new text * @param img new image * @param selected new selection state * @return status of this call */ MidpError set(int elementNum, const QString &str, QPixmap* img, jboolean selected); /** * Set the selected index of this List. * * @param elementNum index of the element to be set * @param selected true if the element should be made selected * @return status of this call */ MidpError setSelectedIndex(int elementNum, jboolean selected); /** * Get current selection. * * @param elementNum pointer to the current selection, to be set on return * @return status of this call */ MidpError getSelectedIndex(int *elementNum); /** * Set selection state for all elements in this List. * Only one element can be selected at a time. * * @param selectedArray array of selection state * @param arrayLength size of the array * @return status of this all */ MidpError setSelectedFlags(jboolean* selectedArray, int arrayLength);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?