comparison dw.hpp @ 2879:ec7f6e28166d

C++: Add Calendar widget and fix an issue in that last commit.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 20 Dec 2022 18:06:51 +0000
parents a290573a8b7c
children 2ba0959eb3cf
comparison
equal deleted inserted replaced
2878:a290573a8b7c 2879:ec7f6e28166d
277 void Set(unsigned long id) { dw_window_set_bitmap(hwnd, id, DW_NULL); } 277 void Set(unsigned long id) { dw_window_set_bitmap(hwnd, id, DW_NULL); }
278 void Set(const char *file) { dw_window_set_bitmap(hwnd, 0, file); } 278 void Set(const char *file) { dw_window_set_bitmap(hwnd, 0, file); }
279 void Set(const char *data, int len) { dw_window_set_bitmap_from_data(hwnd, 0, data, len); } 279 void Set(const char *data, int len) { dw_window_set_bitmap_from_data(hwnd, 0, data, len); }
280 }; 280 };
281 281
282 // Class for handing calendar widget
283 class Calendar : public Widget
284 {
285 public:
286 // Constructors
287 Calendar(unsigned long id) { SetHWND(dw_calendar_new(id)); }
288 Calendar() { SetHWND(dw_calendar_new(0)); }
289
290 // User functions
291 void GetData(unsigned int *year, unsigned int *month, unsigned int *day) { dw_calendar_get_date(hwnd, year, month, day); }
292 void SetData(unsigned int year, unsigned int month, unsigned int day) { dw_calendar_set_date(hwnd, year, month, day); }
293 };
294
295
282 // Forward declare these so our Drawable abstract class can reference 296 // Forward declare these so our Drawable abstract class can reference
283 class Render; 297 class Render;
284 class Pixmap; 298 class Pixmap;
285 299
286 // Abstract class that defines drawing, either to screen or picture (pixmap) 300 // Abstract class that defines drawing, either to screen or picture (pixmap)
424 // Base class for several widgets that allow text entry 438 // Base class for several widgets that allow text entry
425 class TextEntry : virtual public Focusable, virtual public TextWidget 439 class TextEntry : virtual public Focusable, virtual public TextWidget
426 { 440 {
427 public: 441 public:
428 // User functions 442 // User functions
429 void ClickDefault(Focusable *next) { dw_window_click_default(hwnd, next); } 443 void ClickDefault(Focusable *next) { if(next) dw_window_click_default(hwnd, next->GetHWND()); }
430 }; 444 };
431 445
432 class Entryfield : public TextEntry 446 class Entryfield : public TextEntry
433 { 447 {
434 public: 448 public: