< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_List.h

Print this page




  39 public:
  40     AwtList();
  41     virtual ~AwtList();
  42 
  43     virtual LPCTSTR GetClassName();
  44 
  45     static AwtList* Create(jobject peer, jobject parent);
  46 
  47     virtual BOOL NeedDblClick() { return TRUE; }
  48 
  49     INLINE void Select(int pos) {
  50         if (isMultiSelect) {
  51             SendListMessage(LB_SETSEL, TRUE, pos);
  52         }
  53         else {
  54             SendListMessage(LB_SETCURSEL, pos);
  55         }
  56     }
  57     INLINE void Deselect(int pos) {
  58         if (isMultiSelect) {

  59             SendListMessage(LB_SETSEL, FALSE, pos);
  60         }
  61         else {
  62             SendListMessage(LB_SETCURSEL, (WPARAM)-1);
  63         }
  64     }
  65     INLINE UINT GetCount() {
  66         LRESULT index = SendListMessage(LB_GETCOUNT);
  67         DASSERT(index != LB_ERR);
  68         return static_cast<UINT>(index);
  69     }
  70 
  71     INLINE void InsertString(WPARAM index, LPTSTR str) {
  72         VERIFY(SendListMessage(LB_INSERTSTRING, index, (LPARAM)str) != LB_ERR);
  73     }
  74     INLINE BOOL IsItemSelected(UINT index) {
  75         LRESULT ret = SendListMessage(LB_GETSEL, index);
  76         DASSERT(ret != LB_ERR);
  77         return (ret > 0);
  78     }




  39 public:
  40     AwtList();
  41     virtual ~AwtList();
  42 
  43     virtual LPCTSTR GetClassName();
  44 
  45     static AwtList* Create(jobject peer, jobject parent);
  46 
  47     virtual BOOL NeedDblClick() { return TRUE; }
  48 
  49     INLINE void Select(int pos) {
  50         if (isMultiSelect) {
  51             SendListMessage(LB_SETSEL, TRUE, pos);
  52         }
  53         else {
  54             SendListMessage(LB_SETCURSEL, pos);
  55         }
  56     }
  57     INLINE void Deselect(int pos) {
  58         if (isMultiSelect) {
  59             SendListMessage(LB_SETCARETINDEX, pos, FALSE);
  60             SendListMessage(LB_SETSEL, FALSE, pos);
  61         }
  62         else {
  63             SendListMessage(LB_SETCURSEL, (WPARAM)-1);
  64         }
  65     }
  66     INLINE UINT GetCount() {
  67         LRESULT index = SendListMessage(LB_GETCOUNT);
  68         DASSERT(index != LB_ERR);
  69         return static_cast<UINT>(index);
  70     }
  71 
  72     INLINE void InsertString(WPARAM index, LPTSTR str) {
  73         VERIFY(SendListMessage(LB_INSERTSTRING, index, (LPARAM)str) != LB_ERR);
  74     }
  75     INLINE BOOL IsItemSelected(UINT index) {
  76         LRESULT ret = SendListMessage(LB_GETSEL, index);
  77         DASSERT(ret != LB_ERR);
  78         return (ret > 0);
  79     }


< prev index next >