Lines 1528-1549
Link Here
|
1528 |
} |
1528 |
} |
1529 |
|
1529 |
|
1530 |
void setForegroundColor (int /*long*/ handle, GdkColor color) { |
1530 |
void setForegroundColor (int /*long*/ handle, GdkColor color) { |
|
|
1531 |
setForegroundColor (handle, color, true); |
1532 |
} |
1533 |
|
1534 |
void setForegroundColor (int /*long*/ handle, GdkColor color, boolean setStateActive) { |
1535 |
/* |
1536 |
* Feature in GTK. When the widget doesn't have focus, then |
1537 |
* gtk_default_draw_flat_box () changes the background color state_type |
1538 |
* to GTK_STATE_ACTIVE. Widgets whose background is drawn using |
1539 |
* gtk_paint_flat_box or gtk_default_draw_flat_box have to pass false for |
1540 |
* setStateActive. |
1541 |
*/ |
1531 |
int /*long*/ style = OS.gtk_widget_get_modifier_style (handle); |
1542 |
int /*long*/ style = OS.gtk_widget_get_modifier_style (handle); |
1532 |
OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color); |
1543 |
OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color); |
1533 |
OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_ACTIVE, color); |
1544 |
if (setStateActive) OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_ACTIVE, color); |
1534 |
OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_PRELIGHT, color); |
1545 |
OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_PRELIGHT, color); |
1535 |
int flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL); |
1546 |
int flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL); |
1536 |
flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG; |
1547 |
flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG; |
1537 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags); |
1548 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags); |
1538 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE); |
1549 |
if (setStateActive) { |
1539 |
flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG; |
1550 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE); |
1540 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags); |
1551 |
flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG; |
|
|
1552 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags); |
1553 |
} |
1541 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT); |
1554 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT); |
1542 |
flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG; |
1555 |
flags = (color == null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG; |
1543 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags); |
1556 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags); |
1544 |
|
1557 |
|
1545 |
OS.gtk_rc_style_set_text (style, OS.GTK_STATE_NORMAL, color); |
1558 |
OS.gtk_rc_style_set_text (style, OS.GTK_STATE_NORMAL, color); |
1546 |
OS.gtk_rc_style_set_text (style, OS.GTK_STATE_ACTIVE, color); |
1559 |
if (setStateActive) OS.gtk_rc_style_set_text (style, OS.GTK_STATE_ACTIVE, color); |
1547 |
OS.gtk_rc_style_set_text (style, OS.GTK_STATE_PRELIGHT, color); |
1560 |
OS.gtk_rc_style_set_text (style, OS.GTK_STATE_PRELIGHT, color); |
1548 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL); |
1561 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL); |
1549 |
flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT; |
1562 |
flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT; |
Lines 1551-1559
Link Here
|
1551 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT); |
1564 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT); |
1552 |
flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT; |
1565 |
flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT; |
1553 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags); |
1566 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags); |
1554 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE); |
1567 |
if (setStateActive) { |
1555 |
flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT; |
1568 |
flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE); |
1556 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags); |
1569 |
flags = (color == null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT; |
|
|
1570 |
OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags); |
1571 |
} |
1557 |
modifyStyle (handle, style); |
1572 |
modifyStyle (handle, style); |
1558 |
} |
1573 |
} |
1559 |
|
1574 |
|